das mit setMotorDir ist genau das was ich gesucht hab, aber:
undefined reference to `setMotorDir'
das mit setMotorDir ist genau das was ich gesucht hab, aber:
undefined reference to `setMotorDir'
Möglicherweise wurde die Funktion rausgeschmissen:
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; }
Bild hier
Atmel’s products are not intended, authorized, or warranted for use
as components in applications intended to support or sustain life!
Der Compiler meckert:
PC.c:24: error: 'DIR_R' undeclared (first use in this function)
PC.c:20: error: 'DIR_L' undeclared (first use in this function)
PC.c:18: error: 'mright_des_dir' undeclared (first use in this function)
PC.c:17: error: 'mleft_des_dir' undeclared (first use in this function)
PC.c:16: error: 'mright_dir' undeclared (first use in this function)
PC.c:15: error: 'mleft_dir' undeclared (first use in this function)
ich benutze die M32.
Geändert von AsuroPhilip (16.10.2011 um 10:55 Uhr)
Irgendwie klemmt's heute extrem. Bindest du die Library ein?
#include "RP6RobotBaseLib.h"
In task_motionControl() wird bei Stillstand die Richtung ausgewählt:
Code:if(!TCCR1A) // Is the PWM module turned off? { // Yes, change direction and restore old speed: setMotorDir(mleft_des_dir,mright_des_dir); mleft_des_speed = mleft_des_speed_tmp; mright_des_speed = mright_des_speed_tmp; left_i = 0; right_i = 0; }
Bild hier
Atmel’s products are not intended, authorized, or warranted for use
as components in applications intended to support or sustain life!
"ich benutze die M32." Aua
Bild hier
Atmel’s products are not intended, authorized, or warranted for use
as components in applications intended to support or sustain life!
Ne, das klappt nicht. Ich hab's mal eingebaut, allerdings ungetestet und deshalb ohne Gewähr:
Dazu muss man allerdings einen neuen Befehl einbauen in RP6Base_I2CSlave.c, RP6Control_I2CMasterLib.c und RP6Control_I2CMasterLib.h und eine neue Hex-Datei für den RP6 erzeugen.Code:#include "RP6ControlLib.h" //#include "RP6ControlServoLib.h" #include "RP6uart.h" #include "RP6I2CmasterTWI.h" #include "RP6Control_I2CMasterLib.h" void moveAtSpeed3(uint8_t desired_speed_left, uint8_t desired_speed_right, uint8_t dir_left, uint8_t dir_right) { moveAtSpeed(desired_speed_left, desired_speed_right); setMotorDir(dir_left, dir_right); // neue Funktion } int main(void) { initRP6Control(); moveAtSpeed3(150,150,1,0); while(1) { } return 0; }
Bild hier
Atmel’s products are not intended, authorized, or warranted for use
as components in applications intended to support or sustain life!
Lesezeichen