Arm Control

From Wiki for iCub and Friends
Revision as of 12:40, 26 July 2006 by Iron (talk | contribs) (The arm)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This page documents your interface to controlling the robot arm. To control the robot you have to physically connect your laptop computer to the robot network (James). The procedure to connect your laptop to the robot is similar to the one we described for iCub (New_ports_on_iCub).

The arm

The arm has 7 joints. We number these joints in the following way:


  Arm:
  0 shoulder yaw
  1 shoulder pitch
  2 shoulder roll
  3 elbow
  Wrist:
  6 roll
  4 pitch
  5 yaw

If you are confused, don't worry we are going to upload a schema soon ;).


You will have limited control of these joints. We are enforcing fairly conservative limits on the joint ranges in order to avoid unfortunate accidents.

The arm starts in the configuration:

  [0, 40, 0, -10, 0, 0, 0]

and is limited within the range:

  MAX: [0, 80, 90, -10, 10, 70, 30]
  MIN: [-120, 40, 0, -90, -100, 0, -70]

Commands that are not within these ranges are automatically thresholded to fit the limits.

Commands to the arm

You can command the arm with a Bottle or Vector of 7 doubles. These numbers should be angles (in degrees) relative to a rest position. The first number controls the joint closest to the body, the last number controls the joint closest to the hand.

The arm controller listens for commands on a port called:

  /james/armcontrol/i

The arm takes some time to execute a command. During this time new commands issued to the controlled are discarded (not queued). So in principle you can send commands to the arm at a high rate; in practice try to be "nice" to the controller and wait some time between two consecutive commands.

Arm feedback

The program reads the currents and the encoders from the arm and broadcast them to two ports called, respectively:

  /james/armcontrol/local/encoders
  /james/armcontrol/local/currents

There is also a port called

  /james/armcontrol/encoders 

which should (if not ask for help) be visible to everybody on the shared network. In this way you can get the encoder feedback while someone else is moving the robot.

Both ports send a vector of 7 doubles, degrees and electric currents respectively.

Example

In the following example we use 'yarp write' to move the arm to four different positions:

  E:\dev\iCub\bin>yarp write /dummywriter /james/armcontrol/i
  Port /dummywriter listening at tcp://192.168.0.100:10072
  yarp: Sending output from /dummywriter to /james/armcontrol/i using tcp
  0.0 80.0 0.0 0.0 0.0 0.0 0.0
  0.0 80.0 0.0 -90.0 0.0 0.0 0.0
  0.0 0.0 0.0 -90.0 0.0 0.0 0.0
  -90.0 0.0 0.0 -90.0 0.0 0.0 0.0

Kinematic Parameters and Forward Kinematics

The kinematic parameters of the Arm can be approximated as follows:

  shoulder length:  0.05 [m] -- L1
  upper arm length: 0.22 [m] -- L2
  forearm length:   0.16 [m] -- L3

Simple Kinematic Model

The kinematics of the first four joints can be described by the Denavit Hartenberg notation (see the file File:Den-Hart.pdf). Specifically the 3D position of the wrist (x) as a function of the (first four) joint positions is given by (in a `pseudo' Matlab code):

  G_02 = G_01 * G_12;
  G_03 = G_02 * G_23;
  G_04 = G_03 * G_34;
  x = G_04 * [0 0 0 1]';

where:

  G_34 = G(L3, 0, 0, pi/2+theta4);
  G_23 = G(0, L2, pi/2, theta3+pi/2);
  G_12 = G(L1, 0, -pi/2, theta2+pi/2);
  G_01 = G(0, 0, -pi/2, theta1);
  theta2 = Shoulder_yaw   (joint 0);
  theta1 = Shoulder_pitch (joint 1);
  theta3 = Shoulder_roll  (joint 2);
  theta4 = Elbow          (joint 3);

and:

  G(a, d, alph, theta) = [cos(theta) -sin(theta) 0  0; sin(theta) cos(theta) 0  0; 0 0 1 0; 0 0 0 1]*
                         [eye(3, 3), [0 0 d]'; 0 0 0 1] *
                         [eye(3, 3), [a 0 0]'; 0 0 0 1] * 
                         [1 0 0 0; 0 cos(alph) -sin(alph) 0; 0 sin(alph) cos(alph) 0; 0 0 0 1];


The wrist position is described in a reference frame attached to the shoulder (Shoulder.jpg).

Accurate Kinematic Model

In the previous model, the shoulder yaw was approximated by a single joint rotation. However, in James, the shoulder yaw is obtianed by two consecutive rotations. In order to take this fact into account, the model has to be modified as follows:

  G_02 = G_01 * G_12;
  G_03 = G_02 * G_23;
  G_04 = G_03 * G_34;
  G_05 = G_04 * G_45;
  x = G_04 * [0 0 0 1]';

where:

  G_45 = G(-L3, 0, 0, pi/2+theta4);
  G_34 = G(0, L2, -pi/2, theta3+pi/2);
  G_23 = G(0, 0, pi/2, theta2/2+3*pi/4);
  G_12 = G(L1, 0, 0, theta2/2+3*pi/4);
  G_01 = G(0, 0, -pi/2, theta1+pi).

In this case the wrist position is given with respect to a reference frame attached to the shoulder which can be visulized in ShoulderNew.jpg.