Gazebo simulation for Spiri web-services
Go to file
Riddhi Dave c7c4b74e12 Gazebo and Docker files 2020-12-15 08:45:15 -05:00
mybot_ws Gazebo and Docker files 2020-12-15 08:45:15 -05:00
Dockerfile Gazebo and Docker files 2020-12-15 08:45:15 -05:00
README.md Gazebo and Docker files 2020-12-15 08:45:15 -05:00
asound.conf Gazebo and Docker files 2020-12-15 08:45:15 -05:00
docker-command.sh Gazebo and Docker files 2020-12-15 08:45:15 -05:00
docker-entrypoint.sh Gazebo and Docker files 2020-12-15 08:45:15 -05:00
run_my_image.bash Gazebo and Docker files 2020-12-15 08:45:15 -05:00
spiri.ico Gazebo and Docker files 2020-12-15 08:45:15 -05:00
ubuntu_sim.sh Gazebo and Docker files 2020-12-15 08:45:15 -05:00
ubuntu_sim_ros_melodic.sh Gazebo and Docker files 2020-12-15 08:45:15 -05:00

README.md

Spiri workspace ros-gazebo simulation

The workspace is built with ros-melodic and gazebo9-gzweb on ubuntu 18

Project Description

src: Contains two main ros packages

spiri_gazebo: core package with all launch, world, and plugin scripts
spriri_teleop: python scripts to control spiri in gazebo simulation 

spiri_gazebo/launch/: launch files to start gazebo with world files namely citadel, ar_tag_world and spawn spiri
spiri_gazebo/world/: world files for gazebo 
spiri_gazebo/model/: Custom models for spiri world; it comprises with individual model for spiri, citadel, and all ar_tags
spiri_gazebo/include/: header files for cpp files(for plugins) in spiri_gazebo/src
spiri_gazebo/plugins/: These are .so files which are auto generated while building the workspace(with catkin_make) using cpp files (in ./src)
spiri_gazebo/src/: c++ files for plugins; for imu, cam, pid, and plugin_drone**
      plugin_drone.cpp: It is the core file for controlling and moving spiri in gazebo

spiri_teleop/src: Python files to control spiri
keyboard.py: Basic ros teleoperating python file to move spiri in world***
spiri_scrit1.py: Take off and climb to a specified altitude, then land
spiri_script2.py: Take off and climb to an altitude of 2 meters, rotate 90 degrees to the left, then 180 degrees to the right and finally 90 degrees to the left, then land
spiri_script3.py: Take off and climb to an altitude of 2 meters, at a speed of 0.5 meters/second, back 2 meters, move left 2 meters, move forward 2 meters, then return to the starting point going right 2 meters, and finally land
spiri_script4.py: Take off and climb to an altitude of 2 meters, repeat 4 times: (rotate 90 degrees to the right and then advance 2 meters at a speed of 0.5 meters/second), then land
spiri_script5.py: Python script to move spiri with respect to roll,pitch, and yaw
To stop script press cntrl + c. Publish land topic from terminal(rostopic pub /drone/land std_msgs/Empty "{}") or run spiri_keyboard.py and press 0 to land spiri.  

REFERENCES

** Tum_Simulator cpp plugin files
*** Keyboard teleoperation python file

Setup VNC viewer on your local machine

  • To read and view camera output of spiri get setup with VNC viewer. VNC viewer is available for multiple platforms, you can download it for your platform from RealVNC
  • Next, to connect to vnc server open vnc viewer and enter ip-address:5900 to view the rqt_image_view
  • Lastly, from first drop-down menu on rqt_image_view select '/drone/front_camera/image_raw'to view stream of camera plugin on spiri model

To Do List:

  • Gas Station world
  • AR Tag world
  • Citadel hill world
  • Roll pitch yaw command
  • x11vnc server and viewer for spiri camera view
  • spawn compressed spiri model from ../model/spiri_compressed

Installing Docker

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
apt-cache policy docker-ce
sudo apt-get install -y docker-ce
sudo systemctl status docker
sudo usermod -aG docker ${USER}

gazebo-web

Goal: Web accessible gazebo simulation with username/password authentication

Usage

Building Image:

To build an image, cd into the directory containing the Dockerfile and run the following, replacing $IMAGE_NAME with your desired image name:

docker build . -t $IMAGE_NAME

Creating Container

To create and run a new container based on this image, run the following command:

sudo docker run -d  --name ros-gazebo-container -p 4200:4200 -p 7681:7681 -p 8080:8080  --env="DISPLAY" --env="QT_X11_NO_MITSHM=1" -e SHELLINABOX_ALLOW_SUDO=1 -e SHELLINABOX_USER=riddhi -e SHELLINABOX_PASSWORD=abc ros-gazebo:latest

Be sure to replace $CONTAINER_NAME, $USERNAME, and $PASSWORD, with your desired values and $IMAGE_NAME with the value you used when building the image as described above.

Attach to Container

To attach a bash sesstion to your running container, use the following:

docker exec -it CONTAINER_NAME /bin/bash

You will now also be able to open a web browser to your host's public IP on port 4200 to access your bash session and on port 8080 to access GZWeb.

Running gazebo web client (gzweb) in browser

Open google chrome/firefox browser and navigate to localhost:4200 Enter username and password you used while creating container After successful login, run bash script ./init.sh to launch citadel hill world Open another tab to open localhost:8080. This open gazebo web client with spawned spiri and citadel hill To run the 5 scripts to control spiri in gazebo

rosrun spiti_teleop spiri_keyboard.py
rosrun spiri_teleop spiri_script1.py
rosrun spiri_teleop spiri_script5.py

**cntrl+c to abort the script