AndrejOrsula / ign_moveit2_examples

C++ and Python examples of using MoveIt 2 inside Ignition Gazebo simulation environment
BSD 3-Clause "New" or "Revised" License
107 stars 23 forks source link

How to set initial joint positions #21

Open marc-wittwer opened 2 years ago

marc-wittwer commented 2 years ago

With the current joint position setup of the panda, the gripper is in collision with the arm.

I tried to enable collision checking also for the arm. However, the movegroup fails since the robot is already in self-collision at start time.

Which file do I have to edit to modify the initial joint positions?

I tried modifying the ros2_ws_v2/src/panda_ign_moveit2/panda_description/config/initial_joint_positions.yaml file without success...

Edit: After running the scripts xacro2urdf.sh and xacro2sdf.sh (/ros2_ws_v2/src/panda_ign_moveit2/panda_description/scripts) some files change. After building and sourcing the workspace, the initial position is still in collision.

Image: Gripper in self-collision image

AndrejOrsula commented 2 years ago

Hello, This is currently not included in this repository. You could try looking at https://github.com/ros-controls/gz_ros2_control/pull/27 (recommended), but I have not tested it yet. There is/was a way of setting initial states of the simulation for robot (including joint position), but it seemed overly complicated when I last looked into it and did not think it was worth adding. Otherwise, the initial joint configuration can also be set manually through the C++/Python API of Gazebo Sim at the beginning of your application.

marc-wittwer commented 2 years ago

Adding this line to the file /ros2_ws_v2/src/panda_ign_moveit2/panda_moveit_config/srdf/panda.srdf.xacro worked as a workaround:

  <disable_collisions link1="${prefix_arm}link5" link2="${prefix_gripper}hand" reason="Never"/>

Afterwards run the script: /ros2_ws_v2/src/panda_ign_moveit2/panda_moveit_config/scripts/xacro2srdf.bash

It basically disables collision checking of the currently colliding links: hand and link5

Thanks for the hint with setting the initial configuration via the gazebo API.