MotorPtr Motor::clone() const { //TRACER_VERBOSE_ENTER_SCOPE("Motor[%s]@%p::clone()",id_.str(),this); MotorPtr newMotor(new Motor(*this)); TRACER_VERBOSE_PRINT("Motor clone is %p",newMotor.get()); return newMotor; }
/* * Call this from the default Initialize function. * After, be sure to reinitialize each motor you will be using on your robot. */ void riceBotInitialize() { Motor *MOTDTFrontRight = newMotor(); Motor *MOTDTFrontMidRight = newMotor(); Motor *MOTDTMidRight = newMotor(); Motor *MOTDTBackRight = newMotor(); Motor *MOTDTFrontLeft = newMotor(); Motor *MOTDTFrontMidLeft = newMotor(); Motor *MOTDTMidLeft = newMotor(); Motor *MOTDTBackLeft = newMotor(); Motor *MOTARMFront = newMotor(); Motor *MOTARMRight = newMotor(); Motor *MOTARMLeft = newMotor(); Motor *MOTARMTopRight = newMotor(); Motor *MOTARMBottomRight = newMotor(); Motor *MOTARMTopLeft = newMotor(); Motor *MOTARMBottomLeft = newMotor(); Motor *MOTCOL = newMotor(); printf("%d\n\r", imeInitializeAll()); imeReset(IMEARMLEFT); imeReset(IMEARMRIGHT); encDTLeft = encoderInit(0, 0, false); encDTRight = encoderInit(0, 0, false); encARMLeft = encoderInit(0, 0, false); encARMRight = encoderInit(0, 0, false); Ricencoder *ENCDT = newEncoder(); Ricencoder *ENCARM = newEncoder(); // gyro = gyroInit(0, 196); // gyroVal = gyroGet(gyro); analogCalibrate(POTARMLeft); analogCalibrate(POTARMRight); analogCalibrate(POTARMFront); Pid *PidARMLeft = newPid(); Pid *PidARMRight = newPid(); Pid *PidARMFront = newPid(); }
void initialize(motor393 *_motor, short *fronts, short *ports){ //le doy los valores a los motores for(short i=0; i<10; i++) newMotor(&_motor[i], fronts[i], ports[i]); //crea un motor }