Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GUI] [Err] [Conversions.cc:1198] Attempting to convert a NavSat SDF sensor, but the sensor pointer is null. #2163

Closed
ashBabu opened this issue Sep 22, 2023 · 9 comments

Comments

@ashBabu
Copy link
Contributor

ashBabu commented Sep 22, 2023

Ubuntu 22.04, ROS2 Humble, Gazebo Fortress. Installed everything from apt repos

I have a differential drive robot on to which I have added a navsat sensor. I launch the simulation with ros2 launch skidy_bringup bringup_sim.launch.py. As soon as press the play button in gazebo, the following error comes up although I am able to see the msg being published at the topic that I specified.

[GUI] [Err] [Conversions.cc:1198] Attempting to convert a NavSat SDF sensor, but the sensor pointer is null.

@azeey
Copy link
Contributor

azeey commented Sep 26, 2023

It looks like we are missing a msgs -> sdf conversion for NavSat in gz::sim::convert(const msgs::Sensor) . Interestingly, it was left as a TODO in the original PR #1248. @ashBabu would you be able to add the conversion similar to how

gz-sim/src/Conversions.cc

Lines 1084 to 1116 in f55212e

else if (_in.Type() == sdf::SensorType::GPS ||
_in.Type() == sdf::SensorType::NAVSAT)
{
if (_in.NavSatSensor())
{
auto sdfSensor = _in.NavSatSensor();
// \TODO(chapulina) Update to navsat on Garden
auto sensor = out.mutable_gps();
if (sdfSensor->HorizontalPositionNoise().Type() != sdf::NoiseType::NONE)
{
sim::set(sensor->mutable_position()->mutable_horizontal_noise(),
sdfSensor->HorizontalPositionNoise());
}
if (sdfSensor->VerticalPositionNoise().Type() != sdf::NoiseType::NONE)
{
sim::set(sensor->mutable_position()->mutable_vertical_noise(),
sdfSensor->VerticalPositionNoise());
}
if (sdfSensor->HorizontalVelocityNoise().Type() != sdf::NoiseType::NONE)
{
sim::set(sensor->mutable_velocity()->mutable_horizontal_noise(),
sdfSensor->HorizontalVelocityNoise());
}
if (sdfSensor->VerticalVelocityNoise().Type() != sdf::NoiseType::NONE)
{
sim::set(sensor->mutable_velocity()->mutable_vertical_noise(),
sdfSensor->VerticalVelocityNoise());
}
}
else
is done, but in the reverse direction in gz::sim::convert(const msgs::Sensor)
else if (out.Type() == sdf::SensorType::ALTIMETER)

@ashBabu
Copy link
Contributor Author

ashBabu commented Sep 26, 2023

Hi @azeey. I will try to update and create a PR asap

@ashBabu
Copy link
Contributor Author

ashBabu commented Sep 27, 2023

Hi @azeey : I did make a quick code edit as you can see here. However it doesnt solve the error but added another one

[GUI] [Err] [Conversions.cc:1198] Attempting to convert a NavSat SDF sensor, but the sensor pointer is null.
[Err] [Conversions.cc:1453] Attempting to convert an navsat sensor message, but the message does not have a navsat nested message.

Wondering if Im on the right track? Any pointers?

@ashBabu
Copy link
Contributor Author

ashBabu commented Sep 27, 2023

@azeey : Please ignore the above. I found out what I was doing wrong and a PR #2176 was made. Pls review it

@23pointsNorth
Copy link

I am attempting to use GPS/navsat sensor in Gazebo Garden, but I am hitting the same issues. Would the above PR make it in gz-sim7 or 8 as well?

@ashBabu
Copy link
Contributor Author

ashBabu commented Oct 3, 2023

@23pointsNorth : Although the error appears, the navsat sensor still publishes msgs. ign topic -e -t topic_name. If you want it in ROS, use the bridge

bridge = Node(
        package='ros_gz_bridge',
        executable='parameter_bridge',
        arguments=[
                   '/topic_name@sensor_msgs/msg/[email protected]',
                   ],
        output='screen'
    )

But to answer your question, someone from gazebo has to step in

@mjcarroll
Copy link
Contributor

Closed by #2176

@23pointsNorth
Copy link

Is there a schedule on how quickly these changes will get propagated to published 6.x and 7.x?

@azeey
Copy link
Contributor

azeey commented Oct 31, 2023

Is there a schedule on how quickly these changes will get propagated to published 6.x and 7.x?

Generally, we wait for PRs that are close to getting in for the version/branch in question before making a release, but we can make a release sooner if necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

4 participants