Asked — Edited

Variable Speed With Joystick And Continuous Rotation Servos

Hello everyone! first post here...

I was a bit bummed when I found the joystick control with "Use variable movement speed" checked, did not change the speed of continuously rotating servos. Does this only work with H-bridge style movement controllers?

To solve this I created a custom movement script so [Speed Left] and [Speed Right] could be translated to servoSpeed. Here is an example of the Forward script:


# Forward with steering
SetSpeedLeft(20)
SetSpeedRight(20)
$speedLeft=50
$speedRight=50
$mvtick=0
repeatwhile($Direction="Forward")
servo($LeftMotor,CInt($speedLeft))
servo($RightMotor,CInt($speedRight))
$speedLeft=(((GetSpeedRight()/255)*50)-50)*-1
$speedRight=((GetSpeedLeft()/255)*50)+50
sleep(50)
$mvtick++
endrepeatwhile
if ($Direction="Stop")
release($LeftMotor)
release($RightMotor)
endif

The Stop script is just release for both servos but that doesn't work by itself. I had to put the if statement in for each direction to actually trigger the release when the joystick was centered. Does anyone know any specifics about how some of the global variables are prioritized? I feel this could be more elegant but my programming skills are rudimentary at best lol.

I'm using an EZ-B v3.

No matter what, I love the EZ robot platform! Big ups to DJ and the crew for such a cool platform! :D


ARC Pro

Upgrade to ARC Pro

Stay at the forefront of robot programming innovation with ARC Pro, ensuring your robot is always equipped with the latest advancements.