Skip to content

Commit f1bf1e8

Browse files
committed
Merge pull request #25 from ethz-asl/feature/rename_planning_msgs
Rename planning messages, delete old ones
2 parents fae0655 + fecd9ff commit f1bf1e8

17 files changed

Lines changed: 89 additions & 127 deletions

mav_comm/package.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<author>Sammy Omari</author>
1212
<author>Michael Burri</author>
1313
<author>Fadri Furrer</author>
14+
<author>Helen Oleynikova</author>
1415

1516
<license>ASL 2.0</license>
1617

mav_msgs/package.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<author>Sammy Omari</author>
1212
<author>Michael Burri</author>
1313
<author>Fadri Furrer</author>
14+
<author>Helen Oleynikova</author>
1415

1516
<license>ASL 2.0</license>
1617

planning_msgs/CMakeLists.txt

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,29 @@
11
cmake_minimum_required(VERSION 2.8.3)
22
project(planning_msgs)
33

4-
find_package(catkin REQUIRED COMPONENTS geometry_msgs sensor_msgs message_generation octomap_msgs trajectory_msgs cmake_modules)
4+
find_package(catkin REQUIRED COMPONENTS geometry_msgs sensor_msgs message_generation mav_msgs trajectory_msgs cmake_modules)
55
find_package(Eigen REQUIRED)
66

77
include_directories(include ${catkin_INCLUDE_DIRS})
88
include_directories(${Eigen_INCLUDE_DIRS})
99

1010
add_message_files(
1111
FILES
12-
OctomapScan.msg
13-
PlanningResponse.msg
14-
WayPointArray.msg
15-
WayPoint.msg
16-
WaypointType.msg
17-
GPSWayPoint.msg
18-
GPSWayPointArray.msg
12+
PointCloudWithPose.msg
13+
PolynomialSegment4D.msg
14+
PolynomialTrajectory4D.msg
1915
)
2016

2117
add_service_files(
2218
FILES
2319
PlannerService.srv
24-
Octomap.srv
2520
)
2621

2722
generate_messages(
28-
DEPENDENCIES geometry_msgs sensor_msgs octomap_msgs trajectory_msgs
23+
DEPENDENCIES geometry_msgs sensor_msgs mav_msgs trajectory_msgs
2924
)
3025

3126
catkin_package(
3227
INCLUDE_DIRS include ${Eigen_INCLUDE_DIRS}
33-
CATKIN_DEPENDS message_runtime geometry_msgs sensor_msgs octomap_msgs trajectory_msgs
28+
CATKIN_DEPENDS message_runtime geometry_msgs sensor_msgs mav_msgs trajectory_msgs
3429
)

planning_msgs/include/planning_msgs/conversions.h

Lines changed: 50 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -23,79 +23,83 @@
2323
#include <geometry_msgs/Quaternion.h>
2424
#include <geometry_msgs/Vector3.h>
2525

26-
#include "planning_msgs/WayPoint.h"
27-
#include "planning_msgs/WayPointArray.h"
28-
#include "planning_msgs/WaypointType.h"
26+
#include "planning_msgs/PolynomialSegment4D.h"
27+
#include "planning_msgs/PolynomialTrajectory4D.h"
2928
#include "planning_msgs/eigen_planning_msgs.h"
3029

3130
namespace planning_msgs {
3231

33-
/// Converts a WayPoint double array to an Eigen::VectorXd.
34-
inline void vectorFromMsgArray(const WayPoint::_x_type& array,
32+
/// Converts a PolynomialSegment double array to an Eigen::VectorXd.
33+
inline void vectorFromMsgArray(const PolynomialSegment4D::_x_type& array,
3534
Eigen::VectorXd* x) {
3635
*x = Eigen::Map<const Eigen::VectorXd>(&(array[0]), array.size());
3736
}
3837

39-
/// Converts an Eigen::VectorXd to a WayPoint double array.
38+
/// Converts an Eigen::VectorXd to a PolynomialSegment double array.
4039
inline void msgArrayFromVector(const Eigen::VectorXd& x,
41-
WayPoint::_x_type* array) {
40+
PolynomialSegment4D::_x_type* array) {
4241
array->resize(x.size());
4342
Eigen::Map<Eigen::VectorXd> map =
4443
Eigen::Map<Eigen::VectorXd>(&((*array)[0]), array->size());
4544
map = x;
4645
}
4746

48-
/// Converts a WayPoint message to an EigenWayPoint structure.
49-
inline void eigenWaypointFromMsg(const WayPoint& msg, EigenWayPoint* waypoint) {
50-
assert(waypoint != NULL);
47+
/// Converts a PolynomialSegment message to an EigenPolynomialSegment structure.
48+
inline void eigenPolynomialSegmentFromMsg(
49+
const PolynomialSegment4D& msg, EigenPolynomialSegment* segment) {
50+
assert(segment != NULL);
5151

52-
vectorFromMsgArray(msg.x, &(waypoint->x));
53-
vectorFromMsgArray(msg.y, &(waypoint->y));
54-
vectorFromMsgArray(msg.z, &(waypoint->z));
55-
vectorFromMsgArray(msg.yaw, &(waypoint->yaw));
52+
vectorFromMsgArray(msg.x, &(segment->x));
53+
vectorFromMsgArray(msg.y, &(segment->y));
54+
vectorFromMsgArray(msg.z, &(segment->z));
55+
vectorFromMsgArray(msg.yaw, &(segment->yaw));
5656

57-
waypoint->time = msg.time;
58-
waypoint->type = msg.type;
57+
segment->segment_time_ns = msg.segment_time.toNSec();
58+
segment->num_coeffs = msg.num_coeffs;
5959
}
6060

61-
/// Converts a WayPointArray message to a EigenWayPointArray
62-
inline void eigenWaypointArrayFromMsg(const WayPointArray& msg,
63-
EigenWaypointArray* waypoint_array) {
64-
assert(waypoint_array != NULL);
65-
waypoint_array->clear();
66-
waypoint_array->reserve(msg.waypoints.size());
67-
for (WayPointArray::_waypoints_type::const_iterator it =
68-
msg.waypoints.begin();
69-
it != msg.waypoints.end(); ++it) {
70-
EigenWayPoint wp;
71-
eigenWaypointFromMsg(*it, &wp);
72-
waypoint_array->push_back(wp);
61+
/// Converts a PolynomialTrajectory message to a EigenPolynomialTrajectory
62+
inline void eigenPolynomialTrajectoryFromMsg(
63+
const PolynomialTrajectory4D& msg,
64+
EigenPolynomialTrajectory* eigen_trajectory) {
65+
assert(eigen_trajectory != NULL);
66+
eigen_trajectory->clear();
67+
eigen_trajectory->reserve(msg.segments.size());
68+
for (PolynomialTrajectory4D::_segments_type::const_iterator it =
69+
msg.segments.begin();
70+
it != msg.segments.end(); ++it) {
71+
EigenPolynomialSegment segment;
72+
eigenPolynomialSegmentFromMsg(*it, &segment);
73+
eigen_trajectory->push_back(segment);
7374
}
7475
}
7576

76-
/// Converts an EigenWayPoint to a WayPoint message. Does NOT set the header!
77-
inline void wayPointMsgFromEigen(const EigenWayPoint& waypoint, WayPoint* msg) {
77+
/// Converts an EigenPolynomialSegment to a PolynomialSegment message. Does NOT
78+
/// set the header!
79+
inline void polynomialSegmentMsgFromEigen(
80+
const EigenPolynomialSegment& segment, PolynomialSegment4D* msg) {
7881
assert(msg != NULL);
79-
msgArrayFromVector(waypoint.x, &(msg->x));
80-
msgArrayFromVector(waypoint.y, &(msg->y));
81-
msgArrayFromVector(waypoint.z, &(msg->z));
82-
msgArrayFromVector(waypoint.yaw, &(msg->yaw));
82+
msgArrayFromVector(segment.x, &(msg->x));
83+
msgArrayFromVector(segment.y, &(msg->y));
84+
msgArrayFromVector(segment.z, &(msg->z));
85+
msgArrayFromVector(segment.yaw, &(msg->yaw));
8386

84-
msg->time = waypoint.time;
85-
msg->type = waypoint.type;
87+
msg->segment_time.fromNSec(segment.segment_time_ns);
88+
msg->num_coeffs = segment.num_coeffs;
8689
}
8790

88-
/// Converts an EigenWayPointArray to a WayPointArray message. Does NOT set the
89-
/// header!
90-
inline void waypointArrayMsgFromEigen(const EigenWaypointArray& waypoint_array,
91-
WayPointArray* msg) {
91+
/// Converts an EigenPolynomialTrajectory to a PolynomialTrajectory message.
92+
/// Does NOT set the header!
93+
inline void polynomialTrajectoryMsgFromEigen(
94+
const EigenPolynomialTrajectory& eigen_trajectory,
95+
PolynomialTrajectory4D* msg) {
9296
assert(msg != NULL);
93-
msg->waypoints.reserve(waypoint_array.size());
94-
for (EigenWaypointArray::const_iterator it = waypoint_array.begin();
95-
it != waypoint_array.end(); ++it) {
96-
WayPoint wp;
97-
wayPointMsgFromEigen(*it, &wp);
98-
msg->waypoints.push_back(wp);
97+
msg->segments.reserve(eigen_trajectory.size());
98+
for (EigenPolynomialTrajectory::const_iterator it = eigen_trajectory.begin();
99+
it != eigen_trajectory.end(); ++it) {
100+
PolynomialSegment4D segment;
101+
polynomialSegmentMsgFromEigen(*it, &segment);
102+
msg->segments.push_back(segment);
99103
}
100104
}
101105
}

planning_msgs/include/planning_msgs/eigen_planning_msgs.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,19 @@
2424

2525
namespace planning_msgs {
2626

27-
struct EigenWayPoint {
28-
EigenWayPoint() : time(0.0), type(0){};
27+
struct EigenPolynomialSegment {
28+
EigenPolynomialSegment() : segment_time_ns(0), num_coeffs(0) {};
2929

3030
Eigen::VectorXd x;
3131
Eigen::VectorXd y;
3232
Eigen::VectorXd z;
3333
Eigen::VectorXd yaw;
34-
double time;
35-
int type;
34+
uint64_t segment_time_ns;
35+
int num_coeffs;
3636
};
3737

38-
typedef std::vector<EigenWayPoint> EigenWaypointArray;
38+
typedef std::vector<EigenPolynomialSegment> EigenPolynomialTrajectory;
39+
3940
}
4041

4142
#endif

planning_msgs/msg/GPSWayPoint.msg

Lines changed: 0 additions & 12 deletions
This file was deleted.

planning_msgs/msg/GPSWayPointArray.msg

Lines changed: 0 additions & 2 deletions
This file was deleted.

planning_msgs/msg/PlanningResponse.msg

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Header header
2+
int32 num_coeffs # order of the polynomial + 1, should match size of x[]
3+
duration segment_time # duration of the segment
4+
float64[] x # coefficients for the x-axis, INCREASING order
5+
float64[] y # coefficients for the y-axis, INCREASING order
6+
float64[] z # coefficients for the z-axis, INCREASING order
7+
float64[] yaw # coefficients for the yaw, INCREASING order

0 commit comments

Comments
 (0)