Skip to content

Chi-hong22/whi_rviz_plugins

 
 

Repository files navigation

whi_rviz_plugins

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

Plugin Battery is a derived class from MessageFilterDisplay:

battery

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.

Navi_waypoints

Plugin Navi_waypoints derives from class rviz::Display, and creates a panel for waypoints interaction logic: waypoints_im

From version 00.09 it supports the namespace for manipulating multiple robots simultaneously: multiple_waypoints

Teleop

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: teleop

Map_saver

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: mapsaver

Video_stream

This plugin derived from the default image plugin with extended stream sources including webcam, IP stream, and video file: stream

Navi_namespace

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: multiple

Build

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

Use battery

  1. 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 
  1. 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":

image

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".

image

image

Local position

Modify the offsets to the center of frame to adjust its local position:

local

Local orientation

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:

orientaion

image

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)

bat

Use Navi_waypoints

  1. 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":

image

  1. Add waypoints and adjust its position and orientation through interfactive marker

waypoints_add

Remember to switch the mode from "Move Camera" to "Interact" to grand the accessiblity of waypoint marker

  1. Click "Execute" to start the multiple goal's navigation

waypoints_execute

Marker Height property

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

Point/Stop Span params

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.

Save and Load

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.

Namespace

Under multiple robots senario, using the namespace drop list to set the namespace for specified robot.

Use Teleop

  1. 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":

image

  1. click direction buttons or press keys to navigate the robot

keys definition

Untitled Diagram drawio

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. activate

Enable Teleop property

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.

Use Map_saver

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":

image

Once the map is satified to you, just click the "Save" button to save it:

image

Use Video_stream

  1. 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":

image

  1. 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

Use Navi_namespace

  1. 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":

image

  1. 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:

image image

  1. Toggle between Initial Pose and Navi Goal for setting initial pose and sending out navigation goal:

toggle

About

Rviz plugins package for showing custom info

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 93.0%
  • CMake 6.3%
  • Python 0.7%