Timing in Command and Control

We are relatively new with the Command and Control set up and we have seen that there is a 50 ms wait time in the default drive vi. Our previous code ran faster with 10 ms time loops. We were running 10 ms loops for more responsive closed loop control on our robot.

Do any teams out there have experience (good or bad) with reducing the default 50 ms wait time?

Are you talking about auto or teleop driving?

I think you are misunderstanding the 50ms. This is a 50ms wait before it commands the motors to stop. Ideally that 50ms timer never expires and you get a new DS packet which then will probably correspond with a new Drive immediate (for teleop) command.

When you say you were running 10ms loops previously what code were you running at 10ms? Were you polling sensors or something in periodic tasks that fast?

We use that 10 ms loop to get our Gyro and Accelerometer data throughout the code with global variables.

This may help understanding of how the case structure in the command/control vi works.

First any time an new command is received, the current command is aborted and the new command runs immediately… so if the joystick is updating about every 20 ms from the driver’s station, the command vi while loop runs at that rate with the new value from the joystick.

The 100 ms time constant created by default works in this way. If another command from teleop (e.g. a new joystick value) is not received in 100 ms, the same command as the previous one is sent and the vi waits another 100 ms before sending the same command again. So if your joystick initially sends a value of 0.5 and the command vi does not receive another one in 100 ms, it executes the loop again with the immediate command (or last ran) and uses 0.5 again as the setpoint.

At the bottom right you’ll normally see a boolean just above the 100 ms constant.

If the boolean is False, it has no effect on the way the controller vi runs.
If the boolean is True, the default command is ran (you’ll find the default command in a constant all the way to the left on the vi, outside the loop. It is initialized there… and normally Reserve).

The 50 ms timer you refer to sets the boolean if another command is not received from Teleop (the joystick) in 50 ms. This causes the default command to run.

This is all somewhat confusing and I have to open the control VI’s every year and refresh my memory as to how this works.