-
Create a new workspace or use an existing one:
mkdir -p ~/<your_ws_name>/src cd ~/<your_ws_name>/src
-
Clone the repository:
git clone https://github.com/ERIC-Robotics/logged_waypoint.git
-
Install dependencies:
rosdep install --from-paths src --ignore-src -r -y
-
Build the workspace:
cd ~/<your_ws_name> colcon build
-
Source the workspace:
source install/setup.bash
Before using the waypoint logger or follower, ensure the robot is navigating within the environment.
-
Run the waypoint logger:
ros2 run my_waypoint_package waypoint_logger
-
Teleoperate the robot: Move the robot using teleoperation:
ros2 run teleop_twist_keyboard teleop_twist_keyboard
-
Log waypoints:
- Press
1to save the current robot pose as a waypoint. - Once finished, press
qto save and exit. The waypoints are stored in the YAML file specified at line 14 of the code.
- Press
-
Example of a saved YAML file:
waypoints: - qw: 0.9999007126790602 qx: 0.0 qy: 0.0 qz: -0.014091301710897897 x: 0.5927034016440029 y: -0.05189323222673988 z: 0.0 - qw: 0.9997242203348151 qx: 0.0 qy: 0.0 qz: -0.02348368105613012 x: 1.6418638198667752 y: -0.10796116086388377 z: 0.0
-
Run the waypoint follower:
ros2 run my_waypoint_package logged_waypoint_follower
-
Behavior:
- The robot will navigate to each waypoint in the order they were logged.
- Ensure the
/amcl_posetopic provides accurate localization.
-
Start the Gazebo simulation:
ros2 launch turtlebot3_gazebo turtlebot3_world.launch.py
-
Launch the navigation stack:
ros2 launch turtlebot3_navigation2 navigation2.launch.py map:=<path_to_map>
-
If no map exists, create one:
- Launch SLAM:
ros2 launch turtlebot3_cartographer cartographer.launch.py use_sim_time:=true
- Save the map:
ros2 run nav2_map_server map_saver_cli -f mapname
- Launch SLAM:
-
Log waypoints:
- Start the logger:
ros2 run my_waypoint_package waypoint_logger
- Use teleoperation:
ros2 run teleop_twist_keyboard teleop_twist_keyboard
- Press
1to log waypoints andqto save and exit.
- Start the logger:
-
Follow waypoints:
ros2 run my_waypoint_package logged_waypoint_follower
- The waypoint logger saves waypoints to the YAML file at the location specified in line 14 of the logger script (
~/waypoints.yamlby default). - Ensure the
/amcl_posetopic is available and publishing valid localization data. - Test the setup in simulation before deploying on a real robot.