Turtlebot3 Foxy NUC Perform Mapping and Navigation 20240227

From wikidb
Jump to: navigation, search

TBD: Navigation TBD: How the NUC was hooded up

References

reddit's NUC Headless Advice

As others have said, ssh server is the first thing you should install/enable. That will give you access to the command line.

You may also run graphical applications through ssh (login with ssh -X). Though it's not the most efficient way.

If you really need to run graphical applications remotely from the NUC then I recommend x2go server. It works out of the box (at least on debian does), without the need to edit configuration files. You can start a full X session or just run a specific app.

You'll need to install x2go client on the computers from which you want to connect.

Another approach is to use web-based managing interfaces such as cockpit. It's developed by redhat, but you'll find it in other distros as well.

RPi4 Headless Tutorial

TBD Move this Placeholder

Setup Up Remote Robot Driver Computer

A Linux PC

Setup Up The NUC On Robot Controller

On each terminal do the following

 iMac: edcepp$ ssh eepp@10.0.0.111 -X
     eepp@10.0.0.111's password: 
     Welcome to Ubuntu 20.04.2 LTS (GNU/Linux 5.4.0-169-generic x86_64)
 
 eepp@hood:~$ cd scripts

Bring up ROS2

Terminal 1

 eepp@hood:scripts$ ./bringup.sh
     [INFO] [launch]: All log files can be found below /home/eepp/.ros/log/2024-02-27-21-39-48-791564-hood-3478
     [INFO] [launch]: Default logging verbosity is set to INFO
     ...

Start Mapping

Terminal 2

 eepp@hood:scripts$ ./make_map.sh 
     [INFO] [launch]: All log files can be found below /home/eepp/.ros/log/2024-02-27-22-56-26-318465-hood-5878
     [INFO] [launch]: Default logging verbosity is set to INFO
     ...

TBD: Using the Robotis controller to control the motion of the robot. Using the xxx is another option: See keyboard_teleop.sh.

Save Map to File

This is being done in a new terminal window before the mapping program is exited. The file name is given on the command line. The name is written

Terminal 3

 eepp@hood:scripts$ ./save_map.sh filename
     [INFO] [1709092935.756165568] [map_saver]: 
       	map_saver lifecycle node launched. 
       	Waiting on external lifecycle transitions to activate
       	See https://design.ros2.org/articles/node_lifecycle.html for more information.
     [INFO] [1709092935.756336163] [map_saver]: Creating
     [INFO] [1709092935.756547217] [map_saver]: Saving map from 'map' topic to '/home/eepp/maps/filename' file
     [WARN] [1709092935.756584912] [map_saver]: Free threshold unspecified. Setting it to default value: 0.250000
     [WARN] [1709092935.756611544] [map_saver]: Occupied threshold unspecified. Setting it to default value: 0.650000
     [WARN] [map_io]: Image format unspecified. Setting it to: pgm
     [INFO] [map_io]: Received a 83 X 80 map @ 0.05 m/pix
     [INFO] [map_io]: Writing map occupancy data to /home/eepp/maps/filename.pgm
     [INFO] [map_io]: Writing map metadata to /home/eepp/maps/filename.yaml
     [INFO] [map_io]: Map saved
     [INFO] [1709092936.577029822] [map_saver]: Map saved successfully
     [INFO] [1709092936.577087239] [map_saver]: Destroying

Two files are written to the maps directory. In this case:

 eepp@hood:scripts$ ls -l ../maps/filename*
     -rw-rw-r-- 1 eepp eepp 57135 Feb 27 16:35 ../maps/filename.pgm
     -rw-rw-r-- 1 eepp eepp   143 Feb 27 16:35 ../maps/filename.yaml

 eepp@hood:scripts$ eog ../maps/excellent.pgm &

 eepp@hood:scripts$ cat ../maps/excellent.yaml 
     image: /home/eepp/maps/excellent.pgm
     mode: trinary
     resolution: 0.05
     origin: [-4.38, -3.28, 0]
     negate: 0
     occupied_thresh: 0.65
     free_thresh: 0.25

Shell Scripts

bringup.sh

 eepp@hood:scripts$ cat bringup.sh 
     #!/bin/bash
     # ece
  
     ros2 launch turtlebot3_bringup robot.launch.py

keyboard_teleop.sh

If using the driver conmputre with keyboard control

 eepp@hood:scripts$ cat keyboard_teleop.sh 
     #!/bin/bash
     # ece

     ros2 run turtlebot3_teleop teleop_keyboard

make_map.sh

 eepp@hood:scripts$ cat make_map.sh 
     #!/bin/bash
     # ece

     ros2 launch turtlebot3_cartographer cartographer.launch.py

save_map.sh

 eepp@hood:scripts$ cat save_map.sh 
     #!/bin/bash
     # ece
     #
     # save_map <map name>

     if [ $# -eq 1 ]
     then
        ros2 run nav2_map_server map_saver_cli -f ~/maps/$1
     else
        echo "save_map <map name>"
     fi