ROS2 Tutorial: Fixing Gazebo Gripper

Changed files

arm_sim.launch.py had some minor changes. First of all, world file is now gripper_bench.sdf, which is an empty world plus little blue cube.

As we mentioned gripper_bench.sdf world file, here is the code that was added to it (for complete code, download archive):

                        
                                      
                                  
                                  
                                      
                                      
                                  
                                  
                                      
                                          
                                              1.0
                                              1.0
                                          
                                      
                                      
                                          
                                              100
                                              100
                                              0.001
                                              0.0
                                          
                                      
                                          
                                
                              
                        
                    

The object has collision tag so Gazebo makes sure our gripper can interact with it, it has contact plugin, so we can figure out the contact points between it and gripper (would be used if we add fixed joint, but we do not). And it has surface with friction etc defined: again, we do not use it, as we chose to use a workaround, but...

armA_controller.yaml file now has two gripper joints, left and right, as there are problems with mirrored joints in Gazebo.

Also notice a very important change: allow_partial_joints_goal: True. This parameter, when set to True, allows us to pass few (not all) joints to trajectory controller, in other words, we can move arm and gripper separately. Interesting that joint_trajectory_controller has a joint_names parameters, so we do not want to allow processing partial joints, code can figure it out... in a perfect world. In our world, it simply fails if you pass fewer joint names and do not set allow_partial_joints_goal to True.

armA.bumper_config.xacro file. Here a contact sensor is defined, so we know when object collide. It publishes contact data. Note that I cheated, using only left gripper's "finger" to check if there is a collision. This is going to change, as otherwise we will "grab" objects by simply touching them... which is wrong. So in future tutorials, I will add second sensor and check if both "fingers" touch the same object simultaneously. Probably, it is also a good idea to move this sensors inside gripper, so they can only be touched from inside, and not when we put gripper on top of a cube.

armA.transmission.xacro file. Changes reflect the fact that we now do not use mirrored joints, also I have removed motors, as at the moment they are not used.

armA.xacro changes are very important. As we use collisions, we should pay more attention to where they happen. So I have removed cylinders that were playing role of placeholders before (their sizes were wrong) and used same meshes that are used in visual tag.

By the way, to see collision shapes, choose View / Show Collisions in Gazebo: it allows to avoid some humiliating errors with collision shapes turned at wrong angle etc.

(C) snowcron.com, all rights reserved

Please read the disclaimer