i have a std::queue defined like this
std::queue<sensor_msgs::PointCloud2ConstPtr> pointCloudBuf;
I wanted to understand how to define this in ROS2 , i tried the following but
std::queue<sensor_msgs::msg::PointCloud2::ConstPtr> pointCloudBuf;
When trying to push to the queue
void velodyneHandler(const sensor_msgs::msg::PointCloud2::SharedPtr laserCloudMsg)
{
mutex_lock.lock();
pointCloudBuf.push(*laserCloudMsg);
mutex_lock.unlock();
}
i am getting the following error
no matching function for call to ‘std::queue<std::shared_ptr<const sensor_msgs::msg::PointCloud2_<std::allocator<void> > > >::push(std::__shared_ptr_access<sensor_msgs::msg::PointCloud2_<std::allocator<void> >, __gnu_cxx::_S_atomic, false, false>::element_type&)’
61 | pointCloudBuf.push(*laserCloudMsg);
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
UPDATE
std::queue<sensor_msgs::msg::PointCloud2::SharedPtr> pointCloudBuf;
This seem to have solved my compilation issues , dont know if it will break something else down the line .
Anyhow , thankyou ROS community !
Originally posted by chrissunny94 on ROS Answers with karma: 142 on 2023-07-03
Post score: 0