Skip to content

Commit b156260

Browse files
ros2: update services and launch files to enable PX4 example (#27)
* ros2: update terrain_planner launch file and rviz config - Update mavros launch file for ardupilot - Update rviz config to use descriptive names for markers - Add groups in rviz config - Update use of mesh resource in publish vehicle pose - Use file:// prefix on fully qualified resource path. - Update rviz config file to display paths by defaults Signed-off-by: Rhys Mainwaring <[email protected]> * ros2: update terrain_navigation_ros services and launch files - Update launch file for ardupilot - Install config folder. - Add Python launch file for mavros. - Add ardupilot sitl node. - Update mavros launch file for ardupilot - Update async service calls - Change QoS to best effort for some mavros subscriptions - Move and install resource directory - Add latching qos for grid map. - Update launch file for terrain planner - Fix typo in resources path. - Add Python launch file for visualize_path. - Use mode GUIDED for off-board control - Update formatting - Update terrain planner launch to use quadplane - Add sample mission - Move implementation of geo_conversions and visualization into cpp - Update use of mesh resource in publish vehicle pose - Use file:// prefix on fully qualified resource path. - Add todo notes to terrain_planner_ros - Add separate launch file for running ardupilot sitl - Allow the terrain planner to be run in isolation - Update planning duration calculation - Ensure rclcpp::Time variables are initialised to consistent time sources - Update example mission to include NAV_LOITER_UNLIM required by planner - Add further comments and reduce debug print output - Accept all NAV_LOITER command codes in terrain planner - Print global origin details - Update home location in launch scripts - Add px4 config to mavros launch script - Sync guidance constants with values used for px4 standard_vtol - Disable sitl_dds in terrain planner launch - Declare altitude control variables as node parameters - Declare params before topics in terrain planner node - Add alt control launch args to terrain planner launch script - Clean up terrain planner ros launch files - Add px4 loiter mission for davos - Remove unused publishers - Document the reason for the conversions used in the global origin callback. - Simplify the example ArduPilot mission. - Add takeoff to ArduPilot davosdorf mission. - Add Python node to relay from /mavros/set_point/global to /ap/cmd_gps_pose. - Update relay from /mavros/set_point/global to /ap/cmd_gps_pose. Signed-off-by: Rhys Mainwaring <[email protected]> * ros2: update mav_planning_rviz planning panel and service calls - Build standalone example. - Add test rviz config for plugin. - Fix unused variable warning. - Remap grid_map_geo elevation_map to grid_map used in mav_planning_rviz. - Use display context to set fixed frame in mav_planning_rviz - Use mode GUIDED for off-board control - Add debug logging for interactive markers - Update formatting in goal_marker - Add mutex to planning panel - Move inlined functions to cpp in goal_marker - Revert plugin to issue px4 offboard commands Signed-off-by: Rhys Mainwaring <[email protected]> * ros2: satisfy code checks for terrain_planner Signed-off-by: Rhys Mainwaring <[email protected]> * ros2: satisfy code checks for mav_planning_rviz Signed-off-by: Rhys Mainwaring <[email protected]> * ros2: satisfy code checks for terrain_navigation Signed-off-by: Rhys Mainwaring <[email protected]> * ros2: satisfy code checks for terrain_navigation_ros Signed-off-by: Rhys Mainwaring <[email protected]> * ros2: satisfy code checks for terrain_planner_benchmark Signed-off-by: Rhys Mainwaring <[email protected]> * ros2: contruct goal marker on initialize Use Rviz node for interactive markers This solves the problem of interactive markers not registering properly in rviz * ros2: add shebang to global_position_relay script. Signed-off-by: Rhys Mainwaring <[email protected]> * ros2: upstream interface changes to grid_map_geo Signed-off-by: Rhys Mainwaring <[email protected]> --------- Signed-off-by: Rhys Mainwaring <[email protected]> Co-authored-by: Jaeyoung Lim <[email protected]>
1 parent 526677f commit b156260

File tree

71 files changed

+2351
-1651
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+2351
-1651
lines changed

mav_planning_rviz/CMakeLists.txt

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,13 @@ target_compile_definitions(${PROJECT_NAME} PRIVATE "RVIZ_DEFAULT_PLUGINS_BUILDIN
107107

108108
pluginlib_export_plugin_description_file(rviz_common plugins_description.xml)
109109

110-
# add_executable(standalone_test
111-
# src/standalone_test.cpp
112-
# )
110+
add_executable(standalone_test
111+
src/standalone_test.cpp
112+
)
113113

114-
# target_link_libraries(standalone_test PUBLIC
115-
# ${PROJECT_NAME}
116-
# )
114+
target_link_libraries(standalone_test PUBLIC
115+
${PROJECT_NAME}
116+
)
117117

118118
# Install
119119
install(
@@ -139,11 +139,17 @@ ament_export_dependencies(
139139
rclcpp
140140
)
141141

142-
# install(
143-
# TARGETS
144-
# standalone_test
145-
# DESTINATION lib/${PROJECT_NAME}
146-
# )
142+
install(
143+
TARGETS
144+
standalone_test
145+
DESTINATION lib/${PROJECT_NAME}
146+
)
147+
148+
install(DIRECTORY
149+
launch
150+
rviz
151+
DESTINATION share/${PROJECT_NAME}/
152+
)
147153

148154
if(BUILD_TESTING)
149155
# find_package(ament_lint_auto REQUIRED)

mav_planning_rviz/include/mav_planning_rviz/edit_button.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
#define MAV_PLANNING_RVIZ_EDIT_BUTTON_H_
33

44
#ifndef Q_MOC_RUN
5-
#include <mav_msgs/eigen_mav_msgs.hpp>
65
#include <QPushButton>
76
#include <QWidget>
7+
#include <mav_msgs/eigen_mav_msgs.hpp>
88
#endif
99

1010
namespace mav_planning_rviz {

mav_planning_rviz/include/mav_planning_rviz/goal_marker.h

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,24 @@
22
#ifndef MAV_PLANNING_RVIZ_GOAL_MARKER_H_
33
#define MAV_PLANNING_RVIZ_GOAL_MARKER_H_
44

5-
#include <mutex>
5+
#include <visualization_msgs/msg/interactive_marker_feedback.h>
66

77
#include <Eigen/Dense>
8-
#include <rclcpp/rclcpp.hpp>
9-
10-
#include <grid_map_msgs/msg/grid_map.hpp>
11-
#include <interactive_markers/interactive_marker_server.hpp>
12-
#include <visualization_msgs/msg/interactive_marker_feedback.h>
138
#include <grid_map_core/GridMap.hpp>
9+
#include <grid_map_msgs/msg/grid_map.hpp>
1410
#include <grid_map_ros/GridMapRosConverter.hpp>
11+
#include <interactive_markers/interactive_marker_server.hpp>
12+
#include <mutex>
13+
#include <rclcpp/rclcpp.hpp>
1514

1615
class GoalMarker {
1716
public:
1817
GoalMarker(rclcpp::Node::SharedPtr node);
1918
virtual ~GoalMarker();
20-
Eigen::Vector3d getGoalPosition() { return goal_pos_; };
19+
Eigen::Vector3d getGoalPosition();
2120

2221
private:
23-
Eigen::Vector3d toEigen(const geometry_msgs::msg::Pose &p) {
24-
Eigen::Vector3d position(p.position.x, p.position.y, p.position.z);
25-
return position;
26-
}
22+
Eigen::Vector3d toEigen(const geometry_msgs::msg::Pose &p);
2723
void processSetPoseFeedback(const visualization_msgs::msg::InteractiveMarkerFeedback::ConstSharedPtr &feedback);
2824
void GridmapCallback(const grid_map_msgs::msg::GridMap &msg);
2925

mav_planning_rviz/include/mav_planning_rviz/planning_interactive_markers.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22
#define MAV_PLANNING_RVIZ_PLANNING_INTERACTIVE_MARKERS_H_
33

44
#include <functional>
5-
65
#include <interactive_markers/interactive_marker_server.hpp>
7-
#include <rclcpp/rclcpp.hpp>
8-
96
#include <mav_msgs/conversions.hpp>
107
#include <mav_msgs/eigen_mav_msgs.hpp>
8+
#include <rclcpp/rclcpp.hpp>
119

1210
namespace mav_planning_rviz {
1311

mav_planning_rviz/include/mav_planning_rviz/planning_panel.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
#define MAV_PLANNING_RVIZ_PLANNING_PANEL_H_
33

44
#ifndef Q_MOC_RUN
5+
//! @todo(srmainwaring) prevent race condition with async service calls
6+
#include <QGroupBox>
7+
#include <mutex>
58
#include <nav_msgs/msg/odometry.hpp>
69
#include <planner_msgs/msg/navigation_status.hpp>
710
#include <rclcpp/rclcpp.hpp>
8-
911
#include <rviz_common/panel.hpp>
1012

11-
#include <QGroupBox>
1213
#include "mav_planning_rviz/edit_button.h"
1314
#include "mav_planning_rviz/goal_marker.h"
1415
#include "mav_planning_rviz/planning_interactive_markers.h"
@@ -100,6 +101,9 @@ class PlanningPanel : public rviz_common::Panel {
100101

101102
std::shared_ptr<GoalMarker> goal_marker_;
102103

104+
//! @todo(srmainwaring) prevent race condition with async service calls
105+
std::mutex node_mutex_; // protects node_
106+
103107
// QT stuff:
104108
QLineEdit* namespace_editor_;
105109
QLineEdit* planner_name_editor_;

mav_planning_rviz/include/mav_planning_rviz/pose_widget.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
#define MAV_PLANNING_RVIZ_POSE_WIDGET_H_
33

44
#ifndef Q_MOC_RUN
5-
#include <mav_msgs/eigen_mav_msgs.hpp>
65
#include <QItemDelegate>
76
#include <QLineEdit>
87
#include <QStringList>
98
#include <QTableWidget>
9+
#include <mav_msgs/eigen_mav_msgs.hpp>
1010
#endif
1111

1212
class QLineEdit;
Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
11
<launch>
2-
<arg name="visualization" default="true"/>
2+
<arg name="location" default="davosdorf"/>
3+
<arg name="rviz" default="true"/>
34

4-
<group if="$(arg visualization)">
5-
<node type="rviz" name="rviz" pkg="rviz" args="-d $(find terrain_planner)/launch/config.rviz" output="screen"/>
6-
</group>
5+
<node pkg="tf2_ros" exec="static_transform_publisher" name="world_map" args="--frame-id world --child-frame-id map"/>
6+
7+
<node pkg="grid_map_geo" exec="test_tif_loader" name="test_tif_loader" output="screen">
8+
<param name="tif_path" value="$(find-pkg-share terrain_navigation_ros)/resources/davosdorf.tif"/>
9+
<param name="tif_color_path" value="$(find-pkg-share terrain_navigation_ros)/resources/davosdorf_color.tif"/>
10+
<remap from="elevation_map" to="grid_map" />
11+
</node>
12+
13+
<group if="$(var rviz)">
14+
<node pkg="rviz2" exec="rviz2" name="rviz2" args="-d $(find-pkg-share mav_planning_rviz)/rviz/config.rviz" output="screen"/>
15+
</group>
716
</launch>

mav_planning_rviz/rviz/config.rviz

Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
Panels:
2+
- Class: rviz_common/Displays
3+
Help Height: 0
4+
Name: Displays
5+
Property Tree Widget:
6+
Expanded: ~
7+
Splitter Ratio: 0.5
8+
Tree Height: 290
9+
- Class: rviz_common/Selection
10+
Name: Selection
11+
- Class: rviz_common/Tool Properties
12+
Expanded:
13+
- /2D Pose Estimate1
14+
- /Publish Point1
15+
Name: Tool Properties
16+
Splitter Ratio: 0.5886790156364441
17+
- Class: rviz_common/Views
18+
Expanded:
19+
- /Current View1
20+
Name: Views
21+
Splitter Ratio: 0.5
22+
- Class: rviz_common/Time
23+
Experimental: false
24+
Name: Time
25+
SyncMode: 0
26+
SyncSource: ""
27+
- Class: mav_planning_rviz/PlanningPanel
28+
Name: PlanningPanel
29+
namespace: ""
30+
odometry_topic: ""
31+
planner_name: davosdorf
32+
planning_budget: 4
33+
Visualization Manager:
34+
Class: ""
35+
Displays:
36+
- Alpha: 0.5
37+
Cell Size: 1000
38+
Class: rviz_default_plugins/Grid
39+
Color: 160; 160; 164
40+
Enabled: true
41+
Line Style:
42+
Line Width: 0.029999999329447746
43+
Value: Lines
44+
Name: Grid
45+
Normal Cell Count: 0
46+
Offset:
47+
X: 0
48+
Y: 0
49+
Z: 0
50+
Plane: XY
51+
Plane Cell Count: 10
52+
Reference Frame: <Fixed Frame>
53+
Value: true
54+
- Alpha: 0.8999999761581421
55+
Autocompute Intensity Bounds: true
56+
Class: grid_map_rviz_plugin/GridMap
57+
Color: 200; 200; 200
58+
Color Layer: color
59+
Color Transformer: ColorLayer
60+
Enabled: true
61+
Height Layer: elevation
62+
Height Transformer: Layer
63+
History Length: 1
64+
Invert Rainbow: false
65+
Max Color: 255; 255; 255
66+
Max Intensity: 10
67+
Min Color: 0; 0; 0
68+
Min Intensity: 0
69+
Name: GridMap
70+
Show Grid Lines: false
71+
Topic:
72+
Depth: 5
73+
Durability Policy: Volatile
74+
Filter size: 10
75+
History Policy: Keep Last
76+
Reliability Policy: Reliable
77+
Value: /grid_map
78+
Use Rainbow: true
79+
Value: true
80+
- Class: rviz_default_plugins/Marker
81+
Enabled: true
82+
Name: Marker
83+
Namespaces:
84+
{}
85+
Topic:
86+
Depth: 5
87+
Durability Policy: Volatile
88+
Filter size: 10
89+
History Policy: Keep Last
90+
Reliability Policy: Reliable
91+
Value: visualization_marker
92+
Value: true
93+
- Class: rviz_default_plugins/MarkerArray
94+
Enabled: true
95+
Name: MarkerArray
96+
Namespaces:
97+
{}
98+
Topic:
99+
Depth: 5
100+
Durability Policy: Volatile
101+
History Policy: Keep Last
102+
Reliability Policy: Reliable
103+
Value: visualization_marker_array
104+
Value: true
105+
Enabled: true
106+
Global Options:
107+
Background Color: 255; 255; 255
108+
Fixed Frame: map
109+
Frame Rate: 30
110+
Name: root
111+
Tools:
112+
- Class: rviz_default_plugins/Interact
113+
Hide Inactive Objects: true
114+
- Class: rviz_default_plugins/MoveCamera
115+
- Class: rviz_default_plugins/Select
116+
- Class: rviz_default_plugins/FocusCamera
117+
- Class: rviz_default_plugins/Measure
118+
Line color: 128; 128; 0
119+
- Class: rviz_default_plugins/SetInitialPose
120+
Covariance x: 0.25
121+
Covariance y: 0.25
122+
Covariance yaw: 0.06853891909122467
123+
Topic:
124+
Depth: 5
125+
Durability Policy: Volatile
126+
History Policy: Keep Last
127+
Reliability Policy: Reliable
128+
Value: /initialpose
129+
- Class: rviz_default_plugins/SetGoal
130+
Topic:
131+
Depth: 5
132+
Durability Policy: Volatile
133+
History Policy: Keep Last
134+
Reliability Policy: Reliable
135+
Value: /move_base_simple/goal
136+
- Class: rviz_default_plugins/PublishPoint
137+
Single click: true
138+
Topic:
139+
Depth: 5
140+
Durability Policy: Volatile
141+
History Policy: Keep Last
142+
Reliability Policy: Reliable
143+
Value: /clicked_point
144+
Transformation:
145+
Current:
146+
Class: rviz_default_plugins/TF
147+
Value: true
148+
Views:
149+
Current:
150+
Class: rviz_default_plugins/Orbit
151+
Distance: 8401.0107421875
152+
Enable Stereo Rendering:
153+
Stereo Eye Separation: 0.05999999865889549
154+
Stereo Focal Distance: 1
155+
Swap Stereo Eyes: false
156+
Value: false
157+
Focal Point:
158+
X: -515.1697998046875
159+
Y: 526.9537353515625
160+
Z: 855.5363159179688
161+
Focal Shape Fixed Size: true
162+
Focal Shape Size: 0.05000000074505806
163+
Invert Z Axis: false
164+
Name: Current View
165+
Near Clip Distance: 0.009999999776482582
166+
Pitch: 0.5897997617721558
167+
Target Frame: map
168+
Value: Orbit (rviz_default_plugins)
169+
Yaw: 5.818671703338623
170+
Saved: ~
171+
Window Geometry:
172+
Displays:
173+
collapsed: false
174+
Height: 950
175+
Hide Left Dock: false
176+
Hide Right Dock: true
177+
PlanningPanel:
178+
collapsed: false
179+
QMainWindow State: 000000ff00000000fd0000000400000000000002ad00000335fc020000000bfb0000001200530065006c0065006300740069006f006e00000001e10000009b0000006200fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000006600000171000000e300fffffffb0000001a0050006c0061006e006e0069006e006700500061006e0065006c01000001d8000001c30000016d00fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261fb0000000a0049006d006100670065010000020c000001b10000000000000000fb0000000c00540065006c0065006f00700000000368000000b20000000000000000000000010000010f00000317fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073000000007c00000317000000c600fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b2000000000000000000000002000005dc00000039fc0100000002fb0000000800540069006d00650100000000000005dc0000023d00fffffffb0000000a00560069006500770073030000004e00000080000002e10000019700000003000007800000014efc0100000001fb0000000800540069006d006501000000000000045000000000000000000000032e0000033500000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
180+
Selection:
181+
collapsed: false
182+
Time:
183+
collapsed: false
184+
Tool Properties:
185+
collapsed: false
186+
Views:
187+
collapsed: true
188+
Width: 1500
189+
X: 0
190+
Y: 25

mav_planning_rviz/src/edit_button.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1+
#include "mav_planning_rviz/edit_button.h"
2+
13
#include <QApplication>
24
#include <QDesktopWidget>
35
#include <QHeaderView>
46
#include <QTableView>
57
#include <QTableWidget>
68

7-
#include "mav_planning_rviz/edit_button.h"
8-
99
namespace mav_planning_rviz {
1010

1111
EditButton::EditButton(const std::string& id, QWidget* parent) : QWidget(parent), id_(id), editing_(false) {

0 commit comments

Comments
 (0)