Hallo
Die Drehrichtungen der Antriebe kann man mit setMotorDir() aus der Library RP6RobotBaseLib.c festlegen:
Wie beschrieben sollten die Drehrichtungen nicht bei Vollgas umgeschaltet werden!Code:/** * Sets the rotation direction of both motors. * * DO NOT CHANGE THE DIRECTION OF THE MOTORS WHILE THEY * ARE RUNNING AT HIGH SPEEDS!!! * It will not instantly damage the motors/gears, but they will * wear out much faster if you do it at high speeds - better wait * until speed has slowed down - and change direction AFTER this. * * ------------------------------------------------------------- * IT IS A BETTER IDEA NOT TO USE THIS FUNCTION AT ALL! * Use moveAtSpeed together with task_motionControl instead. * YOU CAN NOT USE setMotorPower AND setMotorDir WHEN YOU USE * task_motionControl! This will not work! * ------------------------------------------------------------- * * task_motionControl also ensures that the direction is changed * slowly and only after the motors have stopped! * * Example: * // DO NOT perform these commands directly after each * // other in your programs - this is just a LIST of possible * // combinations: * setMotorDir(FWD,FWD); // Move forwards * setMotorDir(BWD,FWD); // Rotate right * setMotorDir(FWD,BWD); // Rotate left * setMotorDir(BWD,BWD); // Move backwards * */ void setMotorDir(uint8_t left_dir, uint8_t right_dir) { mleft_dir = left_dir; mright_dir = right_dir; mleft_des_dir = left_dir; mright_des_dir = right_dir; if(left_dir) PORTC |= DIR_L; else PORTC &= ~DIR_L; if(right_dir) PORTC |= DIR_R; else PORTC &= ~DIR_R; }
Gruß
mic







Zitieren

Lesezeichen