Rviz plugins package for showing custom info. currently there are five plugins: the Battery which shows the battery's left charge in text and symbolizing battery; the Navi_waypoints which allows user add multiple navigation targets with interactive markers; the Teleop which publishes the twist message through GUI; and the panel Map_saver which helps user to save map directly by RViz without typing command in terminal; the Video_stream which derived from default image plugin with extended stream sources like webcam, IP stream, and video file.
- Battery
- Navi_waypoints
- Teleop
- Map_saver
- Video_stream
- Navi_namespace
- Build
- Use Battery
- Use Navi_waypoints
- Use Teleop
- Use Map_saver
- Use Video_stream
- Use Navi_namespace
Plugin Battery is a derived class from MessageFilterDisplay:
It subscribes message "whi_interfaces::WhiBattery". Here is the definition of such message:
std_msgs/Header header
uint16 soc
uint8 STA_NORMAL=0
uint8 STA_CHARGING=1
uint8 STA_NEED_CHARGING=2
int8 state
The base of the charge text will be at the frame listed in the header of the WhiBattery message, which let the charge info stick to robot and move with it. Besides under multiple robots senario, frame with namespace enable each robot bearing its own charge info.
Plugin Navi_waypoints derives from class rviz::Display, and creates a panel for waypoints interaction logic:
From version 00.09 it supports the namespace for manipulating multiple robots simultaneously:
Teleop's function is same as the one operated through terminal but with graphic interaction which can be more convenient in senario like mapping. User can navigate the robot directly through the mapping's RViz window without opening another terminal:
Map_saver is a panel type plugin. It can help user to save map directly through the mapping's RViz window without typing save commands in another terminal:
This plugin derived from the default image plugin with extended stream sources including webcam, IP stream, and video file:
This plugin dervied from the PoseTool, and extended to functionalities with both 2D Pose Estimate and 2D Nav goal. With this plugin user can navigate specified robot by GUI rather than laborious texting by Tool Properties:
Clone package whi_interfaces
and whi_rviz_plugins
to your workspace:
cd <your_workspace>/src
git clone https://github.com/xinjuezou-whi/whi_interfaces.git
git clone https://github.com/xinjuezou-whi/whi_rviz_plugins.git
cd ..
catkin build
or catkin_make
depends on your environment. And don't forget to source the bash:
source <your_workspace>/devel/setup.bash
- Publish the WhiBattery message
For a quick check, there is a test script, named send_test_msgs.py
under folder scripts
to publish simulated charge info interatively. Before running it, please make sure roscore is active:
roscore
and open a new terminal and run:
python src/whi_rviz_plugins/scripts/send_test_msgs.py
- Run rviz to add the Battery plugin
Click the "Add" button at the bottom of the "Displays" panel, then scrolling down through the available displays until you see "Battery" under package name "whi_rviz_plugins":
Once the Battery display is added to rviz, set the topic name of the display to a source of "whi_interfaces::WhiBattery". The topic is "test_bat" if you are running the "send_test_msgs.py".
Modify the offsets to the center of frame to adjust its local position:
Modify the orientation to the frame to adjust the direction of battery symbol, this is helpfull in navigation senario which is 2D view of XY plane:
Navigation robot should have a static TF link that directs to map. The belowing gif shows the static TF in robot's URDF(battery->base_link->map)
- Add the Navi_waypoints plugin to RViz
Click the "Add" button at the bottom of the "Displays" panel, then scrolling down through the available displays until you see "Navi_waypoints" under package name "whi_rviz_plugins":
- Add waypoints and adjust its position and orientation through interfactive marker
Remember to switch the mode from "Move Camera" to "Interact" to grand the accessiblity of waypoint marker
- Click "Execute" to start the multiple goal's navigation
Since the view orientation is top-down in navigation, multiple info are projected on map and overlay each other. If the interactive marker is happen to be overlaid by other info, it could not be accessed by user. Therefore the property marker height is introduced to make sure it is on the top of other info, so to be accessible.
It is suggested to set its height over the max of your robot, default is 1 meter
These two params on Navi_waypoints panel are used to set the duration between two adjacent goals. If the execution is set as loop mode, the stop span stands for the duration between the last goal and the first goal.
The duration is measured as time, so these two's unit are second. Both are within range -10800 to 10800. Negative duration means there is no stop between goals, and the current goal will be preempted x seconds ahead its arrival by the next goal. The positive means the stop duration between goals.
For the convenience, you can save the waypoints by clicking save button, and re-use them by button load. The waypoints file is saved as yaml format.
Under multiple robots senario, using the namespace drop list to set the namespace for specified robot.
- Add the Navi_waypoints plugin to RViz
Click the "Add" button at the bottom of the "Displays" panel, then scrolling down through the available displays until you see "Teleop" under package name "whi_rviz_plugins":
- click direction buttons or press keys to navigate the robot
keys definition
Keys are functional while the "Key" indicator is light on in green. If it is gray click the anywhere of the teleop panel to activate it.
This property toggles the publish of twist message. It is helpfull to avoid the collsion of cmd_vel while the plugin is added in navigation's configuration.
Add the Teleop panel by opening the "Panels" menu and then "Add New Panel" within that. This should bring up a Panel class chooser dialog, and select the "Map_saver" within whi_rviz_plugins":
Once the map is satified to you, just click the "Save" button to save it:
- Add the Video_stream plugin to RViz
Click the "Add" button at the bottom of the "Displays" panel, then scrolling down through the available displays until you see "Video_stream" under package name "whi_rviz_plugins":
- Specify the stream source
Source | Type | Example |
---|---|---|
Message | sensor_msgs::Image | ROS default image message |
Device | webcam | /dev/video1, just input the index of video device, like 1 in this example |
URL | IP video stream or video file | rtsp://xxxx or http://xxxx or https://xxxx and even a video file like /home/user/xxxx.mp4 |
- Add the Navi_namespace plugin to RViz
Click the "+" icon at the tool bar, then scrolling down through the available tools until your see "Navi_namespace" under package name "whi_rviz_plugins":
- Add namespace
Input namespace in combox, then click button "Add". If namespace is added successfully, the Navi_namespace panel will show the total count of added namespaces:
- Toggle between Initial Pose and Navi Goal for setting initial pose and sending out navigation goal: