Python controls VREP to move along a track

Typically: "How do I... ", "How can I... " questions
Post Reply
Wang
Posts: 10
Joined: 11 Jul 2022, 07:55

Python controls VREP to move along a track

Post by Wang »

I have a three-dimensional trajectory, which is composed of xyz coordinates. The format is consistent with the graph export.Now, I try to control the terminal executor of vrep, executing one by one according to the points of the track.
I transfer the coordinates of points to a via point in VREP one by one through Python to control the real-time movement of the via points.In VREP, I control the end effector to detect the position of the via point in real time and move with the via point.The result is that the via point moves too fast. Although the end effector finally reaches the via point, it does not run according to the specified track, but directly reaches the destination.
Is there any solution? Is there a simpler way to control the end effector to run according to the specified track? Or can I use the specified trajectory to generate a path to control the movement of the end effector of the mechanical arm?
Thank you

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

Re: Python controls VREP to move along a track

Post by coppelia »

Hello,

it is very difficult to imagine what you are trying to do exactly, or what the problem is. Maybe you can post a minimalistic, self-contained scene that illustrates this?

Is you problem related to IK? To communication between your Python client and CoppeliaSim?

Cheers

Wang
Posts: 10
Joined: 11 Jul 2022, 07:55

Re: Python controls VREP to move along a track

Post by Wang »

Image

The mechanical arm has been set with IK. The desired motion trajectory is a blue curve. Set in the script in VREP to make the tip point at the end of the mechanical arm always move towards the via point, that is, control the end actuator of the mechanical arm to always follow the via point. Via python, you can control the via point to update constantly, so as to get the blue expected track. In this way, the via point moves faster than the tip point. As a result, the tip point runs for a short distance after the via point has reached the target point. The movement track of the tip point does not coincide with the via point, and it directly moves towards the via point in a straight line halfway.

Is there any other way to let the end effector, namely tip point, move according to the motion track of via point.

Thanks

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

Re: Python controls VREP to move along a track

Post by coppelia »

Again, it is very difficult to see what is happening or going wrong. When doing IK, keep in mind that you have two worlds to synchronize: the CoppeliaSim world, and the IK world. e.g. you have CoppeliaSim joints and dummies, and you have IK world joints and dummies. If, e.g. you move a CoppeliaSim world dummy to another position, and then want IK to have your IK world tip to follow that object, you should update the corresponding dummy in the IK world. The opposite also applies when IK was computed, and you want to apply it to the CoppeliaSim world. You have those 2 helper functions doing that normally: simIK.applySceneToIkEnvironment and simIK.applyIkEnvironmentToScene.

Typically, when you set up OK via simIK.addIkElementfromScene, you have two return values: the ik element, and a map, that allows you to access a corresponding object in the IK world, e.g.:

Code: Select all

    ikGroup=simIK.createIkGroup(ikEnv)
    local ikElement,simToIkMap=simIK.addIkElementFromScene(ikEnv,ikGroup,simBase,simTip,simTarget,simIK.constraint_x+simIK.constraint_y)
    
    local ikWorldTipHandle=simToIkMap[simTip]
    local ikWorldTargetHandle=simToIkMap[simTarget]
Cheers

Post Reply