Robotics StackExchange | Archived questions

Plugins don't work in URDF

I tried to work with LinearBatteryPlugin, LinearBatteryConsumerPlugin and FollowerPlugin, but none of them work with my URDF. For instance, every time i roslaunch my urdf file i get the following, and gazebo dies.

gzserver: /var/lib/jenkins/workspace/gazebo8-debbuilder/build/gazebo-8.1.1/plugins/LinearBatteryPlugin.cc:60: virtual void gazebo::LinearBatteryPlugin::Load(gazebo::physics::ModelPtr, sdf::ElementPtr): Assertion `(link)&&("Link was NULL")' failed. Aborted (core dumped)

The current part of the URDF (which has sdf tags but i don't know how i can modify them) is:

  <joint name="battery_joint" type="fixed">
<axis xyz="0 0 0"/>
<origin xyz="2.3 0 1" rpy="0 0 0" />
<parent link="link_name"/>
<child link="body" />
  </joint>


<link name="body">
  <inertial>
      <mass value="10" />
      <origin xyz="0 0 0" />
      <inertia ixx="1.8" ixy="0.0" ixz="0.0" iyy="1.8" iyz="0.0" izz="1.8"/>
  </inertial>
   <visual>
    <origin xyz="0 0 0" rpy="0 0 0" />
    <geometry>
        <box size = "1 1 1"/> 
    </geometry>
   </visual>
    <collision>         
    <geometry>
        <box size = "1 1 1"/> 
    </geometry>
      <surface>
        <friction>
          <ode>
            <mu>0.1</mu>
            <mu2>0.1</mu2>
          </ode>
        </friction>
      </surface>
    </collision>
    <battery name="linear_battery">
      <voltage>12.592</voltage>
    </battery>
</link>
  <gazebo>
      <plugin name="battery" filename="libLinearBatteryPlugin.so">
        <link_name>body</link_name>
        <battery_name>linear_battery</battery_name>
        <open_circuit_voltage_constant_coef>25</open_circuit_voltage_constant_coef>
        <open_circuit_voltage_linear_coef>-3.1424</open_circuit_voltage_linear_coef>
        <initial_charge>1.1665</initial_charge>
        <capacity>1.2009</capacity>
        <resistance>0.061523</resistance>
        <smooth_current_tau>1.9499</smooth_current_tau>
      </plugin>
  </gazebo>
  <gazebo>
      <plugin name="motherboard" filename="libLinearBatteryConsumerPlugin.so">
        <link_name>body</link_name>
        <battery_name>linear_battery</battery_name>
        <power_load>6.6</power_load> <!-- mother board power load = 6.6 W -->
      </plugin>
  </gazebo>

Any tip? thank you!

Asked by moshimojo on 2017-10-29 17:31:57 UTC

Comments

Answers

the link name may have changed during URDF to SDF conversion. You can check in the Models tree in the left panel of gazebo gui, find the model, and identify the name of the link you want to attach the plugin to (name probably needs to be fully scoped, e.g. my_model_name::link_name) then update the plugin's link_name in your URDF description.

Asked by iche033 on 2017-10-30 18:21:25 UTC

Comments