Asked
— Edited
I'm going to make my rc car robot autonomous.
theres just one problem... It's an rc car! it has custom turn and drive scripts!
does anyone have an idea or example on how to make a script for radar? one that I can modify to accomidate my custom movements?
Radar should work with the custom movement panel.
Otherwise, check the EZ-Cloud, I've added a few files with ping object avoidance scripts.
I don't have a custom movement panel. I used the Movement Panel to set up the sabertooth. Now I have scripts and key control. I need a basic radar script that checks left, Checks right, and reverses and goes the open way.
SendSerial will probably work then, which means you could set up a custom Movement Panel rather than the sabertooth movement panel. You would need to find the serial commands for the sabertooth though, then add the scripts in for the directions on the custom movement panel.
Custom radar style script can be found here which is discussed here. I'm currently working on a more advanced avoidance/detection for this script which checks for being boxed in, increased number of positions and basing movements on the sensor readings, speed control based on surroundings and a bunch of other stuff. It does and will continue to use the Movement Panel Forward, Left, Right, Reverse and Stop though so a custom Movement Panel will be required.
Or the Introduction To Scripting covers some Ping/IR sensor reactions.
heres my setup. RcSabertoothcarcontrols.EZB
experiment using the "Radar (custom)" script.
we both can try to create a radar script that could work with this setup.
the key controls are: w forward s reverse a left forward d right forward z left reverse x right reverse
how would you say "if the ping sensor value=(3 quarters of the full value), move servo full left. if value is below (3 quarters of the full value), start "left" script for 1500 milliseconds if value is above (3 quarters of full value) move servo full right. if value is below (3 quarters of full value), start "right" script for 1500 milliseconds if value is still above(3 quarters of full value), start "reverse" script for 1500 milliseconds then check again. turn towards lower value then start over
If it needs to be greater than or equal to then change the = for >=
You cannot ControlCommand to run a script for a time period, that would need to be part of the script itself.
Use a label (i.e. :loop) and a goto to loop around. Add in a Sleep to avoid saturating the communications and bogging down ARC. Sleep(50) or Sleep(100) is usually all that's needed.
To turn towards the lower value you would need to use an if...
is there a command to stop scripts?
oh and I was playing with your ping avoidance script and changed a couple things. i'll post the code so you can proof read.