|
Page 1 of 1
|
[ 10 posts ] |
|
Problems getting IRLink to work
Author |
Message |
wleue
Rookie
Joined: Tue Oct 06, 2009 4:42 pm Posts: 17
|
 Problems getting IRLink to work
I am having problems getting the HiTech IRLink to work. I am using Xander's driver.
My setup is very simple. I have the IRLink connected to sensor port 3. It is looking directly at a PF IR Receiver, which is running a medium PF motor. I am using the standard PF battery pack. (non-rechargable). The IR receiver is set to address 1.
When I use the standard hand-held PF controller, it works fine: I can run the motor forwards and backwards using the hand-held control. However, when I run the simple test program whose source code is shown below, I get no response from the IR receiver (no blinking light) and no motor action.
Please, IR gurus, take a peek at this short program and give me a clue as to where I might be going wrong. I am running RobotC version 1.91B. As you can see, I have this configured to run both motors, even though only a single motor is connected to the IR receiver. I have tried the motor in both the blue and red ports to no avail.
Thanks! -Bill
----------------------------------- (source code follows) #include "common.h" #include "HTIRL-driver.h"
#pragma config(Sensor, S1, HomeTouch, sensorTouch) #pragma config(Sensor, S2, MoveTouch, sensorTouch) #pragma config(Sensor, S3, IRLink, sensorHighSpeed) #pragma config(Motor, motorA, Theta, tmotorNormal, openLoop, ) #pragma config(Motor, motorB, Phi1, tmotorNormal, openLoop, reversed) #pragma config(Motor, motorC, Phi2, tmotorNormal, openLoop, ) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
// controlled by Hi-Tech IRLink from sensor port S3 short GRABBER_MOTOR = 1;
void setGrabber(int grab) { eCDMMotorCommand cmd = 0; if (grab > 0) { cmd = CDM_MOTOR_FWD; } else { cmd = CDM_MOTOR_BAK; } PFcomboDirectMode(IRLink, GRABBER_MOTOR, cmd, cmd); wait1Msec(500); cmd = CDM_MOTOR_FLOAT; PFcomboDirectMode(IRLink, GRABBER_MOTOR, cmd, cmd); }
task main() { while (1) { setGrabber(-1); wait1Msec(1000); setGrabber(1); wait1Msec(1000); } }
|
Wed Oct 14, 2009 9:14 pm |
|
 |
mightor
Site Admin
Joined: Wed Mar 05, 2008 8:14 am Posts: 3654 Location: Rotterdam, The Netherlands
|
 Re: Problems getting IRLink to work
Hey Bill, I took your code and modified it a tiny bit to make it work with the setup I had, mainly just configured the IR Link for port 2, instead of 3. I think what may have happened is that you've got the IR channel configured for 1 on your receiver when your code is transmitting on channel 2. Remember that channel numbers go from 0 to 3, not 1 to 4. You can see this when you take a look at the example ([ LINK]). I will update the documentation regarding this numbering for the next release. Also, it is important to note that my drivers DO NOT officially support anything but sensorLowSpeed or sensorLowSpeed9v. This is also the only speed that is supported by HiTechnic. Anything other than that is unsupported and bugs will only be accepted as such if they are reproducible at the slower speed. Some sensors will work just fine at the higher speeds but there is no guarantee. In your code, using the slower sensor speed will not impact the execution of your code in any significant way. Regards, 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]
|
Thu Oct 15, 2009 2:09 am |
|
 |
wleue
Rookie
Joined: Tue Oct 06, 2009 4:42 pm Posts: 17
|
 Re: Problems getting IRLink to work
Xander, thanks very much for the quick and detailed reply!
Unfortunately, making the suggested changes in my code has not solved the problem. I have set the sensor type to LowSpeed, and have systematically investigated every possible combination of PF addresses in both program and using the orange switch on the IR receiver. No matter what, I don't even get a flicker on the green LED.
I have tried switching cables several times, switching sensor ports -- all no good. I had previously tested the IRLink using a leJOS driver with leJOS, and it did work. I suppose it is possible the IRLink has failed since then, but it has been sitting in a drawer, unused, so it does not seem very likely.
But you said it does work for you, so I am stumped.
-Bill
|
Thu Oct 15, 2009 1:44 pm |
|
 |
mightor
Site Admin
Joined: Wed Mar 05, 2008 8:14 am Posts: 3654 Location: Rotterdam, The Netherlands
|
 Re: Problems getting IRLink to work
Bill,
I am using a later version of ROBOTC than you are. I am using an internal build (1.96) which has quite a number of things fixed. Perhaps it would be better for you to use 1.46 until 2.x is released.
Regards, 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]
|
Thu Oct 15, 2009 1:57 pm |
|
 |
wleue
Rookie
Joined: Tue Oct 06, 2009 4:42 pm Posts: 17
|
 Re: Problems getting IRLink to work
Xander, As always, thanks for the suggestion! I tried to install 1.46, but ran into problems here too. First, I did a complete uninstall of 1.91B. Then I downloaded the 1.46 installer from http://www.ROBOTC.net/content/lego_down ... 46_265.exe. Installed it with all default options. When I try to start RobotC, I now get the error message 'This application has failed to start because the application configuration is incorrect.' I have now repeated the download/uninstall/reinstall sequence 3 times, but all with the same bad result. Is it possible that the specified installer image is bad on ROBOTC.net? Thanks! -Bill
|
Thu Oct 15, 2009 3:12 pm |
|
 |
wleue
Rookie
Joined: Tue Oct 06, 2009 4:42 pm Posts: 17
|
 Re: Problems getting IRLink to work
Well, after about 10 retries, I finally got version 1.46 of RobotC to install. It turns out that it is not enough to uninstall the old version, you must also MANUALLY REMOVE THE ENTIRE ROBOTC DIRECTORY TREE. (This would be a great item to put into a FAQ, hint, hint  ) So now version 1.46 appears to run. But it is not happy with the identifier 'sensorLowSpeed'. What should I use instead for this pragma? Thanks! -Bill
|
Thu Oct 15, 2009 3:23 pm |
|
 |
mightor
Site Admin
Joined: Wed Mar 05, 2008 8:14 am Posts: 3654 Location: Rotterdam, The Netherlands
|
 Re: Problems getting IRLink to work
Just rerun the motor and sensor wizard and pick the low speed I2C sensor  That will set it to sensorI2CCustomStd Regards, 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]
|
Thu Oct 15, 2009 3:34 pm |
|
 |
wleue
Rookie
Joined: Tue Oct 06, 2009 4:42 pm Posts: 17
|
 Re: Problems getting IRLink to work
Thanks again, Xander!
The IR receiver is now seeing commands from the IRLink. There is one remaining issue, however: although in my test program I am commanding the motor to run first one direction (CDM_MOTOR_FWD), then the other (CDM_MOTOR_BAK) -- the motor itself is running only counterclockwise.
Might there have to be a further change to adapt to the RobotC 1.46 environment? What about using the CPM commands instead of CDM?
Thanks! -Bill
|
Fri Oct 16, 2009 9:37 am |
|
 |
mightor
Site Admin
Joined: Wed Mar 05, 2008 8:14 am Posts: 3654 Location: Rotterdam, The Netherlands
|
 Re: Problems getting IRLink to work
Bill, Using the PFcomboPwmMode() calls would do the trick fine. It is usually the commands I use, I rarely, if ever, use the PFcomboDirectMode() command  Regards, 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]
|
Fri Oct 16, 2009 10:26 am |
|
 |
wleue
Rookie
Joined: Tue Oct 06, 2009 4:42 pm Posts: 17
|
 Re: Problems getting IRLink to work
Yes!!!! It works! Thanks again, Xander! For what it's worth, my "lessons learned" during this effort are: 1. Stick with RobotC version 1.46 for now; be very wary of beta versions. 2. Always uninstall and delete the entire RobotC directory before installing a new version. 3. Don't use the direct mode IRL commands: stick with the Pwm ones. 4. Trust Xander  -Bill
|
Fri Oct 16, 2009 10:42 am |
|
|
|
Page 1 of 1
|
[ 10 posts ] |
|
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
|
|