RVR differential driving


I need to build a program that needs to detect an april tag and then drive to it, but now i feel that I am stuck. For this I am using the function rvr.drive_rc_normalized() that takes yaw_angular_velocity and linear_velocity as parameters. Getting the distance works fine with the camera detection of the object provided by the library pupil_apriltags + opencv. How can I drive to the point if i know the pose_t and pose_R of the tag ? Thanks in advance!

Have you looked at the drive_to_position_normalized or drive_to_position_si routines? They may be better suited with the location of the object known. Those routines handle the timing of the travel and the final yaw.

With the drive_rc routine you’ll need to calculate the time to drive based on distance and velocity. Also need to calculate the yaw over that time to get the orientation correct.

i think drive_to_position_normalize/si dont use a smooth drive option, i want to be able to take curves just like a normal car, so if I know the angle of orientation with the robot, the translation vector what can be the best function to use for a smooth driving ?

The RC drive provides the smoothest curve, although my testing has been limited on all the drive routines. You’re left with calculating the rate of turn and speed to reach the target position. That isn’t easy, IMO.

You might try the drive_to_position_normalize in small increments, say 250 msec. Determine the distance traveled in that perod which would give you how many increments you need. Divide your distance by the number of increments and change the position parameter. Do the same for the change in yaw.

Sorry, can’t help you more. :grinning:

No problem, that was helpful, now I cant run a cv2.VideoCapture(0) command with a move of rvr, how can I solve this ?

Sorry, can’t help you with the cv2 problem.

SPHERO Email Marketing -