Skip to content

Commit 70203ff

Browse files
committed
Improvements to costmap and path message definitions, and downstream changes to support these.
1 parent 7c15eab commit 70203ff

File tree

17 files changed

+115
-147
lines changed

17 files changed

+115
-147
lines changed

src/control/src/DwaController.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ DwaController::~DwaController()
3030
}
3131

3232
TaskStatus
33-
DwaController::executeAsync(const FollowPathCommand::SharedPtr command)
33+
DwaController::executeAsync(const FollowPathCommand::SharedPtr /*command*/)
3434
{
3535
RCLCPP_INFO(get_logger(), "DwaController::executeAsync");
3636

src/nav2_msgs/msg/Costmap.msg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
std_msgs/Header header
44

55
# MetaData for the map
6-
CostmapMetaData info
6+
CostmapMetaData metadata
77

88
# The cost data, in row-major order, starting with (0,0).
99
uint8[] data

src/nav2_msgs/msg/CostmapMetaData.msg

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ builtin_interfaces/Time map_load_time
66
# The time of the last update to costmap
77
builtin_interfaces/Time update_time
88

9-
# The corresponding layer
9+
# The corresponding layer name
1010
string layer
1111

1212
# The map resolution [m/cell]
1313
float32 resolution
1414

15-
# Map width [cells]
16-
uint32 width
15+
# Number of cells in the horizontal direction
16+
uint32 size_x
1717

18-
# Map height [cells]
19-
uint32 height
18+
# Number of cells in the vertical direction
19+
uint32 size_y
2020

2121
# The origin of the costmap [m, m, rad].
2222
# This is the real-world pose of the cell (0,0) in the map.

src/nav2_msgs/msg/Path.msg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
std_msgs/Header header
22

33
# An array of poses that represents a Path for a robot to follow
4-
geometry_msgs/PoseStamped[] poses
4+
geometry_msgs/Pose[] poses

src/nav2_msgs/msg/PathEndPoints.msg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
std_msgs/Header header
22

33
# The start pose for the plan
4-
geometry_msgs/PoseStamped start
4+
geometry_msgs/Pose start
55

66
# The final pose of the goal
7-
geometry_msgs/PoseStamped goal
7+
geometry_msgs/Pose goal
88

99
# If the goal is obstructed, how many meters the planner can
1010
# relax the constraint in x and y before failing.

src/navigation/src/SimpleNavigator.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ SimpleNavigator::executeAsync(const NavigateToPoseCommand::SharedPtr /*command*/
4545
// Compose the PathEndPoints message for Navigation
4646
auto endpoints = std::make_shared<ComputePathToPoseCommand>();
4747
// TODO(mdjeroni): get the starting pose from Localization (fake it out for now)
48-
endpoints->start.pose.position.x = 1.0;
49-
endpoints->start.pose.position.y = 1.0;
50-
endpoints->goal.pose.position.x = 9.0;
51-
endpoints->goal.pose.position.y = 9.0;
48+
endpoints->start.position.x = 1.0;
49+
endpoints->start.position.y = 1.0;
50+
endpoints->goal.position.x = 9.0;
51+
endpoints->goal.position.y = 9.0;
5252
endpoints->tolerance = 2.0;
5353

5454
RCLCPP_INFO(get_logger(), "SimpleNavigator::executeAsync: getting the path from the planner");
@@ -94,9 +94,9 @@ SimpleNavigator::executeAsync(const NavigateToPoseCommand::SharedPtr /*command*/
9494
RCLCPP_INFO(get_logger(), "SimpleNavigator::executeAsync: got path of size %u",
9595
path->poses.size());
9696
int index;
97-
for (auto poseStamped : path->poses) {
97+
for (auto pose : path->poses) {
9898
RCLCPP_INFO(get_logger(), "SimpleNavigator::executeAsync: point %u x: %0.2f, y: %0.2f",
99-
index, poseStamped.pose.position.x, poseStamped.pose.position.y);
99+
index, pose.position.x, pose.position.y);
100100
index++;
101101
}
102102

src/planning/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ include_directories(
2020
include
2121
../task/include
2222
../world_model/include
23-
../costmap/include
23+
# ../util/costmap/include
24+
${costmap_INCLUDE_DIR}
2425
)
2526

2627
link_directories(${CMAKE_BINARY_DIR}/../libs)

src/planning/include/planning/DijkstraPlanner.hpp

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,17 @@ class DijkstraPlanner : public ComputePathToPoseTaskServer
3939
private:
4040
// Compute a plan given start and goal poses, provided in global world frame.
4141
bool makePlan(
42-
const geometry_msgs::msg::PoseStamped & start,
43-
const geometry_msgs::msg::PoseStamped & goal, double tolerance,
44-
std::vector<geometry_msgs::msg::PoseStamped> & plan);
42+
const geometry_msgs::msg::Pose & start,
43+
const geometry_msgs::msg::Pose & goal, double tolerance,
44+
nav2_msgs::msg::Path & plan);
4545

4646
// Compute the navigation function given a seed point in the world to start from
4747
bool computePotential(const geometry_msgs::msg::Point & world_point);
4848

4949
// Compute a plan to a goal from a potential - must call computePotential first
5050
bool getPlanFromPotential(
51-
const geometry_msgs::msg::PoseStamped & goal,
52-
std::vector<geometry_msgs::msg::PoseStamped> & plan);
51+
const geometry_msgs::msg::Pose & goal,
52+
nav2_msgs::msg::Path & plan);
5353

5454
// Compute the potential, or navigation cost, at a given point in the world
5555
// - must call computePotential first
@@ -62,11 +62,11 @@ class DijkstraPlanner : public ComputePathToPoseTaskServer
6262

6363
// Compute the squared distance between two points
6464
inline double squared_distance(
65-
const geometry_msgs::msg::PoseStamped & p1,
66-
const geometry_msgs::msg::PoseStamped & p2)
65+
const geometry_msgs::msg::Pose & p1,
66+
const geometry_msgs::msg::Pose & p2)
6767
{
68-
double dx = p1.pose.position.x - p2.pose.position.x;
69-
double dy = p1.pose.position.y - p2.pose.position.y;
68+
double dx = p1.position.x - p2.position.x;
69+
double dy = p1.position.y - p2.position.y;
7070
return dx * dx + dy * dy;
7171
}
7272

@@ -87,9 +87,6 @@ class DijkstraPlanner : public ComputePathToPoseTaskServer
8787
// Wait for costmap server to appear
8888
void waitForCostmapServer(const std::chrono::seconds waitTime = std::chrono::seconds(10));
8989

90-
// Publish plan for visualization purposes
91-
void publishPlan(const std::vector<geometry_msgs::msg::PoseStamped> & path);
92-
9390
// Print costmap to terminal
9491
void printCostmap(const nav2_msgs::msg::Costmap & costmap);
9592

src/planning/package.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
<version>0.1.0</version>
66
<description>TODO</description>
77
<author email="[email protected]">Oregon Robotics Team</author>
8-
<author email="[email protected]">Carlos Orduno</author>
98
<maintainer email="[email protected]">Oregon Robotics Team</maintainer>
10-
<maintainer email="[email protected]">Carlos Orduno</maintainer>
119
<license>Apache License 2.0</license>
1210
<buildtool_depend>ament_cmake</buildtool_depend>
1311
<build_depend>rclcpp</build_depend>

0 commit comments

Comments
 (0)