Hallo

MoveAtSpeed() verwendet das Tasksystem des RP6:

Code:
/**
 * This function sets the desired speed value. 
 * The rest is done automatically. The speed is regulated to this speed value 
 * independent of Battery voltage, surface, weight of the robot and other things. 
 *
 * You need to call task_motorSpeedControl();  frequently out of the main loop!
 * otherwise this function will not work!
 * Or use task_RP6System which includes this call. 
 *
 * The function limits maximum speed to 200! This has been done because the maximum
 * possible speed gets lower over time due to battery discharging (--> voltage drop).
 * And the gears and motors will live longer if you don't stress them that much.
 *
 * Also 200 leaves a bit room to the maximum possible PWM value when you 
 * put additional load onto the Robot or drive up a ramp etc.  
 *
 */
void moveAtSpeed(uint8_t desired_speed_left, uint8_t desired_speed_right)
{
	if(desired_speed_left > 200) desired_speed_left = 200; 
	if(desired_speed_right > 200) desired_speed_right = 200;
	mleft_des_speed = desired_speed_left;
	mright_des_speed = desired_speed_right;
}
(Aus RP6RobotBaseLib.c)

Das bedeutet, man muss das Tasksystem regelmässig aufrufen:

Code:
#include "RP6RobotBaseLib.h"

int main (void){
   initRobotBase();
   powerON();
   changeDirection(FWD);
   moveAtSpeed(160,160);
   startStopwatch1();
   setStopwatch1(0);
	while(getStopwatch1() < 5000) // 5 Sekunden vorwärts
	{
      task_motionControl(); // sollte das nicht task_motorSpeedControl() sein???
		// task_RP6System(); // alternativ könnte man auch alle Tasks abarbeiten
		sleep(100); // schneller bringt nichts
	}
	stop(); // Anhalten
   while(1);
   return 0;
}
(ungetestet)

mSleep() ist eine Sackgasse, weil der RP5 in der Zeit nichts anderes machen kann. Deshalb besitzt der RP6 ein Tasksystem und hebt sich damit mit seiner Library deutlich von den Mitbewerbern ab ;)

Gruß

mic