Friday, April 11, 2014

Simple convert: from "position" to "angle" value for: KRS 2552 HV servo motor


KRS-2555RHV Servo Specs:

  • Maximum Operating Angle 270º
  • Maximum Holding Torque 14kgf.cm (11.1V)
  • Speed 0.14s/60º (11.1V, under no load)
  • ICS 3.5 protocol (Serial and PWM comunication)
  • Size 41x21x30.55 mm
  • Weight 41.5g
  • Operating Voltage 9V~12V

For a serial servo motor, a rotation range from 3500-11500 is possible. The middle value, 7500, is referred to as a neutral position. And the angle range from 0 to 270 degrees. 
Therefore to convert: 
1 degree = (11500-3500)/270 = 800/27 
with rc4.dll. use positions to generate a command. 
to convert: 90d ->( 3500+90*800/27 )

Using rcv tools box to calculate a kinematic for robot arm.

1. RCV tool (Peter corke: Robotics, vision and control) - fundamental algorithms in matlab
2. DH-parameters
Fig 1. Definition of standard Denavit and Hartenberg link parameters. The colors red and blue denote all things associated with links j−1 and j respectively. The numbers in circles represent the order in which the elementary transforms are applied.
A link can be specified by two parameters, its length aj and its twist αj . Joints are also described by two parameters. The link offset dj is the distance from one link coordinate frame to the next along the axis of the joint. The joint angle θj is the rotation of one link with respect to the next about the joint axis.
Following this convention the first joint, joint 1, connects link 0 to link 1. Link 0 is the base of the robot. Commonly for the first link d1=α1=0 but we could set d1>0 to represent the height of the shoulder joint above the base.
The final joint, joint Nconnects link N−1 to link N. Link Nis the tool of the robot and the parameters dN
and aN specify the length of the tool and its x-axis offset respectively.
Table 1. Denavit - Hartenberg parameters: their physical meaning, symbol and formal definition.
The transformation from link coordinate frame {j−1} to frame {j} is defined in terms of elementary rotations
and translations as. 
The parameters αj and aj are always constant. For a revolute joint θj is the joint variable and dj is constant, while for a prismatic joint dj is variable, θj is constant and αj=0. In many of the formulations that follow we use generalized joint coordinates. 
Within the Toolbox, it represents a robot link with a Link object which is created by: 
 >> L = Link([0, 0.1, 0.2, pi/2, 0])
where the elements of the input vector are given in the order θk , dj , aj , αj.  The optional fifth element σj
indicates whether the joint is revolute (σi=0) or prismatic (σi=0). If not specified a revolute joint is assumed.
one of the most common parameters and methods is the link transform (Eq. 1). 
ex. L.A(θ)
3. Forward kinematics 
with the end-effector pose as a function of joint coordinates. Using homogeneous transformations this is simply the product of the individual link transformation matrices given by Eq. 2 which for an N-axis manipulator is
 3. A 2-link robot
Fig. 2. Two-link robot. 
We have a DH parameters which we use to create a vector of Link object 
L(1) = Link([0 0 1 0]) (theta =q1, d=0, a =1, alpha =0)
L(2) = Link([0 0 1 0]) (theta =q2, d=0, a =1, alpha =0)
and therefore we construct  a SerialLink
two_link = SerialLink(L, 'name', 'two_link);
Common parameters and methods of SerialLink object are: 
two_link.n ( number of joints)
two_link.fkine([pi/2 pi/2]) (forward kinematic) 
ex. 
>> two_link.fkine([pi/4 pi/4])

ans =

    0.0000   -1.0000         0    0.7071
    1.0000    0.0000         0    1.7071
         0         0        1.0000            0
         0         0                 0    1.0000
and we plot it. 

>> two_link.plot([0 0])
>> two_link.plot([pi/4 -pi/4])
Fig. 3. The two-link robot in two different poses,a the pose (0, 0); b the pose (pi/4,pi/4)

Wednesday, April 09, 2014

Modeling humanoid robot


Draw in solid work -22 degree of freedoms

Using Simmechanics to modelling . 

Monday, April 07, 2014

Kondo humanoid robot

kondolineup.pngThe Khr 3HV Rev 2, improves on the sucessful KHR 3HV design with the improved 2552RHV servos and a new Dual USB Adapter HS.
The new servos feature ICS3.5 protocol making them compatible with Serial or PWM communication. In addition the new Dual USB Adapter HS lets communicate with the servos directly to configure and fine tune the servo behaviour (including the new features added in ICS 3.5).

kondolinedown.png

Control multiple servo motor with C# -rcb4.dll

Create the list view to selectect multiple servo to control.
in the list view, add two column (ics no and position)
Create the list servo in rcb4.dll by manual


//initial setting
       private void Form1_Shown(object sender, EventArgs e)
       {
           // make a list of servo in listView
           lisVICSmotor.Items.Clear();
           //search all secvor
           for (int i = 0; i < Rcb4.Rcb4.MaxDeviceNumner; i++)
           {
               ListViewItem item = new ListViewItem(new string[] {i.ToString ("00"),"7500" });
               lisVICSmotor.Items.Add(item);
           }
       }



for check list view ( when selected index changed and position value changed)
//when the servo motor selection column is clicked


       private void lisVICSmotor_SelectedIndexChanged(object sender, EventArgs e)
       {
           // when nothing is slelected


           if (lisVICSmotor.SelectedIndices.Count ==0)
           {
               return;
               
           }
           // get the number of the selected list
           int sindex = lisVICSmotor.SelectedIndices[0];
           //should chose 1 time, gets the curently position
           nmmsPosition.Value = Convert.ToInt32(lisVICSmotor.Items[sindex].SubItems[1].Text);
       }


       // when the value of nmmsPosition has changed, list data is updated
       private void nmmsPosition_ValueChanged(object sender, EventArgs e)
       {
           //exit when no coonection
           if (lisVICSmotor.SelectedIndices.Count ==0)
           {
               return;
           }


           //get the list number that is selected


           int sindex = lisVICSmotor.SelectedIndices[0]; // chose 1
           //set the position into listview[position]
           lisVICSmotor.Items[sindex].SubItems[1].Text = nmmsPosition.Value.ToString();
       }



for creating command to control multiple servo motor
//generated the command to control multiple servo motor
       // when click command button
       private void btnmsCommand_Click(object sender, EventArgs e)
       {
           //make the command
           System.Collections.Generic.Dictionary<int, int> icsList = new Dictionary<int, int>();


           //register the number of frame, here set -1 to frame value
           //note allways have
           icsList.Add(-1, (int)nmmsFrame.Value);


           //remove the data of id that is checked from the list view to the listing
           foreach (ListViewItem item in lisVICSmotor.Items)
           {
               if (item.Checked)
               {
                   try
               {
                       int icsNo = int.Parse(item.SubItems[0].Text);
                       int pos = int.Parse (item.SubItems[1].Text);


                       icsList.Add(icsNo,pos);
               }
               
                   catch
                   {
                       //do not anythinh
                       continue;
                   }


                }
           }


           //generate a command
           ByteList cmd = new ByteList();


           //System.Collections.Generic.Dictionary<int, int> icsList
           cmd.Bytes = Command.RunConstFrameServo(icsList);


           //show in the cmd textbox
           txtCmd.Text = cmd.CommaText;
           recv_count = 4;
          }



Send the generation command
//generated the command to control multiple servo motor
       // when click command button
       private void btnmsCommand_Click(object sender, EventArgs e)
       {
           //make the command
           System.Collections.Generic.Dictionary<int, int> icsList = new Dictionary<int, int>();


           //register the number of frame, here set -1 to frame value
           //note allways have
           icsList.Add(-1, (int)nmmsFrame.Value);


           //remove the data of id that is checked from the list view to the listing
           foreach (ListViewItem item in lisVICSmotor.Items)
           {
               if (item.Checked)
               {
                   try
               {
                       int icsNo = int.Parse(item.SubItems[0].Text);
                       int pos = int.Parse (item.SubItems[1].Text);


                       icsList.Add(icsNo,pos);
               }
               
                   catch
                   {
                       //do not anythinh
                       continue;
                   }


                }
           }


           //generate a command
           ByteList cmd = new ByteList();


           //System.Collections.Generic.Dictionary<int, int> icsList
           cmd.Bytes = Command.RunConstFrameServo(icsList);


           //show in the cmd textbox
           txtCmd.Text = cmd.CommaText;
           recv_count = 4;
          }