Unzip WPILib into C:\WPILib for all the examples to work. When creating projects it is best to refer to the linker, include, and library files from the C:\WPILib directory - that way updating WPILib will update all programs linked with it.
Exposes a few camera functions that will allow users to send their own commands to the camera. Commands are sent to the camera in ASCII mode and T-Packets are received in binary. This is for debugging and allows you to see the robot to camera exchanges by calling SetCameraDebugMode(1). Doing this will make all the CmdToCamera commands echo along with the camera responses. These should work OK, since the functions have been used internally and have just been changed from static to global. So let me know if you have any problems.
The functions are:
unsigned
char ResetCameraState(void);These functions are part of BuiltIns.h so it doesn't conflict with any existing easyC code.
An example of using the CmdToCamera function is here (taken from WPILib camera module):
static
unsigned char SetColor( unsigned char redMin,The arguments are inserted into the commands as integer strings and sent to the camera. The function returns 1 for success (ACK received from camera) and 0 for failure (timeout or other error). You should reset the camera first, then send whatever commands that are needed, then call StartCamera to get it back in tracking mode.
Problems with the automatic build and the file "BuiltIns.h" was missing from previous versions. It's there now.
This version adds Vex support, functions to control the camera debug modes, built-in support for the 80, 150, and 300 degree/sec Analog Devices gyros with dead band setting functions, graphical display functions when used with the easyC Pro terminal window, and a number of other enhancements. This is the version that is used with easyC Pro.
This version adds a Vex directory (beta) to the download.
Please let me know what problems you find. It has been tested with a bunch of the VEX
This version adds the following features to the CMUCam handling:
unsigned char GetCameraStatus(void)
that returns a zero if any of the camera initialization fails. This function can be called after any of the camera initialization functions. If you are using EasyC, the function definition is included in BuiltIns.h and you should be sure to include that file.
If you decide to try this version, please post something on ChiefDelphi indicating whether or not it worked for you. In my testing it seems to handle the case of the camera disconnected from the serial adapter or the serial adapter removed from the robot controller.
The only difference between this version and the previous one is the inclusion of the function:
void InitializeCamera(CameraInitializationData *c);Changed camera capture data functions to have a one second timeout. Whenever a call to capure/copy camera data is made, the code waits 1 second for valid data to arrive. This is only checked prior to the first packet being received and is designed to handle the case where the camera is initialized, started, and a packet captured before one actually arrives. In the previous version it would wait forever for valid data - but if the camera is somehow broken or disabled, then the robot might hang waiting for valid data. If the timeout occurs, zeros will be returned for all camera data - including the packet number.
There was a problem with setting camera servo values where if the middle digit of a 3 digit value was zero, it would not be sent to the camera. This has been fixed.
There are two new functions to read the main and backup battery in 1/100ths of volt. The functions are:
unsigned GetBackupBattery(void) and
unsigned GetMainBattery(void)
The serial port function names were inadvertently changed in the rush to get the code out. They are now names as published in the documentation. If you are using the camera and no explicit serial port code this should not effect anything you are doing.
And as always, please let me know if you find something wrong.
Modified Motor function to be aware of the deadband in the Victor 884 speed controllers. The Victor 884 has a built-in deadband that runs from 117-137 of PWM values sent to it. The Motor function will now take values from 0-127 and 0-(-127) and scale them to fit into the actual working range of the Victor which is 23-116 and 138-232. This means that values sent to the motors will tend to be more continuous without the discontinuity in the range. The Motor function is used by Drive and Motors so if you use these functions, the change will be seen in those functions as well.
There is another function added, unsignd char GetPacketNumber(void) that returns the OI packet number. Each time a new packet is received from the master processor this number is incremented. It is only a 8 bit value so it wraps around every 256 packets, but it provides an indication of when there is new data received.
Added the compressor support with background checking of the pressure switch. Call:
InitPressureSwitch(unsigned char pressureSwitchPort, unsigned char relayPort);
where pressureSwitchPort has the pressure switch connected and is checked every 500ms. The relayPort is turned on/forward if the pressure switch is closed indicating low pressure otherwise it is turned off. This should only be called once - usually in the Initialize function and it will operate for the rest of the program.
Orignal Version - as released initially.