Setting duration/speed of Motors using minidriver
Posted: Thu Sep 11, 2014 7:40 pm
Alan
I have got my opencv python script working with the Dawn Robot camera module and can control pan/tilt to follow a face. I am trying to program a wheel to turn slightly if the pan goes past a specific point. This would allow the robot to turn and center the pan. Eg someone moving left or right past the normal pan so the robot would rotate using one wheel to keep person in view.
I would like to control the duration of the motor to make it proportional to the cumulative pan of the camera in a particular direction. Eg If the camera pans past a certain amount one wheel should move slightly to turn the robot so the camera can keep the face in the camera frame. Not sure if my programming is correct. used minidirver command to turn one wheel forward or backward depending on the pan. Waited 1.0 then send wheel a minidirver wheel stop value 0. This does not seem to work. The wheel turns for about 3 seconds and I can't figure out why. I would like to be able to send it a short duration pulse to turn the robot maybe 30-60 degrees or so at a time.
Here is a code snippet. direction variable is -1 or +1 depending on wheel direction to turn. The wheel turns in correct direction OK but runs far too long. Looked at minidriver python code but still can't figure out how to control duration. I know web interface can move robot a little bit at a time if the joystick is move a little bit. Can you help me out?
Thanks Claude ...
Here is a code snippet that I am using. right_wheel_min is set to 130.
if ( abs(Nav_LR)>3 or abs(Nav_UD)>3 ):
if Nav_LR < 0:
direction = 1
elif Nav_LR > 0:
direction = -1
miniDriver.setOutputs( left_wheel_stop, (right_wheel_min + (abs(Nav_LR))) * direction, current_pan_pos, current_tilt_pos )
time.sleep( 1.0 )
miniDriver.setOutputs( left_wheel_stop, right_wheel_stop , current_pan_pos, current_tilt_pos )
I have got my opencv python script working with the Dawn Robot camera module and can control pan/tilt to follow a face. I am trying to program a wheel to turn slightly if the pan goes past a specific point. This would allow the robot to turn and center the pan. Eg someone moving left or right past the normal pan so the robot would rotate using one wheel to keep person in view.
I would like to control the duration of the motor to make it proportional to the cumulative pan of the camera in a particular direction. Eg If the camera pans past a certain amount one wheel should move slightly to turn the robot so the camera can keep the face in the camera frame. Not sure if my programming is correct. used minidirver command to turn one wheel forward or backward depending on the pan. Waited 1.0 then send wheel a minidirver wheel stop value 0. This does not seem to work. The wheel turns for about 3 seconds and I can't figure out why. I would like to be able to send it a short duration pulse to turn the robot maybe 30-60 degrees or so at a time.
Here is a code snippet. direction variable is -1 or +1 depending on wheel direction to turn. The wheel turns in correct direction OK but runs far too long. Looked at minidriver python code but still can't figure out how to control duration. I know web interface can move robot a little bit at a time if the joystick is move a little bit. Can you help me out?
Thanks Claude ...
Here is a code snippet that I am using. right_wheel_min is set to 130.
if ( abs(Nav_LR)>3 or abs(Nav_UD)>3 ):
if Nav_LR < 0:
direction = 1
elif Nav_LR > 0:
direction = -1
miniDriver.setOutputs( left_wheel_stop, (right_wheel_min + (abs(Nav_LR))) * direction, current_pan_pos, current_tilt_pos )
time.sleep( 1.0 )
miniDriver.setOutputs( left_wheel_stop, right_wheel_stop , current_pan_pos, current_tilt_pos )