View unanswered posts | View active topics It is currently Fri Nov 22, 2019 11:57 am






Reply to topic  [ 30 posts ]  Go to page 1, 2  Next
RobotC 4.25 - IR Sensor restricted to port 2? 
Author Message
Rookie
User avatar

Joined: Wed Jun 04, 2014 4:06 pm
Posts: 30
Location: Margraten, The Netherlands
Post RobotC 4.25 - IR Sensor restricted to port 2?
First of all let me start by saying I'm impressed by v4.25. Good work guys!
I'm relatively new to RobotC so I start by testing the example code. I had a problem with getting the code for IR Beacon detection working. Finally I found out that the example code is working fine when the IR-sensor is connected to port S2, but the program does not work when the sensor is connected to any of the other ports (of course I setup the sensor correctly). Also functions like getIRBeaconDirection do not work when the IR-sensor is connected to a port other than S2. Are sensors restricted to specific ports? That's not something I would expect.

Gr. Kees


Fri Aug 29, 2014 6:00 am
Profile
Site Admin
Site Admin
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3654
Location: Rotterdam, The Netherlands
Post Re: RobotC 4.25 - IR Sensor restricted to port 2?
It should work on any sensor port. Could you paste the exact code you were experiencing issues with?

= Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Sat Aug 30, 2014 1:10 am
Profile WWW
Rookie
User avatar

Joined: Wed Jun 04, 2014 4:06 pm
Posts: 30
Location: Margraten, The Netherlands
Post Re: RobotC 4.25 - IR Sensor restricted to port 2?
Hi Xander,

It's just the the sample code file Basic_IRBeacon_Detection. I only altered the direction of the motors for my robot (so it steers in the right direction) and altered the treshold when to stop adjusting (from 0 to 5):

Code:
#pragma config(Sensor, S2,     IRBeacon,       sensorEV3_IRSensor, modeEV3IR_Seeker)
#pragma config(Motor,  motorB,          motorLeft,     tmotorEV3_Large, PIDControl, encoder)
#pragma config(Motor,  motorC,          motorRight,    tmotorEV3_Large, PIDControl, encoder)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

/*
IR Seeker Modes
0 - modeEV3IR_Proximity
1 - modeEV3IR_Seeker
2 - modeEV3IR_Remote
3 - modeEV3IR_Remote_Advanced
5 - modeEV3IR_Calibration
*/

task main()
{
   int currentPosition = 0;

   while(true)
   {
      // Read the sensor
     // The position is a value from -25 (extreme left) to +25 (extreme right).
     // 0 means either no beacon detected or a beacond dead-ahead.
      currentPosition = SensorValue[IRBeacon];

      displayCenteredBigTextLine(4, "Pos: %d", currentPosition);

      // If the sensor returns > 0, the beacon is to the right,
      // so turn the robot to the right to face it
      if (currentPosition > 5)  // I changed treshold from 0 to 5
      {
         motor[motorLeft] = -30;
         motor[motorRight] = 30;
      }
      // If the sensor returns < 0, the beacon is to the left,
      // so turn the robot to the left to face it
      else if (currentPosition < -5)  // I changed treshold from 0 to -5
      {
         motor[motorLeft] = 30;
         motor[motorRight] = -30;
      }
      // If the sensor returns 0, the sensor is either not
      // detecting anything or the beacon is straight in front
      else
      {
         motor[motorLeft] = 0;
         motor[motorRight] = 0;
      }

      //Loop to monitor value in Sensor debugger window
      sleep(50);
   }
}


To be sure I just tested it again today. Same happened again: IR-sensor on port 2 everything works fine, sensor on another port (port 1 in this case) the code doesn't work, because sensor stays in Proximity mode in stead of Seeker mode.
By the way, I'm working with EV3 on Windows 8.1. Don't know if that's any relevant information for you.

Gr. Kees


Sat Aug 30, 2014 3:00 am
Profile
Site Admin
Site Admin
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3654
Location: Rotterdam, The Netherlands
Post Re: RobotC 4.25 - IR Sensor restricted to port 2?
Hey there,

The following code works for me:
Code:
#pragma config(Sensor, S4,     IRBeacon,       sensorEV3_IRSensor, modeEV3IR_Seeker)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

/*
IR Seeker Modes
0 - modeEV3IR_Proximity
1 - modeEV3IR_Seeker
2 - modeEV3IR_Remote
3 - modeEV3IR_Remote_Advanced
5 - modeEV3IR_Calibration
*/

task main()
{
  int currentPosition = 0;

  while(true)
  {
    // Read the sensor
    // The position is a value from -25 (extreme left) to +25 (extreme right).
    // 0 means either no beacon detected or a beacond dead-ahead.
    currentPosition = SensorValue[IRBeacon];

    displayCenteredBigTextLine(4, "Pos: %d", currentPosition);

    //Loop to monitor value in Sensor debugger window
    sleep(50);
  }
}


Please note that I am using the latest internal build of ROBOTC. I'll have a post up on my blog later where you can get the latest proper release (4.26). Keep an eye on botbench.com!

= Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Sat Aug 30, 2014 3:21 am
Profile WWW
Rookie
User avatar

Joined: Wed Jun 04, 2014 4:06 pm
Posts: 30
Location: Margraten, The Netherlands
Post Re: RobotC 4.25 - IR Sensor restricted to port 2?
Hi Xander,

Your code works fine for me when IR-sensor is connected on port 2, 3 or 4 (still using v4.25). Same with my own code, so I wasn't specific enough: IR-sensor in Seeker mode seems not to be working on port 1. To find out whether it has something to do with my EV3 brick, I ran a test with the EV3 software, but there everything seems to be working fine. And to be even more sure, I fully charged the batteries of my brick, but that didn't help...
Did you test on port 1 with v4.26?

Gr. Kees


Sat Aug 30, 2014 10:41 am
Profile
Site Admin
Site Admin
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3654
Location: Rotterdam, The Netherlands
Post Re: RobotC 4.25 - IR Sensor restricted to port 2?
I can see some weirdness going on with port S1. I'll have to investigate. I'll get back to you.

= Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Sat Aug 30, 2014 3:21 pm
Profile WWW
Site Admin
Site Admin
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3654
Location: Rotterdam, The Netherlands
Post Re: RobotC 4.25 - IR Sensor restricted to port 2?
The colour sensor does not seem to have this issue when connected to S1. <cue eerie music>

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Sat Aug 30, 2014 3:24 pm
Profile WWW
Site Admin
Site Admin
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3654
Location: Rotterdam, The Netherlands
Post Re: RobotC 4.25 - IR Sensor restricted to port 2?
I have for your testing pleasure, a fresh new firmware and an even better-er new ROBOTC VM! I just tested it with the IR Seeker on S1 and it works well.

The problem was that there was still some debugging output going to the S1 port (which can act like a terminal window), which was upsetting the sensor.

I have placed them on my DropBox account in a single zip file, which you can get here: https://dl.dropboxusercontent.com/u/132 ... testfw.zip

You'll have to change the menu level to "super user" and pick "Choose file" both the Linux kernel and ROBOT firmware:

Image

Image

Image

Let me know how it goes!

= Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Sun Aug 31, 2014 2:52 am
Profile WWW
Rookie
User avatar

Joined: Wed Jun 04, 2014 4:06 pm
Posts: 30
Location: Margraten, The Netherlands
Post Re: RobotC 4.25 - IR Sensor restricted to port 2?
I replaced kernel and firmware as you told me, but it didn't help: IR-sensor still doesn't work on S1 :-(
It still works fine on other ports.
I see that on S1 it takes a few seconds for the sensor to react (displaying distance instead of direction, because sensor is in Proximity mode instead of Seeker mode). On other ports it takes a fraction of a second for the sensor to react (displaying the direction as it should).
You think I should test with v4.26? How do I replace v4.25?


Sun Aug 31, 2014 3:49 am
Profile
Site Admin
Site Admin
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3654
Location: Rotterdam, The Netherlands
Post Re: RobotC 4.25 - IR Sensor restricted to port 2?
I was under the assumption you were using ROBOTC 4.26. Please use the latest version you can download from the site. Simply install the new one over the old one. Make sure you are using the kernel image and VM I sent you.

= Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Sun Aug 31, 2014 4:32 am
Profile WWW
Rookie
User avatar

Joined: Wed Jun 04, 2014 4:06 pm
Posts: 30
Location: Margraten, The Netherlands
Post Re: RobotC 4.25 - IR Sensor restricted to port 2?
I just tested with v4.26 and kernel and firmware you sent me. No success I'm afraid... Any other suggestions? Did it work for you?


Sun Aug 31, 2014 5:29 am
Profile
Rookie

Joined: Fri Sep 20, 2013 8:39 am
Posts: 38
Post Re: RobotC 4.25 - IR Sensor restricted to port 2?
I do not see the v4.26 on the botbench website - Would love to try it.


Sun Aug 31, 2014 5:37 am
Profile
Rookie
User avatar

Joined: Wed Jun 04, 2014 4:06 pm
Posts: 30
Location: Margraten, The Netherlands
Post Re: RobotC 4.25 - IR Sensor restricted to port 2?
Hi Sirius, you'll find v4.26 on the RobotC site.

Hi Xander,
I hate to say it, but results are getting worse...
On ports S2 to S4 I'm getting the following results: on first run everything is OK. But stopping the program and running it again gives same result as on port S1: IR-sensor stays in Proximity mode instead of Seeker mode. Stopping program, starting again and it works well. And so on and on (odd runs are fine, even runs are not)... funny isn't it? (Actually, no it isn't).

Something about v4.26: after compiling en downloading the program to the robot I have to re-open the debug window "sensors" every time again. In previous versions this window (and windows like local/global variables) stayed open. Is there a preference I have to change?

Gr, Kees


Last edited by KeesSmit on Sun Aug 31, 2014 6:04 am, edited 1 time in total.



Sun Aug 31, 2014 5:57 am
Profile
Rookie

Joined: Fri Sep 20, 2013 8:39 am
Posts: 38
Post Re: RobotC 4.25 - IR Sensor restricted to port 2?
Found it - Thanks

Will give it a try


Sun Aug 31, 2014 6:03 am
Profile
Site Admin
Site Admin
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3654
Location: Rotterdam, The Netherlands
Post Re: RobotC 4.25 - IR Sensor restricted to port 2?
Kees,

Please submit a ticket to support@robotc.net and refer to this thread.

= Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Sun Aug 31, 2014 11:45 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 30 posts ]  Go to page 1, 2  Next

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.