husarion / rosbot_ros

ROS packages for ROSbot 2, 2R and 2 PRO
122 stars 62 forks source link

Nav2 with Amcl simulation demo #16

Closed mkhansenbot closed 3 years ago

mkhansenbot commented 3 years ago

This adds and changes the necessary files for a demo using Navigation2 with AMCL.

adamkrawczyk commented 3 years ago

Hi,

Great job and thank you for the development, but so far I see one problem - aws_robomaker_bookstore_world it's necessary to add this repository to the workspace before launching the simulation.

I'm thinking about how to merge this but quick copy-paste world file fails due to your custom objects.

I'm thinking about switching if aws is present or by default run our model and with arg run aws.

What is your opinion?

mkhansenbot commented 3 years ago

Hi,

Great job and thank you for the development, but so far I see one problem - aws_robomaker_bookstore_world it's necessary to add this repository to the workspace before launching the simulation.

I'm thinking about how to merge this but quick copy-paste world file fails due to your custom objects.

I'm thinking about switching if aws is present or by default run our model and with arg run aws.

What is your opinion?

You're right this currently requires the following steps to run. Please let me know if this works for you or not. Assumes:

Clone the repos and install dependencies

mkdir -p foxy_ws/src
cd foxy_ws/src
git clone -b amcl_sim_demo https://github.com/mkhansenbot/rosbot_description.git
git clone -b ros2 https://github.com/aws-robotics/aws-robomaker-bookstore-world.git 
sudo apt update
rosdep install -i -r -y --from-paths .

The dependency install may take a few minutes to run. When completed, build the code.

cd ..
source /opt/ros/foxy/setup.bash
colcon build

Run the demo

source /usr/share/gazebo/setup.sh
source ~/foxy_ws/install/setup.bash
export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:`ros2 pkg prefix aws_robomaker_bookstore_world`/share/aws_robomaker_bookstore_world/models/
ros2 launch rosbot_description nav_amcl_demo_sim.launch.py 

Also, if you would prefer this be merged to another branch, let me know, I can re-submit the PR.

mkhansenbot commented 3 years ago

Merging with foxy seems to have broken navigation, getting a TF circular dependency now: dummy->base_link->dummy

Investigating...

mkhansenbot commented 3 years ago

OK, so this is the error I see now:

[controller_server-15] [ERROR] [1619651443.994733948] [getCurrentPose]: No Transform available Error looking up robot pose: The tf tree is invalid because it contains a loop.
[controller_server-15] Frame range_fl exists with parent base_link.
[controller_server-15] Frame base_link exists with parent dummy.
[controller_server-15] Frame camera_link exists with parent base_link.
[controller_server-15] Frame camera_depth_frame exists with parent camera_link.
[controller_server-15] Frame camera_rgb_frame exists with parent camera_link.
[controller_server-15] Frame dummy exists with parent base_link.
[controller_server-15] Frame range_fr exists with parent base_link.
[controller_server-15] Frame range_rl exists with parent base_link.
[controller_server-15] Frame range_rr exists with parent base_link.
[controller_server-15] Frame laser exists with parent base_link.
[controller_server-15] Frame top exists with parent base_link.
[controller_server-15] Frame odom exists with parent map.
[controller_server-15] Frame front_right_wheel exists with parent base_link.
[controller_server-15] Frame front_left_wheel exists with parent base_link.
[controller_server-15] Frame rear_right_wheel exists with parent base_link.
[controller_server-15] Frame rear_left_wheel exists with parent base_link.

I get the same error if I run the existing nav sim demo:

ros2 launch rosbot_description navigation_demo_sim.launch.py  

Is there a new/different way to start navigation?

mkhansenbot commented 3 years ago

Rebased to fix merge conflict

mkhansenbot commented 3 years ago

With latest commits you made to foxy, I rebased and this works, please test using instructions above.

Let me know if this is OK as-is, which does require cloning the bookstore world. If necessary, I can add an environment variable for that. However, since this is AMCL based, the user will need to provide a map file for any world used (ie. Willow) for this to work.

adamkrawczyk commented 3 years ago

Works great!! Only missing the initial point for amcl, but since official docs don't mention this setting from rviz is fine.

Also the world looks superb!

mkhansenbot commented 3 years ago

Awesome! Thanks!

mkhansenbot commented 3 years ago

@adamkrawczyk - would it be possible to add a tag to the repo at this commit to make it easy for users to check out a working version of this demo? A tag like "amcl-demo" would be ideal.

adamkrawczyk commented 3 years ago

There it is.