Skip to content

Warthog Teach and Repeat (ROS2)

Nicolas Lauzon edited this page Jul 11, 2024 · 4 revisions

connect to the robot wifi : Warthog_2GHz

wifi settings : http://192.168.0.1

Start the full Teach and Repeat stack with this script:

./wiln.sh

Note : This launches 4 screens (sensors, mapping, controller and wiln), make sure they are all running.

Trobleshooting for screens scripts :

Launch the nodes

  1. Create 3 screens using the command screen -S <name> of in 3 different terminals:
    • mapping
    • controller
    • wiln
  2. Join each screen using screen -r <name>
  3. Detach each screen : Ctrl+A D
  1. In mapping launch the node :
ros2 launch husky_mapping realtime_experiment_launch.xml
  1. In controller launch the node :
ros2 launch norlab_controllers_ros husky_mpc_launch.xml
  1. In wiln launch the node :
ros2 launch wiln husky_launch.xml

Open Foxglove WebSocket :

ws://warthog-high-level:8765

Load the Foxglove Warthog Layout (if needed) :

scp warthog-high-level:/home/robot/Warthog_TnR_Foxglove.json <your_local_path>

You can also download the new layout that adds button for the different actions inside the T&R.

Teach

Run the topic list for auto-complete :

ros2 topic list
  • Start recording the trajectory :
ros2 service call /start_recording std_srvs/srv/Empty
  • Stop recording the trajectory :
ros2 service call /stop_recording std_srvs/srv/Empty

Repeat

  • Start playing the trajectory :
ros2 service call /play_line std_srvs/srv/Empty
  • To clear the trajectory to repeat :
ros2 service call /clear_trajectory std_srvs/srv/Empty

To save the trajectory :

ros2 service call /save_map_traj wiln/srv/LoadMapTraj "file_name:
  data: '<name>.ltr'" 

To load the trajectory :

ros2 service call /load_map_traj wiln/srv/LoadMapTraj "file_name:
  data: '<name>.ltr'" 

Aliases

For convenience, aliases were created on the warthog in the .bashrc. Here are the definitions:

# WILN aliases
alias wiln_start_recording="ros2 service call /start_recording std_srvs/srv/Empty"
alias wiln_stop_recording="ros2 service call /stop_recording std_srvs/srv/Empty"
alias wiln_play_line="ros2 service call /play_line std_srvs/srv/Empty"
alias wiln_clear_trajectory="ros2 service call /clear_trajectory std_srvs/srv/Empty"
alias wiln_cancel_trajectory="ros2 service call /cancel_trajectory std_srvs/srv/Empty"

wiln_play_loop() {
    if [ -z "$1" ]; then
		echo "You need to pass provide the nummber of loop you wish to do"
	else
		ros2 service call /play_loop wiln/srv/PlayLoop "nb_loops:
  data: $1"
		echo "Repeat started for $1 loops."
	fi
}

wiln_load_map_traj() {
	if [ -z "$1" ]; then
		echo "You need to pass a file name to save the map and trajectory."
	else
		ros2 service call /load_map_traj wiln/srv/LoadMapTraj "file_name: 
    data: '$1.ltr'"
		echo "Map and trajectory loaded from $1.ltr"
	fi
}

wiln_save_map_traj() {
	if [ -z "$1" ]; then
		echo "You need to pass a file name to save the map and trajectory."
	else
        ros2 service call /save_map_traj wiln/srv/LoadMapTraj "file_name: 
    data: '$1.ltr'"
        echo "Map and trajectory saved to $1.ltr"
    fi 
}

Norlab's Robots

Protocols

Templates

Resources

Grants

Datasets

Mapping

Deep Learning

ROS

Ubuntu

Docker (work in progress)

Tips & tricks

Clone this wiki locally