
Xuven

Looking for some help / sample of a script combining the 2 for navigation. This is on a omnibot 5402. I have the IR sensor mounted above his speaker. The ultra sonic is on a sweeping servo right above the IR sensor. I tried playing with Richs ping roam script and he just spins in circles. I would be grateful for any help with this.
Upgrade to ARC Pro
Get access to the latest features and updates with ARC Early Access edition. You'll have everything that's needed to unleash your robot's potential!
To get the IR data from the sensor, assuming it's connected to ADC0, you would use a GetACD() command i.e.
Code:
To get the ping you use
Code:
Then use those within an if
i.e.
Code:
Code:
where the comment about adding in extra sensor code is.
The editing the "Detection" script (as indicated in bold);
Code:
It would require a new variable for $maxirdistance to be added to the "Start" script so it knows what the maximum/minimum distance for the IR should be for the above IF nest.
More work would be required for the turning as the latest PingRoam had smart turning which basically let the ping sensor determine when it was OK to stop turning. Using both ping and ir you would need to alter this from using a PingWait() command, most likely by using a new script which checks both the ping and the adc and when one or the other says it is OK to move then stop turning.
It would be quite a big edit to the script but it shouldn't be too difficult. It is something I have been trying to get on to for a while since Melvin also uses both ping and IR sensors but I haven't had time to touch it yet.