jsk-ros-pkg / jsk_model_tools

JSK model utilities
https://github.com/jsk-ros-pkg/jsk_model_tools
BSD 3-Clause "New" or "Revised" License
5 stars 27 forks source link

[collada2eus_urdfmodel.cpp] change joint-angle range based on joint->mimic->multiplier #253

Closed W567 closed 11 months ago

W567 commented 11 months ago

image When the multiplier of the mimic joint is minus, for example the _left_inner_fingerjoint of robotiq_2f_85_girpper, its corresponding joint angle range should be modified as:

min = max * multiplier
max = min * multiplier

Or, the generated euslisp file from euscollada still has the original range without multiplier considered, continuously causing warning whenever send angle-vector to the robot model. image

With this PR, joint-angle ranges of mimic joints can be modified based on their multipliers, and there's no more warning with the generated euslisp file. image

Code can be tested as follows:

mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src
sudo apt-get install ros-<distro>-ur-description
git clone https://github.com/ros-industrial/robotiq.git
git clone https://gitlab.jsk.imi.i.u-tokyo.ac.jp/tendon/mujoco_ros_interface.git
git clone https://github.com/W567/jsk_model_tools.git
# or git clone https://github.com/jsk-ros-pkg/jsk_model_tools.git
git clone https://github.com/jsk-ros-pkg/jsk_pr2eus.git

cd ~/catkin
catkin build ur5e85
source ~/catkin/devel/setup.bash
roscd ur5e85/euslisp
# roscore at another terminal
roseus ur5e85-interface.l
  ur5e85-init
  send *sr* :angle-vector #f(0 0 0 0 0 0 20)
Naoki-Hiraoka commented 11 months ago

I think this is not a bug of euscollada, but a bug of the original URDF.

The original URDF should be modified as

   <joint name="left_inner_finger_joint" type="revolute">
     <origin rpy="0 0 0" xyz="0 0.0061 0.0471"/>
     <parent link="left_outer_finger"/>
     <child link="left_inner_finger"/>
     <axis xyz="1 0 0"/>
-    <limit effort="1000" lower="0" upper="0.8757" velocity="2.0"/>
+    <limit effort="1000" lower="-0.8757" upper="0" velocity="2.0"/>
     <mimic joint="finger_joint" multiplier="-1" offset="0"/>
   </joint>

I think it is better to open a pull request to https://github.com/ros-industrial/robotiq/blob/kinetic-devel/robotiq_2f_85_gripper_visualization/urdf/robotiq_arg2f_85_model_macro.xacro

pazeshun commented 11 months ago

Sorry for late, +1 to @Naoki-Hiraoka . Please check http://wiki.ros.org/urdf/XML/joint, you can see limit should be independent of mimic.

And PR seems to already exist: https://github.com/ros-industrial/robotiq/pull/166. Please check that PR, and if that PR works, comment to that PR that this PR is good. Perhaps you should open a new PR due to https://github.com/ros-industrial/robotiq/pull/166#pullrequestreview-1558158538. According to https://github.com/ros-industrial/robotiq/tree/kinetic-devel#status, that repository is unmaintained, but the writer of this status seems active: https://github.com/ros-industrial/robotiq/commit/a8c61490285fd5732e6e71694f636e61bb58f323 -> https://github.com/gavanderhoorn So if you mention to them, they may help you. (Perhaps https://github.com/ros-industrial/robotiq/pull/166 is too large to merge. You can ask them whether they can merge a new PR only including limit changing part.)

W567 commented 11 months ago

@Naoki-Hiraoka @pazeshun I see. Thank you very much for your comments!