|
Page 1 of 1
|
[ 12 posts ] |
|
Author |
Message |
DiMastero
Expert
Joined: Wed Jun 30, 2010 7:15 am Posts: 181
|
 Delay with HTIRL
Hi there, when I use my HTIRL in a very simple program (see below) there is a pretty big delay between me pressing the touch sensor, and the motors moving (about one sec)... Why does that happen? And is there any way to solve it? thx, DiMastero
_________________leonoverweel.com
|
Mon Jul 19, 2010 1:25 pm |
|
 |
mightor
Site Admin
Joined: Wed Mar 05, 2008 8:14 am Posts: 3654 Location: Rotterdam, The Netherlands
|
 Re: Delay with HTIRL
I will take a look at this when I get back from vacation. I had a look at the driver and I can't see anything in there that could cause such a delay. You are using ROBOTC 2.02 and driver version 1.5, right?
- 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]
|
Mon Jul 19, 2010 1:32 pm |
|
 |
DiMastero
Expert
Joined: Wed Jun 30, 2010 7:15 am Posts: 181
|
 Re: Delay with HTIRL
I just checked it, and I am on version 2.02 and the the latest 3rd party sensors driver (v1.5)
_________________leonoverweel.com
|
Mon Jul 19, 2010 1:55 pm |
|
 |
Jampoz
Rookie
Joined: Sat Jan 09, 2010 12:25 pm Posts: 48 Location: Rome, Italy
|
 Re: Delay with HTIRL
Just like my thread, glad to see it isn't a psp-nx issue then
|
Tue Jul 20, 2010 4:41 am |
|
 |
DiMastero
Expert
Joined: Wed Jun 30, 2010 7:15 am Posts: 181
|
 Re: Delay with HTIRL
Hi there, I just realized I didn't explain myself well enough when I first talked about the HTIRL delay, by saying the motors didn't react to me pressing the touch sensor right away... The actual problem is that the motors don't stop until about a second after I stop pressing the button... I also tested the lights, in a different program:  |  |  |  | Code: #pragma config(Sensor, S1, HTIRL, sensorLowSpeed) #include "drivers/HTIRL-driver.h"
task main() { int MotorA_cmd = 2; int MotorB_cmd = 2;
ClearTimer(T1); while (time1[T1] < 10000) { switch(time1[T1]) { case 1000: MotorA_cmd = 2; PFcomboDirectMode(HTIRL, 3, (eCDMMotorCommand)MotorB_cmd, (eCDMMotorCommand)MotorA_cmd); wait1Msec(300); MotorA_cmd = 0; break; case 3000: MotorA_cmd = 2; PFcomboDirectMode(HTIRL, 3, (eCDMMotorCommand)MotorB_cmd, (eCDMMotorCommand)MotorA_cmd); wait1Msec(200); MotorA_cmd = 0; case 5000: MotorA_cmd = 2; PFcomboDirectMode(HTIRL, 3, (eCDMMotorCommand)MotorB_cmd, (eCDMMotorCommand)MotorA_cmd); wait1Msec(50); MotorA_cmd = 0; } } } |  |  |  |  |
And I still have the same problem... the lights go on at the right times, but they always take about three quarters of a second more than the desired times (300, 200 and 50 Msecs)... I'm not sure if that's helping, but I hope so... thx, DiMastero
_________________leonoverweel.com
|
Tue Jul 20, 2010 2:39 pm |
|
 |
mightor
Site Admin
Joined: Wed Mar 05, 2008 8:14 am Posts: 3654 Location: Rotterdam, The Netherlands
|
 Re: Delay with HTIRL
I will check this stuff when I get home tomorrow. Pop me a mail (you have the address) to remind me.
- 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]
|
Wed Jul 21, 2010 10:24 am |
|
 |
mightor
Site Admin
Joined: Wed Mar 05, 2008 8:14 am Posts: 3654 Location: Rotterdam, The Netherlands
|
 Re: Delay with HTIRL
K, I've confirmed my original suspicions. The PF commands you are using work as follows: - Send a command to the receiver
- Receiver controls motor
- Waits for next commands
- If no new command appears for 1.2 seconds, the command is timed out and the motor is switched off
This is where your 1s delay is coming from. You stop sending "motor run forward" commands but you're not telling it to stop the motors either. I made a small program that shows how you can make this work the way you'd like it to. In other words, stop the motor as soon as you stop pressing the switch.  |  |  |  | Code: #pragma config(Sensor, S1, HTIRL, sensorLowSpeed) #pragma config(Sensor, S4, TouchSensor, sensorTouch) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
#include "drivers/HTIRL-driver.h"
task main() { // For now until the batteries run out. while (true) { // Is the button pressed? if (SensorValue[TouchSensor]) { // Keep telling the receiver to run the motors while the button is pressed while(SensorValue[TouchSensor]) { PFcomboPwmMode(HTIRL, 3, CPM_MOTOR_BAK_PWM_7, CPM_MOTOR_FWD_PWM_7); } // The button is no longer pressed, tell the motors to stop. PFcomboPwmMode(HTIRL, 3, CPM_MOTOR_BRAKE, CPM_MOTOR_BRAKE); } } } |  |  |  |  |
So there you go. I've tested this on my own NXT and IRLink and it works. The delay between letting go and the motors switching off is not instantaneously but certainly less than 0.2s or so. - 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 Jul 22, 2010 11:04 am |
|
 |
Jampoz
Rookie
Joined: Sat Jan 09, 2010 12:25 pm Posts: 48 Location: Rome, Italy
|
 Re: Delay with HTIRL
This is going to fix my issue too!
Do you think this is something that should be included into the driver documentation in any way?
|
Thu Jul 22, 2010 12:12 pm |
|
 |
DiMastero
Expert
Joined: Wed Jun 30, 2010 7:15 am Posts: 181
|
 Re: Delay with HTIRL
Thanks a lot!! the only problem left now is that I don't know how to make the red and blue one move by themselves, and not together..
thx, DiMastero
_________________leonoverweel.com
|
Thu Jul 22, 2010 12:49 pm |
|
 |
mightor
Site Admin
Joined: Wed Mar 05, 2008 8:14 am Posts: 3654 Location: Rotterdam, The Netherlands
|
 Re: Delay with HTIRL
Sure, I'll add it to the documentation. I have plans to overhaul that driver in a major way in the near future. It was the first driver I ever wrote, so it's not as "clean" as the ones that followed.
- 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 Jul 22, 2010 1:41 pm |
|
 |
DiMastero
Expert
Joined: Wed Jun 30, 2010 7:15 am Posts: 181
|
 Re: Delay with HTIRL
Great! could you send me an e-mail, or post it on the forums when you have it?
thx, DiMastero
_________________leonoverweel.com
|
Thu Jul 22, 2010 4:15 pm |
|
 |
mightor
Site Admin
Joined: Wed Mar 05, 2008 8:14 am Posts: 3654 Location: Rotterdam, The Netherlands
|
 Re: Delay with HTIRL
When a new release of the drivers is out, it will be posted about on these forums and on my blog. See my signature for the URL.
- 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 Jul 22, 2010 4:17 pm |
|
|
|
Page 1 of 1
|
[ 12 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
|
|