You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ROS_INFO("Message Resolution is %f", binary_msg->resolution);
std::lock_guard<std::mutex> lock(octomap_mutex);
ros::Time current = ros::Time::now();
// Update map at a fixed rate. This is useful on setting replanning rates for the planner.
if ((current - last_wp_time_).toSec() < mapupdate_dt_)
{
return;
}
last_wp_time_ = ros::Time::now();
octomap::AbstractOcTree* msg_octree = octomap_msgs::msgToMap(*binary_msg);
if (tree_oct)
{
delete tree_oct;
}
if (msg_octree)
{
tree_oct = dynamic_cast<octomap::OcTree*>(msg_octree); // dynamic casting from octomap::AbstractOcTree to octomap::OcTree
if(tree_oct == NULL)
{
ROS_WARN("Casting failed!I'm out");
return;
}
else
ROS_WARN("Resolution is %f", tree_oct->getResolution ());
}
if (tree_oct)
{
ROS_INFO("%s: Octomap received %zu nodes, %f m of resolution", ros::this_node::getName().c_str(), tree_oct->size(), tree_oct->getResolution());
fcl::OcTree* tree = NULL;
tree = (new fcl::OcTree(std::shared_ptr<const octomap::OcTree>(tree_oct)));
// Update the octree used for collision checking
updateOctotree(std::shared_ptr<fcl::CollisionGeometry>(tree));
replan();
delete tree;
tree_oct->clear();
}
else
{
ROS_ERROR("Error by reading OcTree from stream");
tree_oct->clear();
}
}`
can anybody see a problem here??
I traced the problem it lies in this critical command tree_oct = dynamic_cast<octomap::OcTree*>(msg_octree);
The text was updated successfully, but these errors were encountered:
hichamhendy
changed the title
Map Dynamic Casing fails
Map Dynamic Casting fails
Dec 14, 2022
I am trying to process the binary map generated from octo binary; however the dynamic casting keeps failing. The call back function as the following
`void Planner::octomapBinaryCallback(const octomap_msgs::Octomap::ConstPtr& binary_msg)
{
}`
can anybody see a problem here??
I traced the problem it lies in this critical command
tree_oct = dynamic_cast<octomap::OcTree*>(msg_octree);
The text was updated successfully, but these errors were encountered: