Help us build the Aqua wiki. This is a shared effort by our research community. Note that to edit you should first set your real name.
ROStips
Recommended Practices for ROS development on Aqua
Contents
Command line fun
To be able to interact with AQUA through ROS, a little familiarity with [| ROS will go a along way. Once ROS nodes are running, one can interact with AQUA either using programs written in [| Python], [| CPP], or [| Lisp]; or simply using the command line. \\ Here are some examples. Note that these could be run either on the ocu or vision stack.
- Calibrate robot legs and put it in underwater swimmer mode. This is the fiurst thing we must do after turning the robot on.
->[@$ rosservice call /aqua/calibrate @]
- Swim forward for a few seconds
->[@$ rostopic pub -1 /aqua/command aquacore/Command -- 0.5 0 0 0 0 @] ->The last 5 numbers are : linear speed, yaw, pitch, roll, heave. all values are between -1 and 1
- Print state variables (depth)
->[@$ rostopic echo /aqua/state@]
- Set gait
->[@$ rosservice call /aqua/set_gait <gaitname> @] ->Where [@<gaitname> = midoff | hover | hover-midoff | alternate | sine | leftright | sinalt@]
- OLED Display
->[@$ rostopic pub -1 /aqua/display std_msgs/String "Hello World"@]
- Health status: battery voltage, current etc..
->[@$ rostopic echo /aqua/health@]
Autopilot and Depth control
Once calibrated, the robot enters underwater swimmer mode, and can be in one of the three states: Manual, Autopilot, or Autopilot+DepthControl. In manual mode, all commands are interpreted directly. In autopilot mode, the roll and pitch of the robot is automatically stablized. In autopilot+depthcontrol mode the robot also tries to maintain the desired depth by changing the pitch angle of the robot.
- Toggle autopilot (controls pitch and roll to keep robot level)
->[@$ rosservice call /aqua/enable_autopilot [true|false] @]
- Toggle automatic depth control(maintains current depth)
->[@$ rosservice call /aqua/enable_depthcontrol [true|false] @]
- Set Target Depth(depth control must be on)
->[@$ rosservice call /aqua/set_targetdepth xx@]
- To list all autpilot parameters:
->[@$ rosservice call /aqua/get_autopilot_params@]
- To set a param by:
->[@$ rosservice call /aqua/set_autopilot_params -- <K1> ... <K9>@]
- Extra notes:
- it is possible to disable the connection of the GuiParam to the Autopilot by setting the parameter DisableAutopilotParamGui to 1 in the appropriate .rc file.
Joystick control
- To use the joystick, plug it into the ocu, and run the following command
->[@$ roslaunch aquajoy joy.launch@]
Note that joystick control requires the autopilot to be running and the gait to be set to 'hover-midoff'.
Stop/Go
After you turn on the robot, and have calibrated (by making the service call /aqua/calibrate), the robot is by default in "GO" state. i.e., it will respond to commands given by the user and the autopilot. Even if you have given the robot 0 command (speed=0, yaw=0, roll=0, pitch=0, heave=0), the robot still might move because of the autopilot giving it commands. If you want to stop the robot completely, you must call the [@/aqua/stop@] service.
- [@$ rosservice call /aqua/stop@]
Once this is done, robot will not respond to any command from autopilot or the user. You must call [@/aqua/go@] service to resume operation.
- [@$ rosservice call /aqua/go@]
Cameras
images from the 3 cameras are available on the following topics:
- [@<prefix>/image_raw @]: raw bayer encoded images
- [@<prefix>/image_mono @]: bayer decoded mono image
- [@<prefix>/image_color @]: bayer decoded RGB images
- [@<prefix>/image_rect @]: rectified mono image (calibration file must be present)
- [@<prefix>/image_rect_color @]: rectified RGB images (calibration file must be present)
Here [@<prefix> = /aqua/back | /aqua/front/left | /aqua/front/right@] To get a live view, we can use the image_view node which comes with ROS imaging pipeline.\\ [@$ rosrun image_view image_view image:=/aqua/back/image_color @]
Tags
Several families of marker/tag have been used. Here we refer to AR tags, but this also applies to other kinds of marker. ARTags can be used to interact with users.
- [@$ rosservice call /aqua/ui/ask "start?"@]
->This will show a prompt with string "start?" on the display, and return the user's AR tag response. If the user canceled the question, then the service call fails, otherwise a boolean response is received.
- [@$ rostopic echo /aqua/tags ar_recog/Tags @]
->show the detected tag id(s), its distance and orientation.
Gazebo Simulator
To launch the gazebo simulator:
- [@$ roslaunch aqua_gazebo aqua.launch @]
An example launch file for joystick control in the simulator
- [@$ roslaunch aqualaunch sim_AP_joy.launch @]
Autostart Process on the vision stack.
- on bootup the Upstart script in /etc/init/aqua-ros.conf calls ~aqua/aqua/init/start_ros.sh
- Overall Process is: [@ boot -> networking started -> /etc/init/aqua-ros.conf -> ~aqua/aqua/init/start_ros.sh -> roslaunch aqualaunch aqua.launch@]
Other ROS pages and resources
See also ROS_stopstart and ROS_packages