Autonomous Programming


My students wanted to put two motors on one arm shaft so they were not overworking one motor for the high hang (we already compounded the gears). We programmed it for “driver” control and it was fairly simple. However, when we tried to write our “Autonomous” program, we could not get the two motors to work together at the same time. Can anyone help us with Autonomous programming for lifting an arm with two motors?


What programming language are you using?


We are using RobotC Graphical.


@begrigsby You can just use the setMotorTarget command for that. So, say your arm is in the down position and to move it up ready to hang you need to rotate the motor through 720 degrees at 50% power, you could use:

setMotorTarget(motorA, 720,50);
setMotorTarget(motorB, 720,50);

then move forward or whatever you need to do, then to move the arm back down at 100% power:

setMotorTarget(motorA, -720,50);
setMotorTarget(motorB, -720,50);

The program won’t wait for the first move to finish before starting the second, so they will appear to happen at exactly the same time.

See attached graphical example. Oh, you need to be in at least Expert mode to see this command - Window --> Menu Level --> Expert.



Thank you for the info, we are going to try it tonight.


We are using RobotC and have very-very basic knowledge of how to program. We also need to program the robot to run 2 motors simultaneously in order to high hang while in Driver mode.
Where can I get more information on what commands I need to program?


You could use the commands I posted above inside an if statement. Post your existing code and we’ll add to it.


Thanks again for the info. We tweaked a few things but we got it to work. We set multi-motors and then did a timer. We did not use the repeat forever.