Write the various controls for the different end effector parts. The Button Box is represented in code as two joystick objects (which will need to be created). Communicate with the OI subgroup to figure out which buttons will be on which of the two joysticks, and how exactly each function will be controlled.
Remember the GetRawButton(port#) function.
The basic logic is if(button is pressed) { do function }
You will have to create an instance of each subsystem you are calling functions from. In my example above, gear is an instance of the Gear class. It was created by defining it in the OI header Gear* gear; and initializing it in the OI constructor in the cpp gear = Gear::getInstance();. You will also have to #include the header for each class you use. Again for my example above, you would need to add #include "Gear.h" to the top of the OI.h. An instance of Mobility has already been created in the OI class, use that as an example.
Finally, make sure to keep your code neat and well documented (add comments explaining things, group similar controls together). This is code we will have to tweak a lot according to driver preference, so it needs to be easy to look through.
Write the various controls for the different end effector parts. The Button Box is represented in code as two joystick objects (which will need to be created). Communicate with the OI subgroup to figure out which buttons will be on which of the two joysticks, and how exactly each function will be controlled.
Remember the GetRawButton(port#) function.
The basic logic is if(button is pressed) { do function }
Example:
if(button_box_1->GetRawButton(OIPorts::GEAR_OPEN_BUTTON)) {
gear->open();
}
You will have to create an instance of each subsystem you are calling functions from. In my example above, gear is an instance of the Gear class. It was created by defining it in the OI header
Gear* gear;
and initializing it in the OI constructor in the cppgear = Gear::getInstance();
. You will also have to #include the header for each class you use. Again for my example above, you would need to add#include "Gear.h"
to the top of the OI.h. An instance of Mobility has already been created in the OI class, use that as an example.Finally, make sure to keep your code neat and well documented (add comments explaining things, group similar controls together). This is code we will have to tweak a lot according to driver preference, so it needs to be easy to look through.