Skip to content

ROS 2 Migration: Force

Leander Stephen D'Souza edited this page Jun 26, 2022 · 2 revisions

Overview

This pages describes the changes in the gazebo_ros_force plugin in gazebo_plugins for ROS 2 and instructions for migration.

Summary

  • All SDF parameters are now snake_cased.
  • If the topic name is not defined, default to gazebo_ros_force instead of failing.
  • New parameter force_frame, which can be world or link. Defaults to world if not set.

SDF parameters

ROS 1 ROS 2
robotNamespace <ros><namespace>
bodyName link_name
topicName <ros><remapping>gazebo_ros_force:=custom_force</remapping></ros>
force_frame

Example Migration

ROS1

    <model name='the_model'>
      ...

      <link name='box_link'>
        ...
      </link>

      <plugin name="gazebo_ros_force" filename="libgazebo_ros_force.so">

        <robotNamespace>demo</robotNamespace>
        <topicName>force_demo</topicName>
        <bodyName>box_link</bodyName>

      </plugin>

    </model>

ROS2

    <model name='the_model'>
      ...

      <link name='box_link'>
        ...
      </link>

      <plugin name="gazebo_ros_force" filename="libgazebo_ros_force.so">

        <ros>
          <!-- Add namespace and remap the default topic -->
          <namespace>/demo</namespace>
          <remapping>gazebo_ros_force:=force_demo</remapping>
        </ros>

        <!-- Replace camelCase elements with camel_case ones -->
        <link_name>box_link</link_name>

        <!-- New elements -->
        <force_frame>world</force_frame>

      </plugin>


    </model>