Manual

www.nexusrobot.com Robot Kits manual
85
void Omni3WD::demoActions(unsigned int speedMMPS,unsigned int duration,unsigned int uptime,bool
debug) {
unsigned int (Omni3WD::*carAction[])(unsigned int speedMMPS)={
&Omni3WD::setCarAdvance, //set car moves forward
&Omni3WD::setCarBackoff, //set car moves Reverse
&Omni3WD::setCarLeft, //set car turn left
&Omni3WD::setCarRight, //set car turn right
&Omni3WD::setCarRotateLeft,//set car rotate left
&Omni3WD::setCarRotateRight //set car rotate right
};
for(int i=0;i<6;++i) { //there are six base actions
(this->*carAction[i])(0); //choose one of the six actions
setCarSpeedMMPS(speedMMPS,uptime); // set the speed for the car in this action
delayMS(duration,debug); // The time used for the car moves at this
speed in this action
setCarSlow2Stop(uptime); //set the car stop slowly in uptime
}
setCarStop(); //set car stop
delayMS(duration,debug); //delay(duration) every 10 milliseconds
call the PIDRegulate once time
switchMotorsLeft(); //rotate left to change the wheel to work
}