Gazebo | Ignition | Community
Ask Your Question
3

Error Parameter is not an int - issue loading from sdf

asked 2013-07-23 03:36:00 -0500

FiliusFortunae gravatar image

Trying to load an int with a model plugin. sdf:

<plugin name="catvehicle_sim" filename="libcatvehicle_sim.so">
    <robotNamespace>/</robotNamespace>
    <speed>20</speed>
</plugin>

Try to access with:

 speed = _sdf->GetElement("speed")->GetValueInt();

gives error:

Error [Param.cc:514] Parameter [speed] is not an int

Using Gazebo 1.5 with ROS groovy. What is the correct way to do this? I could just convert from a string but it seems like I am missing something easy. Should I be using attributes?

edit retag flag offensive close merge delete

Comments

This happened to me as well, not only for int, bool as well. I know getting the value as double works, and then you can change it to int.

AndreiHaidu gravatar imageAndreiHaidu ( 2013-07-23 03:39:39 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-07-23 17:58:22 -0500

gerkey gravatar image

I can replicate the problem with Gazebo 1.5.0 in Groovy and in standalone Gazebo 1.8.6. As @AndreiHaidu suggests, retrieving it as a double is a reasonable workaround. E.g.:

int speed = (int)_sdf->GetElement("speed")->GetValueDouble();

This problem is not present (i.e., the call to retrieve the parameter as an int works) in gazebo 1.9.x with sdformat 1.4.4. So it would seem that the bug was fixed during the extraction of the SDF parser into the sdformat package.

Given the relative ease of the workaround, we're unlikely to fix this bug in older versions.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-07-23 03:36:00 -0500

Seen: 254 times

Last updated: Jul 23 '13