Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Visualize height of UAV (both esitamted state and ground truth) in rviz #83

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions jsk_mbzirc_tasks/config/task1.rviz
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Panels:
- /Global Options1
- /Status1
- /OverlayText1
- /OverlayText2
- /OverlayText3
Splitter Ratio: 0.5
Tree Height: 428
- Class: rviz/Selection
Expand Down Expand Up @@ -151,6 +153,42 @@ Visualization Manager:
text size: 32
top: 10
width: 500
- Background Alpha: 0.8
Background Color: 0; 0; 0
Class: jsk_rviz_plugin/OverlayText
Enabled: true
Foreground Alpha: 0.8
Foreground Color: 25; 255; 240
Name: OverlayText
Overtake Color Properties: true
Overtake Position Properties: true
Topic: /state_overlay
Value: true
font: DejaVu Sans Mono
height: 40
left: 10
line width: 2
text size: 24
top: 70
width: 250
- Background Alpha: 0.8
Background Color: 0; 0; 0
Class: jsk_rviz_plugin/OverlayText
Enabled: true
Foreground Alpha: 0.8
Foreground Color: 255; 0; 0
Name: OverlayText
Overtake Color Properties: true
Overtake Position Properties: true
Topic: /ground_truth_overlay
Value: true
font: DejaVu Sans Mono
height: 30
left: 10
line width: 2
text size: 18
top: 110
width: 200
Enabled: true
Global Options:
Background Color: 48; 48; 48
Expand Down
72 changes: 63 additions & 9 deletions jsk_mbzirc_tasks/config/task3.rviz
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
Panels:
- Class: rviz/Displays
Help Height: 78
Help Height: 0
Name: Displays
Property Tree Widget:
Expanded:
- /Global Options1
- /Status1
- /OverlayText1
- /OverlayText2
- /OverlayText3
Splitter Ratio: 0.5
Tree Height: 124
Tree Height: 202
- Class: rviz/Selection
Name: Selection
- Class: rviz/Tool Properties
Expand Down Expand Up @@ -113,7 +116,6 @@ Visualization Manager:
Size (m): 0.01
Style: Flat Squares
Topic: /UAV1/scan
Unreliable: false
Use Fixed Frame: true
Use rainbow: true
Value: true
Expand All @@ -125,10 +127,10 @@ Visualization Manager:
Overlay Alpha: 0.5
Queue Size: 2
Transport Hint: raw
Unreliable: false
Value: true
Visibility:
Grid: true
OverlayText: true
Remaining Time: true
UAV1 LaserScan: true
UAV1 RobotModel: true
Expand Down Expand Up @@ -196,7 +198,7 @@ Visualization Manager:
Max Color: 255; 255; 255
Max Intensity: 999999
Min Color: 0; 0; 0
Min Intensity: 0
Min Intensity: -6.80389e-27
Name: UAV2 LaserScan
Position Transformer: XYZ
Queue Size: 10
Expand All @@ -205,7 +207,6 @@ Visualization Manager:
Size (m): 0.01
Style: Flat Squares
Topic: /UAV2/scan
Unreliable: false
Use Fixed Frame: true
Use rainbow: true
Value: true
Expand All @@ -217,10 +218,10 @@ Visualization Manager:
Overlay Alpha: 0.5
Queue Size: 2
Transport Hint: raw
Unreliable: false
Value: true
Visibility:
Grid: true
OverlayText: true
Remaining Time: true
UAV1 Camera: true
UAV1 LaserScan: true
Expand Down Expand Up @@ -297,7 +298,6 @@ Visualization Manager:
Size (m): 0.01
Style: Flat Squares
Topic: /UAV3/scan
Unreliable: false
Use Fixed Frame: true
Use rainbow: true
Value: true
Expand All @@ -309,10 +309,10 @@ Visualization Manager:
Overlay Alpha: 0.5
Queue Size: 2
Transport Hint: raw
Unreliable: false
Value: true
Visibility:
Grid: true
OverlayText: true
Remaining Time: true
UAV1 Camera: true
UAV1 LaserScan: true
Expand Down Expand Up @@ -342,6 +342,60 @@ Visualization Manager:
text size: 64
top: 10
width: 370
- Background Alpha: 0.8
Background Color: 0; 0; 0
Class: jsk_rviz_plugin/OverlayText
Enabled: true
Foreground Alpha: 0.8
Foreground Color: 25; 255; 240
Name: OverlayText
Overtake Color Properties: true
Overtake Position Properties: true
Topic: /UAV1/ground_truth_overlay
Value: true
font: DejaVu Sans Mono
height: 30
left: 10
line width: 2
text size: 20
top: 10
width: 250
- Background Alpha: 0.8
Background Color: 0; 0; 0
Class: jsk_rviz_plugin/OverlayText
Enabled: true
Foreground Alpha: 0.8
Foreground Color: 25; 255; 240
Name: OverlayText
Overtake Color Properties: true
Overtake Position Properties: true
Topic: /UAV2/ground_truth_overlay
Value: true
font: DejaVu Sans Mono
height: 30
left: 10
line width: 2
text size: 20
top: 80
width: 250
- Background Alpha: 0.8
Background Color: 0; 0; 0
Class: jsk_rviz_plugin/OverlayText
Enabled: true
Foreground Alpha: 0.8
Foreground Color: 25; 255; 240
Name: OverlayText
Overtake Color Properties: true
Overtake Position Properties: true
Topic: /UAV3/ground_truth_overlay
Value: true
font: DejaVu Sans Mono
height: 30
left: 10
line width: 2
text size: 20
top: 150
width: 250
Enabled: true
Global Options:
Background Color: 48; 48; 48
Expand Down
17 changes: 13 additions & 4 deletions jsk_mbzirc_tasks/launch/jsk_mbzirc_task_1.launch
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,27 @@
<arg name="z" value="$(arg z)"/>
</include>

<!-- workaround until https://github.com/ros/ros_comm/pull/728 get released -->
<!-- workaround until https://github.com/ros/ros_comm/pull/728 get released -->
<!-- display time in rviz -->
<node pkg="jsk_mbzirc_tasks" name="remain_time_text_to_overlay" type="relay_field_728.py"
args="/remaining_time /remaining_time_overlay jsk_rviz_plugins/OverlayText
'text: m.data' --wait-for-start" />
'text: m.data' --wait-for-start" />
<!-- display uav state in rviz -->
<node pkg="jsk_mbzirc_tasks" name="uav_state_text_to_overlay" type="relay_field_728.py"
args="/state /state_overlay jsk_rviz_plugins/OverlayText
'text: [m.pose.pose.position.z, str]' --wait-for-start" />
<!-- display state in rviz -->
<node pkg="jsk_mbzirc_tasks" name="uav_ground_truth_text_to_overlay" type="relay_field_728.py" output="screen"
args="/ground_truth/state /ground_truth_overlay jsk_rviz_plugins/OverlayText
'text: [m.pose.pose.position.z, str]' --wait-for-start" />

<group unless="$(arg headless)" >
<node pkg="rviz" type="rviz" name="rviz" args="-d $(find jsk_mbzirc_tasks)/config/task1.rviz"/>

<node pkg="jsk_mbzirc_tasks" type="uav_teleop_keyboard" name="uav_teleop_keyboard"
launch-prefix="xterm -e">
<param name="teleopUGV" value="$(arg teleopUGV)"/>
<remap from="teleopUGV" to="uav_teleop_keyboard/teleopUGV"/>
<param name="teleopUGV" value="$(arg teleopUGV)"/>
<remap from="teleopUGV" to="uav_teleop_keyboard/teleopUGV"/>
</node>

</group>
Expand Down
28 changes: 27 additions & 1 deletion jsk_mbzirc_tasks/launch/jsk_mbzirc_task_3.launch
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@
<arg name="y" value="-25"/>
<arg name="z" value="0.3"/>
</include>
<!-- display uav state in rviz -->
<node pkg="jsk_mbzirc_tasks" name="uav_state_text_to_overlay" type="relay_field_728.py"
args="/$(arg uav1_name)/state /$(arg uav1_name)/state_overlay jsk_rviz_plugins/OverlayText
'text: [m.pose.pose.position.z, str]' --wait-for-start" />
<!-- display state in rviz -->
<node pkg="jsk_mbzirc_tasks" name="uav_ground_truth_text_to_overlay" type="relay_field_728.py"
args="/$(arg uav1_name)/ground_truth/state /$(arg uav1_name)/ground_truth_overlay jsk_rviz_plugins/OverlayText
'text: [m.pose.pose.position.z, str]' --wait-for-start" />
</group>
<group ns="$(arg uav2_name)">
<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch">
Expand All @@ -35,6 +43,14 @@
<arg name="y" value="-25"/>
<arg name="z" value="0.3"/>
</include>
<!-- display uav state in rviz -->
<node pkg="jsk_mbzirc_tasks" name="uav_state_text_to_overlay" type="relay_field_728.py"
args="/$(arg uav2_name)/state /$(arg uav2_name)/state_overlay jsk_rviz_plugins/OverlayText
'text: [m.pose.pose.position.z, str]' --wait-for-start" />
<!-- display state in rviz -->
<node pkg="jsk_mbzirc_tasks" name="uav_ground_truth_text_to_overlay" type="relay_field_728.py"
args="/$(arg uav2_name)/ground_truth/state /$(arg uav2_name)/ground_truth_overlay jsk_rviz_plugins/OverlayText
'text: [m.pose.pose.position.z, str]' --wait-for-start" />
</group>
<group ns="$(arg uav3_name)">
<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch">
Expand All @@ -45,10 +61,20 @@
<arg name="y" value="-25"/>
<arg name="z" value="0.3"/>
</include>
<!-- display uav state in rviz -->
<node pkg="jsk_mbzirc_tasks" name="uav_state_text_to_overlay" type="relay_field_728.py"
args="/$(arg uav3_name)/state /$(arg uav3_name)/state_overlay jsk_rviz_plugins/OverlayText
'text: [m.pose.pose.position.z, str]' --wait-for-start" />

<!-- display state in rviz -->
<node pkg="jsk_mbzirc_tasks" name="uav_ground_truth_text_to_overlay" type="relay_field_728.py"
args="/$(arg uav3_name)/ground_truth/state /$(arg uav3_name)/ground_truth_overlay jsk_rviz_plugins/OverlayText
'text: [m.pose.pose.position.z, str]' --wait-for-start" />

</group>

<!-- workaround until https://github.com/ros/ros_comm/pull/728 get released -->
<node pkg="jsk_mbzirc_tasks" name="remain_time_text_to_overlay" type="relay_field_728"
<node pkg="jsk_mbzirc_tasks" name="remain_time_text_to_overlay" type="relay_field_728.py"
args="/remaining_time /remaining_time_overlay jsk_rviz_plugins/OverlayText
'text: m.data' --wait-for-start" />

Expand Down
4 changes: 4 additions & 0 deletions jsk_mbzirc_tasks/script/relay_field_728.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import rostopic
import genpy
import std_msgs
import __builtin__

__author__ = '[email protected] (Kentaro Wada)'

Expand All @@ -38,6 +39,9 @@ def _eval_in_dict_impl(dict_, globals_, locals_):
type_ = type(v)
if type_ is dict:
res[k] = _eval_in_dict_impl(v, globals_, locals_)
elif (type_ is list):
val = eval(v[0], globals_, locals_)
res[k] = getattr(__builtin__, v[1])(val)
elif (type_ is str) or (type_ is unicode):
try:
res[k] = eval(v, globals_, locals_)
Expand Down