Page 43
Sample Program for Controlling an iRobot Create with the KIPR Link
This sample program is a demo to make the iRobot Create drive in a circle with a radius of 0.25 meters
at a speed of 200 mm/sec for 10 seconds, then displaying the distance traveled and the angle covered.
Set Up
Fully charge your KIPR Link and iRobot Create. Connect the KIPR Link to the iRobot Create with the KIPR
Link Communication cable. Place the KIPR Link into the cargo bay of the iRobot Create. Set the iRobot
Create on the floor with an adequate area cleared in front of the iRobot Create. Note that if the iRobot
Create detects a ledge with the cliff or wheel drop sensors (like being picked up), the program will stop
and the iRobot Create will play a sad tone.
Code
/* This is a program to make the iRobot Create drive in a circle
with a radius of 0.25 meters at a speed of 200 mm/sec for 10 seconds,
the displaying the distance traveled around the circle and the angle
that the turn covered*/
int
main()
{
printf(
"connecting to Create\n"
);
create_connect();
set_create_distance(
0
);
set_create_total_angle(
0
);
create_drive(
200
,
250
);
msleep(
10000
);
create_stop();
printf(
"\nResults:\n"
);
printf(
" distance = %d mm\n"
, get_create_distance());
printf(
" angle = %d degrees\n"
, get_create_total_angle());
printf(
"\ndisconnecting from Create\n"
);
create_disconnect();
}
Содержание KIPR Link
Страница 1: ...KIPR Link Manual Version BB2014 1 1...