kmot_ResetError( mot1 );
kmot_SetBlockedTime( mot1 , 10);
kmot_ConfigurePID( mot1 , kMotRegSpeed , 400 , 0 , 10 );
kmot_ConfigurePID( mot1 ,kMotRegPos,620,3,10);
kmot_SetSpeedProfile(mot1 ,30,3);
/* initialize the motor controler 2 */
kmot_SetMode( mot2 , kMotModeIdle );
kmot_SetSampleTime( mot2 , 1550 );
kmot_SetMargin( mot2 , 6 );
kmot_SetOptions( mot2 , 0x0 , kMotSWOptWindup | kMotSWOptStopMotorBlk );
kmot_ResetError( mot2 );
kmot_SetBlockedTime( mot2 , 10);
kmot_ConfigurePID( mot2 , kMotRegSpeed , 400 , 0 , 10 );
kmot_ConfigurePID( mot2 ,kMotRegPos,620,3,10);
kmot_SetSpeedProfile(mot2 ,30,3);
/* For ever loop */
while(1)
{
/* Wait 5 seconds */
sleep(5);
/* Tell to the motor controller to move the Khepera III forward */
kmot_SetPoint( mot1 , kMotRegSpeed , -motspeed );
kmot_SetPoint( mot2 , kMotRegSpeed , motspeed );
/* Wait 5 seconds */
sleep(5);
/* Tell to the motor controller to stop the Khepera III
*/
kmot_SetPoint( mot1 , kMotRegSpeed , 0 );
kmot_SetPoint( mot2 , kMotRegSpeed , 0 );
}
}
This source code can be cross-compiled using
arm-linux-gcc
which sup-
ports most standard
gcc
options:
arm-linux-gcc kh3test.c -o k3test
An kh3test executable file should be created, that can be executed on
the KoreBotLE, or eventually another arm-linux machine.
Khepera III manual ver 2.2
31