Middle School Tech Teacher here. tired sigh, is it Christmas Break yet?
When we put the set velocity drive train block under the autonomous section it seems to change the robot speed, but when we put the set velocity drive train block under the “When Drive Train” section, the robot will not move anywhere but forward?
If we convert this program to text, is there a place we can put the line:
drivetrain.set_drive_velocity(100, PERCENT)
that will change the way the motors are running during driver controll? Or will we be traveling only forward again?
Thanks for any help you can offer.
I assume you mean “When Driver Control”
How is the drivetrain being controlled when driver control is active ? If you have simply assigned the drivetrain to a joystick under graphical configuration then you have no flexibility, joystick values are being sent directly to the drivetrain from the auto generated code, set_drive_velocity has no meaning in this context. If you have blocks that read the controller joystick/buttons and send those to the drivetrain motors, then perhaps post the code so we can see what you are doing.
A bit more detail is needed to understand what this means, perhaps just post the whole v5blocks project.
2 Likes
Is your drivetrain bound to the controller in the Devices section?
1 Like
We have “assigned the drivetrain to a joystick under graphical configuration” so what I’m trying to do is not possible in block coding. Therefore, I will tell them to research the problem on how to do this with text. Thank you.
The velocity is being set by the joystick under the devices tab. 100% in either direction on the stick will set the speed of the motors accordingly. You can remove that link and use the Driver Control or Main events to create your own code to for speed control.
Example using a Drivetrain object:

Directly controlling the motors:
This allows you to incorporate variables, functions, and different attenuation formulas to make full use of the available code.
Custom function example:
There is a way of derating the signal the joysticks send via a little math in VexCode Blocks.