EasyC for FRC: Drive and Auto Track Camera Code

Autonomous - Robot rotates to the center of the green
target.

Operator Control - Drives in arcade mode as normal
and when the trigger is pulled on the drive joystick
the robot will disable arcade drive and rotate to
center itself.

This program has victor scaling in the drive function.
This makes the victors act in a more linear fashon.

Camera_Default_Code.zip (4.43 KB)


Camera_Default_Code.zip (4.43 KB)

Adam

When using EasyC for FRC, can one issue a Track_Color() command to the camera to change the tracking values without restarting the camera?

Jon

The best way to change colors is to send:

StopCamera();
InitCamera(2);
StartCamera();

Where “2” would be the second table you define in the Camera Setup.

So this will be about a 2-second delay to switch colors?

Roughly…Yes

But, the robot should keep driving during the switch.

Actually, this is close but not quite correct.

What happens is that the code waits for the robot to be on for 2 seconds before it will send any initialization data to the camera. This is to ensure that the camera has powered itself up. Your program can do other things during that 2 seconds, but the InitCamera function will wait (inside the function) until the camera is properly powered up.

Once that happens, the actual initialization takes about 50ms. So you can stop the camera, send it new initialization data, and restart in under 100ms for everything.

The 2 second delay only applies to the first time.

Brad

Brad

Thanks for the clarification

Have a great New Year!

Jon

I will be combining this code and the 2007 kickoff code shortly.