ROS - Miscellaneous
ROS provides many tools and libraries (like RViz, mavros) of itself, which help towards interfacing with sensors, visualising robot etc. However, it also supports interfacing to various external libraries (like Gazebo and OpenCV), so that you can utilise them fully for your robot, without deviating much from ROS. Here is a list of all external libraries ROS currently provides interfacing to.
RViz (Robot Vision)
This youtube video on RViz describes the features of RViz in great details. RViz is a one stop solution for any kind of visualisation needed for robot sensors/tools. RViz supports most of standard message types of ROS, and you can even define a new message (basically a data structure) and integrate it accordingly with RViz.
With RViz, you can:
- Visualise various sensor messages: LaserScan for Leddar interfacing, Illuminance for Photometric interfacing etc
- Load up a map tile and get GPS coordinates of robot on it using: RViz_satellite along with mavros. Although, the official library for this, rqt_marble is still under development. Another third party library which works out nice is mapviz.
- Load up your robot's URDF, and interface IMU sensors on the robot to the Joint State Publisher, to visualise the data of IMU sensors: Building a Movable robot model with URDF
Gazebo is a tool to simulate various robotic algorithms before actually implementing them on hardware. Also helps testing of autonomous navigation algorithms like SLAM and others. The Gazebo tutorials are nicely documented and a good enough resource to learn about Gazebo. However, it might be suggested to use the husky robot of clearpath robotics, to get a feel about Gazebo, how and when to use it, before making your own URDF/SDF file. This is also well described in drive a husky tutorial.
Usage of SDF file over URDF in Gazebo
SDF files solve many problems of URDF. Shortcomings of URDF file and Why SDF over URDF?
However, one major disadvantage of SDF is that it cannot be used with RViz, and hence you cannot integrate sensors/joint state publishers if you use a SDF file to describe your robot. It is therefore, recommended to use URDF with RViz, and SDF with Gazebo.
URDF vs SDF, a neutral look
OpenCV interfacing with ROS
OpenCV library provides computer vision techniques having enormous applications in the field of robotics. Hence we interface ROS with OpenCV using vision_opencv.
Extracting frames from a video of an ip camera
ROS communicates data about images through it’s own image message type sensor_msgs/Image.
In cv2 library, use VideoCapture to capture video from the URL of the ip camera. Now use stream read functionality to read frames extracted. Now you are good to apply any processing techniques you want. For communicating images in ROS we have to convert OpenCV images to ROS image messages, this is achieved by cv_bridge.
Hence we can publish or subscribe image messages and convert them to OpenCV, perform the required processing and convert them back to ROS image messages for communicating between nodes.
More about using OpenCV with ROS
OpenCV documentation :http://docs.opencv.org/2.4/index.html
About CVBridge: http://wiki.ros.org/cv_bridge/Tutorials/ConvertingBetweenROSImagesAndOpenCVImagesPython.
So, basically to combine all separate windows of RViz, OpenCV, Joint State Publisher etc into one integrated window, RQt dashboard is used. RQt integrates all such using plugins, which is easy enough to follow from the Clearpath Robotics tutorial on setting up RQt Dashboard.