Open charleswilmot opened 6 years ago
So I made some improvement today. First error was that the subdevice name isn't gazebo_lasersensor
but gazebo_laserSensor
with a capital S
.
Then I found out that the config file requires a [GENERAL]
section. The config file is looking like this now:
[include "gazebo_icub_robotname.ini"]
device Rangefinder2DWrapper
subdevice gazebo_laserSensor
sensorScopedName default::iCub::right_eye_link::right_laser_sensor
name /${gazeboYarpPluginsRobotName}/laser/right
period 10
[GENERAL]
clip_min_range 0.01
clip_max_range 50
discard_min_range 0.01
discard_max_range 50
enable_clip_range false
enable_discard_range false
Now the error message looks different:
[ERROR] Internal error
[ERROR] Rangefinder2DWrapper: Rangefinder2DWrapper: sensor returned false
The error actually comes from line 33. In the beginning, when the sensor is not functioning yet, the call to m_parentSensor->Ranges(m_sensorData)
fills m_sensorData
with a vector of size 0
. The size of this vector is later checked at line 158. It seems that the variable m_first_run
was supposed to avoid that issue, but it does not do the job correctly (at least on my installation).
There is multiple ways of solving that issue, but I'm not sure which one should be preferred. On my side, I replaced the line 33 by a loop:
for (unsigned int i=0; i<m_samples; i++)
{
#if GAZEBO_MAJOR_VERSION >= 7
m_sensorData[i] = this->m_parentSensor->Range(i);
#else
m_sensorData[i] = this->m_parentSensor->GetRange(i);
#endif
}
And this seems to work well. Only one remaining issue separates me now from getting the sensor working. I do observe in the standard output of gazebo that ports are active, but I can't see them in the output on yarp name list
yarp: Port /icubSim/laser/right active at tcp://141.2.249.190:10007/
yarp: Port /icubSim/laser/right/rpc:i active at tcp://141.2.249.190:10008/
[INFO]Rangefinder2DWrapper : no ROS initialization required
[INFO]created device <gazebo_laserSensor>. See C++ class GazeboYarpLaserSensorDriver for documentation.
[INFO]created wrapper <Rangefinder2DWrapper>. See C++ class yarp::dev::Rangefinder2Dwrapper for documentation.
[INFO]created device <gazebo_laserSensor>. See C++ class GazeboYarpLaserSensorDriver for documentation.
Hi @charleswilmot, sorry for the (extremely) late response. Apart from the fixes that you listed i n your issue (thanks!) you were then finally able to get the lasersensor to work?
Hello everyone,
I have difficulties using the lasersensor plugin. Whenever I include a lasersensor to a sdf model, gazebo throws the following error:
Here is how I define the sensor in the sdf:
Finally, here is the
right_laser.ini
file:For debugging purpose, I tried creating an other
.ini
file, in the folder indicated by the environment variableYARP_DATA_DIR
, and called itgazebo_lasersensor.ini
:But I still get the same error (
Cannot find "gazebo_lasersensor" plugin (not built in, and no .ini file found for it), Check that YARP_DATA_DIRS leads to at least one directory with plugins/gazebo_lasersensor.ini or share/yarp/plugins/gazebo_lasersensor.ini in it
)Could you tell me more about subdevices? Isn't the lasersensor a built-in plugin? What are the built-in plugins?
Thank you for your generous help, Charles
Additional resources:
readFromSelector where the error message comes from plugin selector definition of
getSelectedPlugins
YarpPluginSelector::scan definition ofscan