path planning - eechhx/macbot GitHub Wiki
Using the move_base package from the ROS navigation stack. Will be using global_planner as our Global Planner. Files currently configured so that we will be using Dijkstra's alogrithm for our global path planning. Local planner will be using dwa_local_planner, or the Dynamic Window Approach algorithm. Configuration files are not fully optimized and there is room for improvement.
Tuning navigation parameters can be confusing or challenging especially because there's so many different parameters. Helpful guides are listed below for further reading.
<!-- GLOBAL PLANNERS // http://wiki.ros.org/nav_core --> <!-- global_planner/GlobalPlanner // navfn/NavfnROS // carrot_planner/CarrotPlanner --> <arg name = "base_global_planner" default = "global_planner/GlobalPlanner"/> <!-- LOCAL PLANNERS // http://wiki.ros.org/nav_core --> <arg name = "base_local_planner" default = "dwa_local_planner/DWAPlannerROS"/>
Launch the default launch file with the following arguments:
roslaunch macbot_gazebo default.launch world:=maze rviz_config:=navigation
Then in the second tab, launch the amcl node:
roslaunch macbot_navigation amcl.launch map_arg:=map_name
If we want to include localization, we'll launch the following command. Make sure to pass in the map argument:
roslaunch macbot_navigation localization.launch map_arg:=map_name
On RViz, go ahead and publish a 2D nav goal. Sometimes the robot may get stuck navigating a corner. Publish another 2D nav goal to adjust the robot's position.
Getting autnomous path planning navigation to work on the MacBot is a bit more trickier, due to our lack of accurate odometry. We'll be using the laser_scan_matcher to get geometry_msgs/PoseStamped
data and convert it to nav_msgs/Odometry
. The rqt_graph
can be seen below to gain a better understanding of how all the nodes are set up.
First, we'll launch our differential drive node:
roslaunch macbot_physical diff_drive.launch
Next, we'll launch our LiDAR sensor. Make sure we pass true
for our publish TF argument. This will let the laser_scan_matcher node publish the TF link between odom
and base_link
.
roslaunch macbot_sensors lidar.launch pub_tf:=true
Then let's launch pose_odom.py
, which converts the geometry_msgs/PoseStamped
we get from laser_scan_matcher
to nav_msgs/Odometry
, essentially giving us some odometry data to work with. Note that this isn't super highly accurate, but it works surprisingly well for our simple use cases.
rosrun macbot_sensors pose_odom.py
Finally let's run our move_base
and amcl
node for path planning.
roslaunch macbot_navigation amcl_macbot.launch