Joint Velocity/Position Control

Typically: "How do I... ", "How can I... " questions
Post Reply
juanluispolo
Posts: 2
Joined: 12 Jun 2018, 08:49

Joint Velocity/Position Control

Post by juanluispolo » 12 Jun 2018, 11:08

Hi Coppelia!
I am trying to control my own hexapod via external Python scripts.
I have imported correctly the robot, following the "Building a clean model tutorial", and I have connected correctly the scene with the external API.
I have detected that I can control the position of each joint with simxSetJointTargetPosition(), and I can also control the velocity of each joint with simxSetJointTargetVelocity(), but when I use both functions together it doesn´t work.
My problem is that I don´t know what I have to do in order to control joints both in position and speed, that is, not only the angle they have to turn but how fast.
The purpose is to get the joints of each leg to finish the movement at the same time, even though each one has to turn a different angle.

Thank you!

coppelia
Site Admin
Posts: 6766
Joined: 14 Dec 2012, 00:25

Re: Joint Velocity/Position Control

Post by coppelia » 12 Jun 2018, 12:03

Hello,

I would just send the higher-level parameters from the remote API client to a V-REP script (e.g. the 6 target joint angles and the 6 desired joint velocities), and do the job inside of the script. That could be done by calling simxCallScriptFunction for instance.

simxSetJointTargetVelocity should be used when your joint is not in position control mode. If your joint is in position control mode, then you can use simxSetObjectFloatParameter, and use the object parameter ID sim_jointfloatparam_upper_limit (2017).

Cheers

juanluispolo
Posts: 2
Joined: 12 Jun 2018, 08:49

Re: Joint Velocity/Position Control

Post by juanluispolo » 13 Jun 2018, 09:17

Thanks for fast reply!

Would there be any other way of implementing the joint control without having to call a LUA script? I mean, to generate the parameters (angle and velocity of each joint) in my Python script, and send them directly to joints, without using a LUA script in V-REP.

coppelia
Site Admin
Posts: 6766
Joined: 14 Dec 2012, 00:25

Re: Joint Velocity/Position Control

Post by coppelia » 13 Jun 2018, 14:35

Why don't you want to use a script? This makes everything much simpler.

The second part of my previous reply indicates who you can do things from the remote API. However you then still need to make sure that all commands arrive and are applied at the same time.

The normal way of doing would be to first test things from within a child script, then transpose the higher-level functionality into a remote API client.

Cheers

Post Reply