Skip to content

Instantly share code, notes, and snippets.

@elimkwan

elimkwan/mrs.md Secret

Last active May 3, 2021 17:29
Show Gist options
  • Save elimkwan/f5e3c09187ee5dbe48e5740af9064707 to your computer and use it in GitHub Desktop.
Save elimkwan/f5e3c09187ee5dbe48e5740af9064707 to your computer and use it in GitHub Desktop.

Docker

sudo docker build -t ros-quad .

docker run -it \
--volume /home/elim/Documents/Cambridge-Master/Mobile-Robotics-Sys/mini/project:/root/hector_quadrotor_tutorial \
--env DISPLAY=$DISPLAY \
--env QT_X11_NO_MITSHM=1 \
--volume /tmp/.X11-unix/:/tmp/.X11-unix \
--gpus all \
--name mrs-mini ros-quad

docker run -it \
--volume /home/elim/Documents/Cambridge-Master/Mobile-Robotics-Sys/mini/code:/root/hector_quadrotor_tutorial \
--env DISPLAY=$DISPLAY \
--env QT_X11_NO_MITSHM=1 \
--volume /tmp/.X11-unix/:/tmp/.X11-unix \
--gpus all \
--name mrs-code ros-quad

docker exec -it mrs-code bash

xhost +local:root
xhost -local:root
docker exec -it mrs-mini bash

Additional Dependency

 apt-get install octomap_ros
 sudo apt-get install ros-kinetic-octomap-msgs ros-kinetic-octomap-mapping libgoogle-glog-dev ros-kinetic-control-toolbox protobuf-compiler protobuf-c-compiler

Setup hector quadrotor package:

cd ~/hector_quadrotor_tutorial
wstool init src https://raw.githubusercontent.com/tu-darmstadt-ros-pkg/hector_quadrotor/kinetic-devel/tutorials.rosinstall
sudo apt-get install ros-kinetic-geographic-info
sudo apt-key del 421C365BD9FF1F717815A3895523BAEEB01FA116
sudo -E apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
sudo apt clean && sudo apt update
sudo apt-get install ros-kinetic-gazebo-ros-control
sudo apt-get install ros-kinetic-teleop-twist-keyboard

Setup the project

cd ~/hector_quadrotor_tutorial
catkin_make
source devel/setup.bash
roslaunch hector_quadrotor_demo outdoor_flight_gazebo.launch
roslaunch hector_quadrotor_gazebo quadrotor_empty_world.launch

Enable the Motor on a separate terminal

source devel/setup.bash
rosservice call enable_motors true
rosrun teleop_twist_keyboard teleop_twist_keyboard.py

Clean

catkin_make clean

Add permission

sudo chmod -R a+w *

Get a system graph

rqt_graph

Add custom world

  • add duck.launch to hector_gazebo_world/launch
  • add duck.world to hector_gazebo_world/worlds
  • add duck.dae to hector_gazebo_world/Media

Launch custom duck world

roslaunch duck_demo duck_flight_gazebo.launch
roslaunch duck_controller duck_controller.launch
rosservice call /get_exploration_path

Making a node

  • If the first line of the node is set to the needed Shebang e.g. #!/usr/bin/env python,
  • and
  • the file is converted to an executable by changing the file properties e.g. chmod 755 filename (See here and other places on the web for details about chmod),

Create package

catkin_create_pkg [package name]
rosrun tf view_frames
rosmsg show geometry_msgs/Twist

View Octomap in Rviz

  • Set to "map"
  • add MarkerArray -> topic "occupied cell ..."

Running the Project with hector navigation

roslaunch duck_demo duck_flight_gazebo.launch
rosservice call enable_motors true
roslaunch hector_exploration_node exploration_planner.launch 
roslaunch duck_controller action_hector.launch
roslaunch octomap_server octomap_mapping.launch

Running the Project with rrt

roslaunch duck_demo duck_flight_gazebo.launch
rosservice call enable_motors true
roslaunch hector_exploration_node exploration_planner.launch 
roslaunch octomap_server octomap_mapping.launch
rosrun rrt_3d rrt_planner_node
roslaunch duck_controller action_rrt.launch
roslaunch duck_controller action_openloop.launch
Added GetRrtPath service to hector_nav_msg

If can't read GetRrtPath.h, try

sudo chmod -R a+w *
dpkg -L ros-kinetic-octovis
/opt/ros/kinetic/bin/octovis ~/hector_quadrotor_tutorial/hello_2.bt

Scheme 0 Predefined Route

roslaunch duck_demo duck_flight_gazebo.launch
rosservice call enable_motors true
roslaunch hector_exploration_node exploration_planner.launch 
roslaunch octomap_server octomap_mapping.launch
roslaunch duck_controller action_openloop.launch

Scheme 1 Random Walk

roslaunch duck_demo duck_flight_gazebo.launch
rosservice call enable_motors true
roslaunch hector_exploration_node exploration_planner.launch 
roslaunch octomap_server octomap_mapping.launch
roslaunch duck_controller action_astar.launch

set RViz to use world frame Set MarkerArray Set Path topic to twist and colour red

Scheme 2 Frontier Priority

roslaunch duck_demo duck_flight_gazebo.launch
rosservice call enable_motors true
roslaunch hector_exploration_node exploration_planner.launch 
roslaunch octomap_server octomap_mapping.launch
roslaunch duck_controller action_frontier.launch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment