frankaemika / franka_ros

ROS integration for Franka research robots
https://frankaemika.github.io
Apache License 2.0
356 stars 308 forks source link

[bug] Incorrect collision checking in `franka_gazebo` package #363

Open rickstaa opened 1 year ago

rickstaa commented 1 year ago

It has come to my attention that there is an issue with the collision checking mechanism in the franka_gazebo package. The problem arises from the fact that the contribution of gravity needs to be adequately accounted for in the joint collision-checking process. This is a critical omission, as gravity's effect on collisions is not stored in the joint->command variable, which can lead to inaccurate collision detection. To address this issue and ensure accurate collision checking, I have created a pull request (#227) to fix the bug.

How to reproduce

  1. Clone the develop branch branch.
  2. Install the ROS system dependencies using rosdep install --from-path src --ignore-src -r -y.
  3. Build and source the Catkin workspace (i.e. catkin build or catkin_make).
  4. Start a panda simulation using roslaunch franka_gazebo panda.launch.
  5. Print the results of the /franka_state_controller/franka_states/joint_collision topic.
  6. See that joints four and sometimes two start in a collision because the gravity is already higher than the collision threshold.

Additional information

I also noticed that the cartesian_collision and joint_collision attributes on the /franka_state_controller/franka_states topic behave differently in franka_gazebo than on the real robot. Where on the real robot, these values need to be reset in the simulation, they will automatically reset when the threshold is no longer reached. Maybe you can document this difference in the frankaStateInterface documentation.

https://github.com/frankaemika/libfranka/blob/f1f46fb008a37eb0d1dba00c971ff7e5a7bfbfd3/include/franka/robot_state.h#L258-L274

TODOs