Position and Orientation control with one command
-
- Posts: 5
- Joined: 13 Apr 2021, 12:10
Position and Orientation control with one command
Hi, can we use one single command to control the robot end effector position and orientation together, instead of separately. This apparently causes problems in inv kinematics.
Any suggestions would be appreciated.
Any suggestions would be appreciated.
Re: Position and Orientation control with one command
Hello,
yes, you can do this with
However, using two separate API functions (e.g.
Cheers
yes, you can do this with
sim.setObjectMatrix
or sim.setObjectPose
.However, using two separate API functions (e.g.
sim.setObjectPosition
and sim.setObjectOrientation
or sim.setObjectQuaternion
) should not cause any problems, even with threaded script, if done correctly:Code: Select all
function coroutineMain()
...
local forbidLevel=sim.setThreadAutomaticSwitch(false)
-- Following 3 API commands are not executed without interruption:
sim.setObjectPosition(handle,-1,position)
sim.setObjectOrientation(handle,-1,euler)
sim.setThreadAutomaticSwitch(forbidLevel)
...
end
-
- Posts: 5
- Joined: 13 Apr 2021, 12:10
Re: Position and Orientation control with one command
Thank you, I use matlab API to do this. there is mostly a misalignment of tip and target frames. Is there some tolerance factor that i should expect. or it must be 100% accurate if everything is setup correctly even when i use setposition and setorientation separately.
Re: Position and Orientation control with one command
you are talking about several things here. You first need to rule out several things, e.g. such as:
Cheers
- you have some communication delay between CoppeliaSim and the client application. Moreover, if you do not run in synchronous mode and/or in real-time mode, you will see differences
- you are talking about tip and target frames. Does that mean you run some inverse kinematics? If yes, then the IK itself will need 1-n simulation passes to bring the tip closer to the target, depending on the resolution method and other IK settings. Moreover, if your robot is dynamically enabled, then the tip-target overlap quality will also depend on the various joint controllers and physical properties of the joint and links.
Cheers
-
- Posts: 10
- Joined: 01 Dec 2021, 12:27
Re: Position and Orientation control with one command
Dear Coppelia team,
I also tried to set the position and orientation directly with your recommended commands. But the problem is, that the dummy Panda_tip moves upwards but not the rest of the robot (joints)arrange/follow. I also tried it with the Panda robot endeffector but without any success. Can you help me out, how to set or arrange the whole robot with the setObjectPosition/Orientation command?
unfortunately I don't get how to add the image here
cheers,
Marcel
I also tried to set the position and orientation directly with your recommended commands. But the problem is, that the dummy Panda_tip moves upwards but not the rest of the robot (joints)arrange/follow. I also tried it with the Panda robot endeffector but without any success. Can you help me out, how to set or arrange the whole robot with the setObjectPosition/Orientation command?
Code: Select all
function sysCall_init()
tipHandles=sim.getObjectHandle(Panda_tip)
pos={0.2900,-0.0100, 1.8720}
eul={180.00, 013.89, -180.00}
local forbidLevel=sim.setThreadAutomaticSwitch(false)
sim.setObjectPosition(tipHandles, -1, pos)
sim.setObjectPosition(tipHandles, -1, eul)
sim.setThreadAutomaticSwitch(forbidLevel)
cheers,
Marcel
Re: Position and Orientation control with one command
Hello Marcel,
you have several problems in your script:
Cheers
you have several problems in your script:
- you are using sim.setObjectPosition instead of sim.setObjectOrientation for the Euler angles
- your Euler angles should be expressed in rad, not degrees
- since you are in a non-threaded section, you do not have to use sim.setThreadAutomaticSwitch
Cheers
-
- Posts: 10
- Joined: 01 Dec 2021, 12:27
Re: Position and Orientation control with one command
Hello,
thanks for your help and your reply.
My object is moving to the proper position and orientation. But the rest of the robot still doesn't follow. I will send you the image via wetransfer. My aim is to subscribe the endeffector pose of my robot via ROS and change the endeffector pose plus the rest to the subscribed pose at the beginning once. To make it more feasible I have used the Panda_gripper instead of the Panda_tip (what describes the TCP/endeffector frame here)
https://we.tl/t-upueg7daQC
Cheers,
Marcel
thanks for your help and your reply.
My object is moving to the proper position and orientation. But the rest of the robot still doesn't follow. I will send you the image via wetransfer. My aim is to subscribe the endeffector pose of my robot via ROS and change the endeffector pose plus the rest to the subscribed pose at the beginning once. To make it more feasible I have used the Panda_gripper instead of the Panda_tip (what describes the TCP/endeffector frame here)
https://we.tl/t-upueg7daQC
Cheers,
Marcel
Re: Position and Orientation control with one command
You are still using an old version of CoppeliaSim. Please use CoppeliaSim V4.3 or later. The scene or the robot model is also still using the old IK functionality (the one that had to be set-up via GUI). Since CoppeliaSim V4.2 or later, IK tasks are set-up entirely via code, which makes everything much more scalable and easy to use.
Please post the scene, a screenshot is not really useful.
Cheers
Please post the scene, a screenshot is not really useful.
Cheers
-
- Posts: 10
- Joined: 01 Dec 2021, 12:27
Re: Position and Orientation control with one command
Thanks for your help and reply! I know but for the work I am doing only CoppeliaSim V4.1 is supported. To clarify, in the old version there is no automated way to set the endeffector frame (and the associated links) to a certain position, right? So the joints need to set manually to the desired position. My goal is to open the scene and the robot already fits to the desired endeffector position (the positions of joints are negligible).
Cheers,
Marcel
Cheers,
Marcel
Re: Position and Orientation control with one command
if you are able to move the target object into the correct position and orientation, but the robot does not follow, then you have a problem with IK.
Either IK is not properly defined, or your IK is not able to properly execute. Keep in mind that you can't make bit jumps with IK, you will have to move gradually, step-by-step until you reach the target position/orientation. You can of course also directly compute the joint configuration that corresponds to a given end-effector pose with simIK.findConfig. That API command is not yet available in CoppeliaSim V4.1, and in that case you should use sim.getConfigForTipPose.
Cheers
Either IK is not properly defined, or your IK is not able to properly execute. Keep in mind that you can't make bit jumps with IK, you will have to move gradually, step-by-step until you reach the target position/orientation. You can of course also directly compute the joint configuration that corresponds to a given end-effector pose with simIK.findConfig. That API command is not yet available in CoppeliaSim V4.1, and in that case you should use sim.getConfigForTipPose.
Cheers