Quantcast
Channel: Gazebo: Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 7017

ConstRaySensorPtr error in shared_ptr.hpp:648

$
0
0
I have a SensorPlugin which subscribes to the sensor given as parameter in the Load function. My goal is to get the msg from the topic and publish it to ros. But I am already failing in subscribing. When I print the DebugString of the msg I get the following error gzserver: /usr/include/boost/smart_ptr/shared_ptr.hpp:648: typename boost::detail::sp_member_access::type boost::shared_ptr::operator->() const [with T = const gazebo::msgs::RaySensor; typename boost::detail::sp_member_access::type = const gazebo::msgs::RaySensor*]: Assertion `px != 0' failed. I am not doing much. So where is the problem? My code looks like this: public: virtual void Load(sensors::SensorPtr _sensor, sdf::ElementPtr _sdf) { this->sensor = _sensor; this->sdf = sdf; std::string topicName = sensor->Topic(); this->node = transport::NodePtr(new transport::Node()); this->node->Init(); this->sub = this->node->Subscribe(topicName, &SensorPlugin::OnMsg, this); } private: void OnMsg(ConstRaySensorPtr &_msg) { std::cout << _msg->DebugString() << std::endl; } Using `gz topic -e "..."` and an external subscriber running the same code are working. I get the correct topic from `sensor->Topic()`. Is there a conflict using a SensorPlugin instead of RaySensorPlugin? I can't imagine that.

Viewing all articles
Browse latest Browse all 7017

Trending Articles