call generatePath multiple times

Typically: "How do I... ", "How can I... " questions
Post Reply
guyleblond
Posts: 1
Joined: 30 Nov 2023, 14:29

call generatePath multiple times

Post by guyleblond »

I found some example code and was able to get generatePath to move my robot arm tip from the current pose to a new a target pose.

But I cannot figure out how to do multiple generatePath, that will move the arm to several new poses, from it's current location.
I'm running the python code remotely using the RemoteAPIClient.

Here is a snippet of my code:
sim.setObjectPose(sim_obj_arm_target, target_pose)
ik_element_pose, sim_to_ik_map_pose, ik_to_sim_map_pose = sim_ik.addElementFromScene(ik_environment, ik_group_pose, sim_obj_arm_base, sim_obj_arm_tip, sim_obj_arm_target, sim_ik.constraint_pose)
ik_tip_handle_pose = sim_to_ik_map_pose[sim_obj_arm_tip]
ik_joints_handle_pose = []
for i in range(len(sim_obj_arm_joints)):
ik_joints_handle_pose.append(sim_to_ik_map_pose[sim_obj_arm_joints])
fwd_kin_path = sim_ik.generatePath(ik_environment, ik_group_pose, ik_joints_handle_pose, ik_tip_handle_pose, 100)
for i in range(0, len(fwd_kin_path), 6):
joint_angles = fwd_kin_path[i:i+6]
for j in range(len(joint_angles)):
sim.setJointPosition(sim_obj_arm_joints[j], joint_angles[j])
time.sleep(0.05)
coppelia
Site Admin
Posts: 10747
Joined: 14 Dec 2012, 00:25

Re: call generatePath multiple times

Post by coppelia »

Hello,

can you please post a minimalistic, self-contained version of your scene that illustrates your problem?

Cheers
Post Reply