Remember to:
- Read documentation
- Get submodules and other repositories
- Build and source the overlay if it doesn't work (should've already been done in the Dockerfile though)
- Have fun
Links:
Other repositories used in this project:
Networking (in this case using a mobile hotspot with IP 172.20.10.1/24) - inspiration from this blogpost:
- Connect Husky to network and set the connection priority to the lowest (to make sure it connects to the one intended)
- Check the Husky IP (e.g.
ifconfig): In this example it has inet / IP address172.20.10.2. - Set up the ROS network configurations as below:
On Robot PC:
On remote PC:
$ export ROS_IP=ip_of_this_machine $ export ROS_MASTER_URI=http://ip_of_this_machine:11311
$ export ROS_IP=ip_of_this_machine $ export ROS_MASTER_URI=http://ip_of_master:11311
- This is done by: Modifying
/etc/ros/setup.bashon Husky: Addexport ROS_MASTER_URI=http://172.20.10.2:11311andexport ROS_IP=172.20.10.2 - Connect remote PC (in this example with IP
172.20.10.3) to same network and do:export ROS_MASTER_URI=http://172.20.10.2:11311 export ROS_IP=172.20.10.3
- Verify by running
rostopic liston remote pc androstopic echosome topic like/husky_velocity_controller/cmd_vel - if firewall is blocking the connection disable it
ufw disable
In case the topics can be seen but not read (no output when using rostopic echo), the Husky ros nodes likely use a hostname for publishing.
- See hostname used for Husky nodes:
rosnode info <node-names>
- Add the hostname to the remote PCs hostnames in
/etc/hosts. In the husky example it should resolve the hostnamecpr-a200-0632to its correct IP (172.20.10.2).172.20.10.2 cpr-a200-0632
Setup on Husky (if not already done) - recommended to be done with screen, mouse, and keyboard:
- Disable EKF for IMU and wheels (in
/etc/ros/melodic/ros.d/base.launch) - Export URDF file with correct placement of realsense to
HUSKY_URDF_EXTRASvariable (this is done by modifying/etc/ros/setup.bashwhich is being run by/usr/sbin/ros-startscript) - If URDF is changed (or added) restart ROS by
sudo systemctl restart ros - Clone
orb_slam3_ros,realsense_ros, andpointcloud_to_gridrepositories to the home directory - Pull the docker images from dockerhub (
lucasmogsan/orbslam3_rosandlucasmogsan/realsense_ros1) - Connect to a common network which can be used by remote PC as well.
Start Husky with ORB-SLAM:
- Boot up the Husky (automatically starts ROS and the Husky drivers)
- (ssh onto the Husky from remote PC - find the IP by getting on same wifi and use nmap e.g.
nmap -sn 172.20.10.0/24) - (spin up container with ROS1 on remote pc and very same ROS_MASTER - Husky ROS_IP is set in
etc/ros/setup.bash) - Spin up docker containers for
orb_slam3_rosandrealsense_rosbydocker compose up devfrom their respective directories. - Launch the realsense node with specified parameters
roslaunch realsense2_camera rs_camera.launch color_width:=1280 color_height:=720 color_fps:=30 depth_width:=1280 depth_height:=720 depth_fps:=30 align_depth:=true- NB: USB must be USB 3.0 (blue) to account for the fast data-transfer.
- 640x480 resolution is launched by default
roslaunch realsense2_camera rs_camera.launch- NB: If using other resolution remember to change intrinsics in the config file
orb_slam3_ros/config/RGB-D/RealSense_D455.yaml. - The camera params can be read from topic
/camera/color/camera_info.
- NB: If using other resolution remember to change intrinsics in the config file
- Start ORB-SLAM
roslaunch orb_slam3_ros rs_rgbd.launch
Save ORB-SLAM trajectory:
Setup on Husky (if not done already):
- Clone
realsense_rosrepository to the home directory - Pull the docker image from dockerhub (
lucasmogsan/realsense_ros1)
Record ros-bag with realsense camera:
- Boot up Husky
- Spin up docker container with ROS on remote PC
- ssh onto Husky from remote PC
- Spin up docker container
realsense_rosfrom its directoryIn another terminalcd realsense_ros1_docker/ docker compose up devdocker exec -it realsense_ros1_docker-dev-1 bash roslaunch realsense2_camera rs_camera.launch - Launch the realsense node
roslaunch realsense2_camera rs_camera.launch - View from remote pc
rqt
- record rosbag from remote pc
Specific topic (preferred)
All topics (Note that newly published topics are discovered by periodically polling the master. rosbag record -a will likely miss initial messages published on any topic.)
rosbag record <topic-names> rosbag record /camera/depth/image_rect_raw
rosbag record -a
- Spin up both husky-sim and orb_slam3_ros containers
cd <folders> docker compose up dev
- launch the environment from husky_sim overlay_ws which also spawns the robot with the sensor (custom urdf).
./src/husky_custom/launch_office.sh
- launch ORB-SLAM from orb_slam3_ros overlay_ws without any pre-defined map.
roslaunch orb_slam3_ros rs_rgbd_sim.launch load_atlas:=false
- launch keyboard teleoperation of husky from husky_sim overlay_ws
rosrun teleop_twist_keyboard teleop_twist_keyboard.py
Generate map using the pointcloud_to_grid package (in orb_slam3_ros overlay_ws) and use this for navigation using ORB-SLAM and husky-navigation:
- launch pointcloud to grid from orb_slam3_ros overlay_ws.
roslaunch pointcloud_to_grid create_occupancy_grid.launch
- Save 3D ORB map
.osafrom ORB-SLAM (saves in theROS_HOMEfolder (~/.ros/by default)).rosservice call /orb_slam3/save_map orbmap_construction_site
- Alternatively save by the following to save to the orb_slam3_ros folder which is mounted from your PC.
rosservice call /orb_slam3/save_map ./../../../overlay_ws/src/orb_slam3_ros/maps/orbmap_construction_site
- Alternatively save by the following to save to the orb_slam3_ros folder which is mounted from your PC.
- Save 2D occupancy grid from the dynamic
pointcloud_to_gridreconfigure application.- Specify path (from within the container,
/overlay_ws/src/orb_slam3_ros/maps/is default), name (orbmap_construction_siteis default) and click save in the reconfigure application. - It saves a
.pgmand associating.yamlfile.
- Specify path (from within the container,
-
Make sure the occupancy
.pgmand.yamlfiles are inhusky_navigation_custom/mapsandamcl_husky.launchincludes correct path and file-name. -
Make sure the ORB map is located in
orb_slam3_ros/mapsandrs_rgbd_sim.launchincludes correct path and file-name. -
launch ORB-SLAM from orb_slam3_ros overlay_ws with
load_atlas_from_filepointing to the 3D ORB map.osa.roslaunch orb_slam3_ros rs_rgbd_sim.launch load_atlas:=true
- ! Remember to specify the correct path to the map in the launch file.
-
launch navigation from husky_sim overlay_ws
roslaunch husky_navigation_custom amcl_husky.launch
Simulate Husky in an empty world. You can add new objects to this world using the Gazebo controls (Gazebo Tutorial - Building a World).
roslaunch husky_gazebo empty_world.launchSimulate Husky in a Clearpath designed world. This is the base environment for the navigation tutorials. It will take some time to start, as the simulator will need to download resources from the Gazebo servers.
roslaunch husky_gazebo husky_playpen.launchPick your own world in which to simulate Husky (Using roslaunch with Gazebo).
roslaunch husky_gazebo husky_playpen.launchUsing RVIZ (requires not only ros-${ROS_DISTRO}-husky-simulator but also ros-${ROS_DISTRO}-husky-desktop to be installed)
roslaunch husky_viz view_robot.launchNB: ros-${ROS_DISTRO}-husky-navigation must be installed.
Possible to simulate stereo depth camera using the Openni Kinect plugin.
Realsense realsense2_camera and realsense2_description is installed.
A customized URDF file is created for the sensor.
To add this to the Husky simulation, set the HUSKY_URDF_EXTRAS environment variable
export HUSKY_URDF_EXTRAS=/overlay_ws/src/husky_custom/thesis_custom/urdf/realsense.urdf.xacroexport HUSKY_LMS1XX_ENABLED=1roslaunch cpr_office_gazebo office_world.launch platform:=huskyNB: The cpr_gazebo package can be heavy so we've copied only the office world to the husky_custom repository. To install all worlds add the cpr_gazebo as submodule.
to use with noetic maybe see: https://gitlab.gbar.dtu.dk/s184915/34763-autonomous-marine-robotics/-/tree/main/ros_ws/src/bluerov2
rosrun teleop_twist_keyboard teleop_twist_keyboard.pyOpen rviz with custom configuration file
rviz -d /overlay_ws/src/husky_custom/thesis_custom/rviz/simple_husky_rgbd.rvizInstall docker and docker compose
Docker: https://docs.docker.com/engine/install/
Docker compose: https://docs.docker.com/compose/install/
Build the image:
docker compose build devRun the container:
docker compose up devConnect to the container:
docker exec -it $NAME bashRemove everything, including stopped containers and all unused images (not just dangling ones):
docker system prune -aClone the repo with submodules:
git clone --recursive git@github.com:Lucasmogsan/husky_sim.gitAlternatively clone the repo and then get the submodules afterwards:
git clone git@github.com:Lucasmogsan/husky_sim.gitgit submodule update --init --recursiveThe main repo has references to the submodules. If these submodules are modified, then the main repo may need to update these references in order to pull the latest data.
git submodule update --remoteThis modifies the references in the main repo, and these changes needs to be committed and pushed.
Add:
cd packages
git submodule add git@github.com:Lucasmogsan/husky_custom.gitmaybe with --force
Remove: Go to folder containing
cd packages
git rm husky_custom/maybe with -f