Page 1 of 1

Move arm with remote api

Posted: 03 May 2013, 16:28
by adrian00
Hi ,
i'm doing a project in which i move a 3 dof arm to reach a point in the space, the shoulder part is in a static position. I use the remote api with c++, but i have some doubts about these. In the initial part i need to set the joint values (all revolute joints), i do it with simxSetJointPosition and in the position parameter i set the angle of rotation

Code: Select all

simxSetJointPosition(baseJoint, 30, simx_opmode_oneshot);
The problem is that the joint doesn't reach the position in either torque/force mode or inverce kinematics mode (joints property). What's the correct mode?
Another thing is the movement in the arm, i want to do this using the simxRMLPosition but i don't understand what to put in the parameters.
I use this but i don't know the others parameters

Code: Select all

int dofs = 3;
double timeStep = 0.05;
int flags = -1;	        
//to set the currentPosVelAccel
float targetPos[3];
float targetVel[3];
double currentPosVelAccel[9];    
currentPosVelAccel[0] = targetPos[0];
currentPosVelAccel[1] = targetPos[1];
currentPosVelAccel[2] = targetPos[2];
currentPosVelAccel[3] = targetVel[0];
currentPosVelAccel[4] = targetVel[1];
currentPosVelAccel[5] = targetVel[2];
currentPosVelAccel[6] = 0;      
currentPosVelAccel[7] = 0;
currentPosVelAccel[8] = 0;                 
double maxVelAccelJerk[] = {0.4,0.4,0.4,1.8,0.3,0.3,0.3,0.9,0.2,0.2,0.2,0.8};   //Values taken from RML demo
simxRMLPosition(dofs, timeStep, flags ,currentPosVelAccel,maxVelAccelJerk,const simxChar* selection,const simxDouble* targetPosVel,simxInt* rmlState,simxDouble* newPosVelAccel,simx_opmode_oneshot_wait);
What values i need to put in selection and rmlState?What is the difference about currentPosVelAccel and targetPosVel ?
In the user manual you say
arrange values as {pos1,pos2,..,posN,vel1,vel2,..,velN}
how many positions i need to write in my example?


Re: Move arm with remote api

Posted: 03 May 2013, 18:02
by coppelia
Hello Adrian,

What kind of arm do you want to have? Will it be dynamically simulated? I guess yes. The second question is, will you control the arm in forward kinematics or inverse kinematics? Or both?

First of all, here a few elements or reply, since I don't know what you want to do exactly:
  • if you want to dynamically simulate your arm, then make sure to read and understand this section. Specially: two joints cannot be built on top of each other, if you want a dynamic simulation: you need a non-static shape in-between.
  • Make sure your joints are in force/torque mode. You can set this here. Alternatively, you can have your joints in inverse kinematics mode, but make sure you check the hybrid operation checkbox.
  • Make sure your joint motors are enabled and that they operate in position control. You can set this here.
  • All values that you set via the API are in standard units: meters, seconds, kilograms, etc. And all angles are expressed in radians, not degrees
  • When your joints are in force/torque mode, and the motor enabled and position control enabled, then you can change their positions with simSetJointTargetPosition or simxSetJointTargetPosition. When your joints are in inverse kinematics mode, operating in hybrid fashion, the target positions are automatically set by the IK calculations. You will have to set-up an IK group and IK element defining your kinematic chain.
  • Always make sure your remote API client is connected. You can visualize this with simExtRemoteApiStart(portNb,250,true).
It is not a good idea to use the Reflexxes motion library functions from a remote API client, since the communication lag is too large. When using the Reflexxes functions, do it from a child script or a plugin. Otherwise, download the Reflexxes Motion Library and integrate it into your source code.