Software Onboarding/Inverse kinematics: Difference between revisions

From LairWiki
Jump to navigation Jump to search
(Created page with "Inverse kinematics is the process of computing a target actuator command based on a desired state. =Single Wheeled Robot= {{Template:todo|Split into relative movements and s...")
 
(No difference)

Latest revision as of 07:57, 29 April 2019

Inverse kinematics is the process of computing a target actuator command based on a desired state.

Single Wheeled Robot[edit]

TODO: Split into relative movements and state aware ik
One wheeled robot
One wheeled robot at the origin

The simplest case of inverse kinematics is driving a single wheeled robot on a number line. The robot is capable of being commanded to spin its wheel at a specific speed (positive speeds will cause it to move right, negative speeds will cause it to move left), but we'd like to be able to command it to move to a specific position. To do so will require us to compute a sequence of motor speeds that, when executed by the robot, will move it to the desired target position. There are infinitely many sequences that get us from point A to point B, but we're only interested in the most direct route.

There are only two things we have control over. How fast the wheel spins, and how long it spins. This is enough control to get us anywhere on the line. If we want to move to position 4, we need to move the robot at 1 unit per second in the right direction for four seconds.

Exercise[edit]

TODO: Flesh out this exercise

Create a function that drives the create forward or backward to a target position. Don't worry about turning the robot, just drive both motors at the same speed. Assume that the robot is at the origin when the function is called.

 def drive_distance(distance, time):
   pass
Solution

Solution goes here

Differential Drive Robot[edit]

A differential drive robot is capable of moving in two dimensions. The extra dimension slightly increases the complexity of the inverse kinematics problem, but it can be understood by decomposing a movement into three steps.

  1. Rotate in place so that the robot is pointed towards the destination
  2. Drive in a straight line to the destination
  3. Rotate in place again to face the desired final orientation

The second step is identical to the single wheeled robot, albeit we need to make sure we calculate the straight line distance to the destination. The first and third steps require a bit of trigonometry to calculate the necessary rotation, and a bit of geometry to convert the desired rotation to motor speeds.

TODO: Discussion about the behavior of diff drive robots. Perhaps move this to an earlier section?