Menu

controlling joints

Help
George
2012-04-17
2012-12-14
  • George

    George - 2012-04-17

    Hi steve

    So just a quick question I'm trying to figure out how to control the revolute joints of my robot, I believe they are all set up in the UC script correctly (untested though so might be wrong I copied code from Nao as an example) and now I'm trying to figure out how to control them. I have the following 2 commands that I have found in mfd.cc:

    servoMisMoveJoints(double *joints, int num, double tolerance)
    and
    servoMisGetJoints(double *joints, double *torques, int num, int *jointsRead)

    I'm just a bit confused by a few points,

    how is the array of joints created? - are the joints in the same order that you create them in the UC script?
    How do you define how far you want the joint to move?
    Is there some way to just move a single joint, (the joints all need to move independantly from each other)

    Once again thanks for all the help that you have provided over the last few weeks.

    George

     
  • Stephen Balakirsky

    Hi,
    The beauty of the MOAST/USARSim interface is that it auto-discovers the simulated hardware. At least when it is working correctly :)

    Documentation for the command that you are looking at is in the header of the function located in the mfd.cc file. If you generate the doxygen documentation then you should get a nice html version of the function. Basically, you need to input a vector of doubles of length equal to the number of joints in the robot. The joint order in USARSim matches the joint order in the call. The num field specifies the length of the double vector and the tolerance lets the system know when it is done with the move.

    There is currently no servoMisMoveJoint (move a single joint command), However, one could easily be written. It would look identical to this command except that you would not have the for loop that iterates through the joints.

     
  • George

    George - 2012-04-25

    Hi I'm trying to use the mfdPrimMisTest with P3AT but I'm getting an error it seems to not be initializing prim correctly, I'm running runany in the prim echelon, and then running mfdPrimMisTest.

    when run the output reads:

    mfd.cc: Failed to recieve done for command 21
    initialized prim
    mfd>
    world pose:                           -1.23 1.22 1.65 0.00 -0.00 0.00
    can't get joints
    mfd> movej 1
    joint move error: MFD: A Prim echelon call was made, and prim is not initialized.

    As a side note the "mfd.cc: Failed to recieve done for command 21" line (and similar variants) often occours when I run my own script howevfen the command still seemed to work so I have been ignoring it.

     
  • Stephen Balakirsky

    Can you be more specific about your configuration? By default the P3AT does not have a mission package (a robotic arm, pan/tilt, …) and I would expect that it would be unable to get any joints.

     
  • George

    George - 2012-04-25

    oh I thought that it did, that might well be my problem

     
  • George

    George - 2012-04-25

    could you recommend a robot that would be good to look at as a simple example

     
  • Stephen Balakirsky

    Can you be a little more specific? Are you looking for a standalone robotic arm or an arm mounted on a mobile platform? From the .ini file, you can mount an arm on any of the platforms. If I had an idea of your application I may be able to recommend a suitable combination.

     
  • George

    George - 2012-04-25

    ok thanks, I'll try my best to explain the overall aim, I'm attempting to make a snake like robot that will move forward as it undulates, in order to make this I need to be able to move each section of the robot in relation to the section in front, but they have to be able to move separately as the direction of motion may need to be different for neighbouring sections.

    Ideally all I think I need is an example that will hopefully show me how to set this up.

    Thanks
    George

     
  • George

    George - 2012-04-26

    can you explain how to  mount an arm on to a platform?
    Thanks

     
  • Stephen Balakirsky

    Please see the DefaultUSAR.ini file for examples. For instance, the USARBot.KR60 is really an invisible robot with an arm attached. The "AddParts" statement that specifies the ItemClass of "USARActuator.KR60Arm" is the line that adds the code to the robot. If you put this line in the P3AT section, you would get a very strange P3AT with a controllable KR60 arm.

     
  • George

    George - 2012-04-26

    when I try to move the arm it says that it is a singularity

     
  • Stephen Balakirsky

    OK, I found a bug in the reporting of the joint angle for that arm. Update your CVS and this should fix it. In terms of the world coordinate solution, there is some problem with the inverse kinematics. Not sure what is wrong here, but it will take some time to track down. Do you need to move in cartesian space or is joint space ok?

     
  • George

    George - 2012-04-26

    Brilliant!!! :) it works now, I now have a fairly good idea now as to what to do. Joint space should be ok, but I just want to check if I need to set the angles/positions that it moves to or is it automatic?
    Thanks
    George

     
  • Stephen Balakirsky

    Not sure that I understand the question. You can use the mfd call to set the individual joint angles and it will then move to those angles and report done when the position has been reached (or you can ignore the return). Is that automatic?

     
  • George

    George - 2012-04-29

    Don't worry I was confusing myself and the question was a silly one, I'm having a bit of an issue creating my own code the cod I have is

    int main(int argc, char *argv[])
    {
      Mfd *mfd;
      #define BUFFERSIZE 256
      char buffer[BUFFERSIZE];
      char *ptr = "3 5 2";
      double joints[SERVO_MIS_JA_LINK_MAX];
      int num = scanem(joints, ptr, ARRAYELS(joints));
      
      //initialize source code portability interface
      ulapi_init(UL_USE_DEFAULT);
      if (argc > 1) {
        mfd = new Mfd(argv[1]);
      } else {
        mfd = new Mfd();
      }
      if (true != mfd->init(MFD_PRIM)) {
        printf( "%s\n", mfd->mfdErrorStr());
        return 1;
      } else {
       printf("initialized prim\n");
      }
      buffer[sizeof(buffer) - 1] = 0; // stick a null at the end
      
        if (num > 0) {
        if (false == mfd->primMisMoveJoint(joints, num)) {
          printf("joint move error: %s\n", mfd->mfdErrorStr());
        }
        } else {
        printf("need some joint values\n");
        }
       
       }
              
    }
    }
    

    I thought that this would move the first 3 joints to 3 5 2 respectively, however all I get is the first joint moving to position 1. Can you see where I am going wrong in my code?

    Thanks

     
  • Stephen Balakirsky

    Hi,
    I am  not familiar with the call to scanem. I would try to print out your values of joints and num before the call to primMisMoveJoint. A couple of things to note:
    1) if you give a value outside of the joint's range (set in USARSim), the joint will not move. These values are in radians, so 5 may be too large?
    2) primMisMoveJoint expects your joint array to be equal to the total number of joints on the arm.
    3) You may also want to try servoMisMoveJoints. It should do the same thing, but is more direct.

     

Log in to post a comment.