Dear botballers..
I am new here and i will be happy if you heled me in this issue:
i have to use a vision camera fixed on my icreate robot i tried to use the demo bot robot the following program worked perfectly.
/* Move the robot towards the largest object on channel 0.
Robots stops if no object is detected*/
int main()
{
int ch = 0, leftmtr = 0, rghtmtr = 3; // identify channel and motors
int high = 100, low = -10; // set wheel powers for arc radius
camera_open();
printf("Move towards object on channel 0\n");
printf("Press B button when ready\n\nPress side button to stop\n");
while(b_button() == 0) { // wait for button press
msleep(5000);
}
while(side_button() == 0) { // stop if button is pressed
camera_update();
if(get_object_count(ch) > 0) { // if object is seen...
if(get_object_center_column(ch,0) < 65) { // if object is on left...
motor(leftmtr,low); motor(rghtmtr,high); // arc left
}
else {
if(get_object_center_column(ch,0) > 95) {// if object is on right...
motor(rghtmtr,low); motor(leftmtr,high); // arc right
}
else {
motor(rghtmtr,high); motor(leftmtr,high); //go straight
}
}
}
else {
ao();
}
}
ao(); // stop because button pressed
printf("done\n"); return 0;
}
but when i used the programe on my icreate robot .. it doesn't work..
i changed motor(#port,speed) to work on create program using create_drive_direct( # , # )
can anyone help me or give me a programe that can let my icreate robot track an object
regards
Try this code
It is basically the same as yours just slightly polished(and it'll keep moving if it loses the object). I'm not sure how your motor commands are working though could you explain what you mean by "i changed motor(#port,speed) to work on create program using create_drive_direct( # , # )" preferably with code as well as explaining what it is/does.
Try running this code and tell us what the output is so we can better address whatever problem is coming up.
thank you for your reply ... i mean that how i can use this program to work on my icreate robot .. not the demo bot robot
regards
Aly
everywhere you see motor(lmotor,#a);motor(rmotor,#b); change that into create_drive_direct(#a,#b); and change ao(); to create_stop(); I'm not sure on that last one I don't remember the create functions that well.
if(get_object_center_column(ch,0) > 95) {// if object is on right...
motor(rghtmtr,low); motor(leftmtr,high); // arc right
192.168.1.1
192.168.1.1
192.168.1.1
192.168.1.1