Prototype project for Robotics NanoDegree
Provides a simulation of a quad drone for controls and deep learning exercises
The project features two main environments ('scenes') to experiment with:
- quad_indoor: a giant box sized 300m³, with a 1m tiling grid covering all sides.
- proto4: an outdoor city environment The city scene starts with a menu to choose between controlling the quad for the Controls and Deep Learning projects, and setting up to train the neural network for the Deep Learning project. In the training mode, a human character will spawn in a random place with a random appearance, and a camera follows the person around to record.
Firing up the executable
Find your OS's executable here
Either run from a terminal or edit the app properties, and append either the word indoor
or the word outdoor
(or city
) to the path. If nothing is specified, the indoor scene will be loaded.
For issues connecting the sim to your VM or host OS, see the troubleshooting section at the bottom.
Quad
quad_rotor/cmd_force
(subscribed), of type Wrenchquad_rotor/cmd_vel
(subscribed), of type Twistquad_rotor/pose
(published), of type PoseStampedquad_rotor/imu
(published), of type Imuquad_rotor/gravity
, of type SetBoolquad_rotor/x_force_constrained
, of type SetBoolquad_rotor/y_force_constrained
, of type SetBoolquad_rotor/z_force_constrained
, of type SetBoolquad_rotor/x_torque_constrained
, of type SetBoolquad_rotor/y_torque_constrained
, of type SetBoolquad_rotor/z_torque_constrained
, of type SetBoolquad_rotor/reset_orientation
, of type SetBoolquad_rotor/set_pose
, of type SetPose (see Project/Assets/Scripts/Ros/SetPose.srv)quad_rotor/clear_path
, of type SetBoolquad_rotor/set_path
, of type SetPath (see Project/Assets/Scripts/Ros/SetPath.srv)
Camera
quad_rotor/camera_pose_type
, of type SetInt (see Project/Assets/Scripts/Ros/SetInt.srv)quad_rotor/camera_distance
, of type SetFloat (see Project/Assets/Scripts/Ros/SetFloat.srv)
To publish an upward thrust of 0.1, use this format:
$ rostopic pub /quad_rotor/cmd_force geometry_msgs/Wrench "force:
x: 0.0
y: 0.0
z: 0.1
torque:
x: 0.0
y: 0.0
z: 0.0"
Note: if gravity is on, a force that small won't lift the quad off the ground
To turn on gravity, use the following:
$ rosservice call /quad_rotor/gravity "data: true"
F12
: toggle local control on/offWSAD (arrow keys)
: Move aroundSpace/C
: Thrust up/downQ/E
: Turn aroundScroll wheel
: zoom in/outRMB (hold & drag)
: Rotate cameraRMB (click)
: Reset cameraG
: Gravity on/offR
: Reset quad orientation1-4
: Switch camera views (Front/side/top/Iso)P
: Plot waypointO
: Begin following current pathI
: Clear all waypointsL
: Toggle this info on/offEsc
: Quit
- Fire up the executable with the city environment. Select
DL Training
from the menu - To begin recording, press
R
to bring up the dialog and choose where to save the recording. Select or create a convenient folder, such as in your Desktop or Documents, and confirm, and recording begins. - Images are captured from two cameras - one that sees the environment as you do, and one that sees in black&white as shown at the bottom right. The images are captured once every 3 seconds or so.
- To stop recording, press
R
again, or simply close the executable (Esc
)
ros_settings.txt
Included in the project and the executables is a config file named ros_settings.txt. This file can be used to control which IP the sim tries to connect to. Depending on your host OS and whether you're running Ros in a VM or locally, you may or may not need to modify this file for the sim to successfully talk to ros.
The file begins in a a format like this:
{
"vm-ip" : "192.168.30.111",
"vm-port" : 11311,
"vm-override" : true,
"host-ip": "0.0.0.0",
"host-override" : false
}
The first line:
"vm-ip" : "192.168.30.111",
Sets the IP where Ros is running.
"vm-port" : 11311,
This one is the port where Ros is running. You'll almost never need to modify this.
"vm-override" : true,
This controls whether the above info is used or not. If you run Ros in a VM, keep this to true. If you're running Ros locally, set it to false and sim will use 127.0.0.1.
"host-ip": "0.0.0.0",
This value can override the sim's IP to respond to requests if you're having trouble publishing or subscribing to topics, or calling services. This mostly happens when running the sim itself in Ubuntu or Debian, which have an entry in /etc/hosts linking your host's hostname to the address 127.0.1.1, which Ros (in the sim) usually has issues with. You could instead modify your hosts file, at your own risk.
"host-override" : false
If you need to change host-ip
, you'll want to set this to true.
If you modify any settings in the file, you'll need to stop and play (in the Editor) or relaunch the sim afterward.