Why does accessing ModelPtr from WorldPtr cause VM to crash with modified gazebo_ray_sensor_plugin?
Hi All, I have made some modifications to gazeboraysensorplugin.cpp in ROS2 Foxy and I’m looking for some debugging help. The modifications work perfectly fine on my native Ubuntu 20.04 desktop, but crashes on a VirtualBox Ubuntu 20.04 VM I have on a Windows 10 machine. If I comment out the line in the code below where the ModelPtr is being assigned to model, everything works great on the VM setup, no errors or crashes. However, I need the model pointer so that I can access a link's velocity. Any ideas why that line causes Gazebo to choke up and cause my VM to run out of memory?
void GazeboRosRaySensorPrivate::PublishPointCloud2(ConstLaserScanStampedPtr & msg)
{
ignition::math::Vector3d vlinkrelworldinlink {0,0,0};
if (calcvelflag) {
// Get Model and Link
if(init) {
model_ = world->ModelByName(modelname);
//link = model->GetLink(framename);
init = false;
}
// Get Link Relative Linear Velocity
//vlinkrelworldinlink = link->RelativeLinearVel();
}
// Convert Laser scan to PointCloud2
auto pc2 = gazeboros::Convert<sensormsgs::msg::PointCloud2>(*msg, minintensity,
calcvelflag, vlinkrelworldinlink);
// Set tf frame
pc2.header.frameid = framename;
// Publish output
boost::get(pub_)->publish(pc2);
}
The unmodified version of gazeboraysensorplugin.cpp can be found here: https://github.com/ros-simulation/gazeborospkgs/blob/foxy/gazeboplugins/src/gazeborosray_sensor.cpp
Go easy on me, I'm new to Gazebo and C++ in general.
Asked by tomcat327 on 2021-01-14 18:35:15 UTC
Comments