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

Handle map messages even if there is no initial pose #1130

Merged
merged 2 commits into from
Oct 1, 2019

Conversation

mhpanah
Copy link
Contributor

@mhpanah mhpanah commented Sep 17, 2019


Basic Info

Info Please fill out this column
Ticket(s) this addresses (add tickets here #1)
Primary OS tested on (Ubuntu 18.04)
Robotic platform tested on (Gazebo + TB3 simulation)

Description of contribution in a few bullet points

  • Initial pose is not needed to save map messages. We need to be able to save map data even when the callback is called only once.
  • When map messages are being published periodically and first_map_only_ flag is set to false, we are resetting pf every time the map callback is called. This can cause divergence. To fix this issue, every-time we get a map update, I only clear the map and laser data without re-initializing pf every time.

Copy link
Collaborator

@mkhansenbot mkhansenbot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

nav2_amcl/src/amcl_node.cpp Show resolved Hide resolved
nav2_amcl/src/amcl_node.cpp Show resolved Hide resolved

// Instantiate the sensor objects
motion_model_.reset();
motion_model_ = std::unique_ptr<nav2_amcl::MotionModel>(nav2_amcl::MotionModel::createMotionModel(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this ever starting the motion model?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Originally on every map update, pf was getting reset and all the map data was getting cleared and the motion model was getting deleted and reinitialized.

// Laser
lasers_.clear();

handleInitialPose(last_published_pose_);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't this necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When initialPoseReceived is called, it will call handleInitialPose. I don't see any reason on why handleMapMessage should handle the initial pose.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like in navigation1 there was some pose handling on new mapCb https://github.com/ros-planning/navigation/blob/melodic-devel/amcl/src/amcl_node.cpp#L1574

I'm not sure if related but I'm not seeing an analog here

Copy link
Contributor Author

@mhpanah mhpanah Sep 17, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So far we have been setting the initial pose from rviz, but we need to also be able to handle it if it comes programmatically before the first map is ever loaded. I think we are missing this, we should open an issue to support it.

lasers_.clear();
lasers_update_.clear();
frame_to_laser_.clear();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think these are at all related to the maps. This would be a huge pain when you have to do map sharding and you're constantly loading new section of the map in a large building. I think these should go back to where they were

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is this comment regarding these: // Clear queued laser objects because they hold pointers to the existing // map, #5202. in the original code.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So why was this in another method before?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was in handleMapMessage method right after calling the freeMapDependentMemory. Since the only thing that freeMapDependentMemory now does is to delete the map, I decided to put it in the freeMapDependentMemory to make the handleMapMessage method cleaner.

@SteveMacenski
Copy link
Member

I'll admit I haven't thought too much about the AMCL on map change things, but there's some stuff going on here that seems fishy to me, can you explain more about all the changes you made?

@SteveMacenski
Copy link
Member

SteveMacenski commented Sep 24, 2019

I'm just going to rescind my review - I don't understand what's all being changed and way

@SteveMacenski SteveMacenski requested review from SteveMacenski and removed request for SteveMacenski September 24, 2019 21:04
@bpwilcox
Copy link

@mhpanah Can this be merged now?

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

Successfully merging this pull request may close these issues.

4 participants