Asked — Edited
Resolved Resolved by Rich!

Movement Scripting Help Please?≫

Can anyone help with scripting? I need to be able to have the speed of the G-Bot be ramped up and down rather than full on/off or there is a serious risk it will topple. Right now I have the sabertooth control set up as in the attached photo. I have joystick 1 of the joystick control controlling it but I only get full on or off or full clockwise or counterclockwise rotation. Also, the joystick is 90 degrees off what I'd like( '3 o'clock' = forward, '9 o'clock' = reverse, '12 o'clock' = clockwise in place, '6 o'clock' = counterclockwise in place - but I can live with that for now if I have too).
I've been reading and watching tutorials and it seems like the movement scripting control is designed to do this but the input lines are different between the movement script control and the sabertooth control(stop, forward, reverse, left right versus 'left forward', 'right forward', 'left turn left', 'right turn left', 'left turn right', 'right turn right', 'left reverse', 'right reverse') and I have no idea how to write a script command to appropriately include a variable to do what I'm trying to do (OMG, that high school curse had come true! It comes down to algebra! doesn't it? Oh noooo!) Can anyone take mercy on us and our Halloween plans and suggest some script to try and tell me which lines should go where?

PLEASE, PLEASE, PLEASE?

Thank you, Gwen

User-inserted image


ARC Pro

Upgrade to ARC Pro

ARC Pro is your gateway to a community of like-minded robot enthusiasts and professionals, all united by a passion for advanced robot programming.

United Kingdom
#25  

Or download this zip file SabertoothRamping3.zip

Extract it to My Documents/ARC/My Projects You should then find a project in your projects called Sabertooth Ramping 3.ezb

#26  

OMG, I just figured out how to find your examples from the public area in the EZ Cloud! This is too awesome!

There may yet be hope...:P

#27  

is that the same as if I open your most recent from the cloud?

United Kingdom
#28  

Yes

#29  

@Rich... dude, you should get 2 credits for this one....:)

#30  

OMG! Happy Dance! It works!

You are the UNDISPUTED MASTER OF THE SCRIPT! WWWWOOOOOOO HOOOOOOO!

The movements are great!

You are right about the ramping up and down not stopping quickly. There is a little lag when starting, stopping and changing direction but WAY F'ING COOLLLLL!

Would it be too difficult to make the following changes:

Change the direction of the joystick control for forward and backward? Right now, forward deflection (12 o'clock) of the joystick makes the robot go in reverse and rear deflection (6'oclock) makes it go forward. BUT THE TURN DIRECTIONS ARE SPOT ON.

Change the max speed of turns down a bit to maybe 80%?

OMG....... I am sooo exicted! Up until now I've been afraid to take him out of the garage. There is a small bump leaving from the concrete pad to the asphalt and I was worried he'd go over if I tried to have him go over it fully assembled and at full speed.

OMG, Ill do some testing with him outside tomorrow! (getting dark now and I really have to be somewhere soon.)

Woooooooooooooo Hoooooooooooo! @Rich is THE MASTER!:D

:D:D:D:D:D:D:):):):):):):):):)

#31  

OMG, MORE THAN TWO CREDITS FOR SURE!

HAPPY, HAPPY JOY, JOY!

United Kingdom
#32  

Changes are easy... change the values in each of the scripts for the Movement Panel (it's why I use variables, it makes minor changes so simple).

Click on the gear icon on the custom movement panel Click on the small pencil to the right of the box that says Multiline Script for whichever direction you want to change You will see lines 1 and 2 are something like this

$motor1speed_end = 1
$motor2speed_end = 255

Adjust the numbers to suit.

So for forwards change them to 127 and 129 For reverse change to 1 and 255 For turning just tweak the numbers down a bit (you may need to play around with them).

I think these are right (Richard R will correct them if wrong, I'm sure he knows them) Motor 1 full forwards the value is 1 Motor 1 stop the value is 64 Motor 1 full reverse the value is 127 Motor 2 full forwards the value is 255 Motor 2 stop the value is 192 Motor 2 full reverse the value is 129

If you need to make it ramp slower you need to edit the Ramp Speed script, just adjust the variable $rampdelay on line 9. Increase it for a slower speed ramping, decrease it for a quicker speed ramping. The shorter the delay the faster the speed will increase, the longer the delay the slower it will increase.

If you have slower turning speeds than forward and reverse speeds the script will automatically ramp down to the slower speed too.