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

refactor(mission_planner): prepare to support ad api #1561

Merged
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

This file was deleted.

2 changes: 1 addition & 1 deletion launch/tier4_planning_launch/launch/planning.launch.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<!-- mission planning module -->
<group>
<push-ros-namespace namespace="mission_planning"/>
<include file="$(find-pkg-share tier4_planning_launch)/launch/mission_planning/mission_planning.launch.py"/>
<include file="$(find-pkg-share tier4_planning_launch)/launch/mission_planning/mission_planning.launch.xml"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will stop using ComposableNodeContainer for mission_planner::MissionPlannerLanelet2 and mission_planner::GoalPoseVisualizer.
That may cause some performance degradation.
@yukkysaito @tkimura4 Is that okay for you?

FYI, from Humble, I believe we can use ComposableNode in launch.xml.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The goal pose visualizer node only subscribes to the route topic. This topic is only published once per setting route, so I don't think it will affect performance much.

</group>

<!-- scenario planning module -->
Expand Down
12 changes: 6 additions & 6 deletions planning/mission_planner/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@ project(mission_planner)
find_package(autoware_cmake REQUIRED)
autoware_package()

ament_auto_add_library(mission_planner_node SHARED
lib/mission_planner_base.cpp
ament_auto_add_library(${PROJECT_NAME}_component SHARED
src/mission_planner/mission_planner.cpp
src/mission_planner_lanelet2/mission_planner_lanelet2.cpp
src/mission_planner_lanelet2/utility_functions.cpp
)

rclcpp_components_register_node(mission_planner_node
rclcpp_components_register_node(${PROJECT_NAME}_component
PLUGIN "mission_planner::MissionPlannerLanelet2"
EXECUTABLE mission_planner
EXECUTABLE ${PROJECT_NAME}
)

ament_auto_add_library(goal_pose_visualizer_node SHARED
ament_auto_add_library(goal_pose_visualizer_component SHARED
src/goal_pose_visualizer/goal_pose_visualizer.cpp
)

rclcpp_components_register_node(goal_pose_visualizer_node
rclcpp_components_register_node(goal_pose_visualizer_component
PLUGIN "mission_planner::GoalPoseVisualizer"
EXECUTABLE goal_pose_visualizer
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<launch>
<arg name="rout_topic_name" default="/planning/mission_planning/route"/>
<arg name="route_topic_name" default="/planning/mission_planning/route"/>
<arg name="echo_back_goal_pose_topic_name" default="/planning/mission_planning/echo_back_goal_pose"/>

<node pkg="mission_planner" exec="goal_pose_visualizer" name="goal_pose_visualizer" output="screen">
<remap from="input/route" to="$(var rout_topic_name)"/>
<remap from="input/route" to="$(var route_topic_name)"/>
<remap from="output/goal_pose" to="$(var echo_back_goal_pose_topic_name)"/>
</node>
</launch>
4 changes: 2 additions & 2 deletions planning/mission_planner/launch/mission_planner.launch.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<launch>
<arg name="goal_topic_name" default="/planning/mission_planning/goal"/>
<arg name="checkpoint_topic_name" default="/planning/mission_planning/checkpoint"/>
<arg name="rout_topic_name" default="/planning/mission_planning/route"/>
<arg name="route_topic_name" default="/planning/mission_planning/route"/>
<arg name="map_topic_name" default="/map/vector_map"/>
<arg name="visualization_topic_name" default="/planning/mission_planning/route_marker"/>

Expand All @@ -11,7 +11,7 @@
<remap from="input/vector_map" to="$(var map_topic_name)"/>
<remap from="input/goal_pose" to="$(var goal_topic_name)"/>
<remap from="input/checkpoint" to="$(var checkpoint_topic_name)"/>
<remap from="output/route" to="$(var rout_topic_name)"/>
<remap from="output/route" to="$(var route_topic_name)"/>
<remap from="debug/route_marker" to="$(var visualization_topic_name)"/>
</node>
</launch>
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "mission_planner/goal_pose_visualizer.hpp"
#include "goal_pose_visualizer.hpp"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you move the header file? Please let me know if there are any references.
Do you want to create a guideline that says "all node header files should be under src/"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you are building a library, put all headers which should be usable by clients and therefore must be installed into a subdirectory of the include folder named like the package, while all other files (.c/.cpp and header files which should not be exported) are inside the src folder.

This is from guide of ament_cmake. This is not library header, so it should be placed under src. Now, many packages in Autoware put their private headers in include, so I think that should be a guideline.

Copy link
Contributor

@kenji-miyake kenji-miyake Aug 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, thanks!
I'll write some documents based on ament_cmake's guidelines.


namespace mission_planner
{
GoalPoseVisualizer::GoalPoseVisualizer(const rclcpp::NodeOptions & node_options)
: Node("goal_pose_visualizer_node", node_options)
: Node("goal_pose_visualizer", node_options)
{
sub_route_ = create_subscription<autoware_auto_planning_msgs::msg::HADMapRoute>(
"input/route", rclcpp::QoS{1}.transient_local(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef MISSION_PLANNER__GOAL_POSE_VISUALIZER_HPP_
#define MISSION_PLANNER__GOAL_POSE_VISUALIZER_HPP_
#ifndef GOAL_POSE_VISUALIZER__GOAL_POSE_VISUALIZER_HPP_
#define GOAL_POSE_VISUALIZER__GOAL_POSE_VISUALIZER_HPP_

#include <rclcpp/rclcpp.hpp>

Expand All @@ -36,4 +36,4 @@ class GoalPoseVisualizer : public rclcpp::Node
};

} // namespace mission_planner
#endif // MISSION_PLANNER__GOAL_POSE_VISUALIZER_HPP_
#endif // GOAL_POSE_VISUALIZER__GOAL_POSE_VISUALIZER_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "mission_planner/mission_planner_base.hpp"
#include "mission_planner.hpp"

#include <lanelet2_extension/utility/message_conversion.hpp>
#include <lanelet2_extension/utility/query.hpp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef MISSION_PLANNER__MISSION_PLANNER_BASE_HPP_
#define MISSION_PLANNER__MISSION_PLANNER_BASE_HPP_
#ifndef MISSION_PLANNER__MISSION_PLANNER_HPP_
#define MISSION_PLANNER__MISSION_PLANNER_HPP_

#include <string>
#include <vector>
Expand Down Expand Up @@ -70,4 +70,4 @@ class MissionPlanner : public rclcpp::Node
};

} // namespace mission_planner
#endif // MISSION_PLANNER__MISSION_PLANNER_BASE_HPP_
#endif // MISSION_PLANNER__MISSION_PLANNER_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "mission_planner/lanelet2_impl/mission_planner_lanelet2.hpp"
#include "mission_planner_lanelet2.hpp"

#include "mission_planner/lanelet2_impl/utility_functions.hpp"
#include "utility_functions.hpp"

#include <lanelet2_extension/utility/message_conversion.hpp>
#include <lanelet2_extension/utility/query.hpp>
Expand Down Expand Up @@ -136,7 +136,7 @@ double projectGoalToMap(
namespace mission_planner
{
MissionPlannerLanelet2::MissionPlannerLanelet2(const rclcpp::NodeOptions & node_options)
: MissionPlanner("mission_planner_node", node_options), is_graph_ready_(false)
: MissionPlanner("mission_planner", node_options), is_graph_ready_(false)
{
using std::placeholders::_1;
map_subscriber_ = create_subscription<autoware_auto_mapping_msgs::msg::HADMapBin>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef MISSION_PLANNER__LANELET2_IMPL__MISSION_PLANNER_LANELET2_HPP_
#define MISSION_PLANNER__LANELET2_IMPL__MISSION_PLANNER_LANELET2_HPP_
#ifndef MISSION_PLANNER_LANELET2__MISSION_PLANNER_LANELET2_HPP_
#define MISSION_PLANNER_LANELET2__MISSION_PLANNER_LANELET2_HPP_

#include <string>
#include <vector>
Expand All @@ -25,7 +25,7 @@
#include <tf2_ros/transform_listener.h>

// Autoware
#include "mission_planner/mission_planner_base.hpp"
#include "../mission_planner/mission_planner.hpp"

#include <route_handler/route_handler.hpp>

Expand Down Expand Up @@ -67,4 +67,4 @@ class MissionPlannerLanelet2 : public MissionPlanner
};
} // namespace mission_planner

#endif // MISSION_PLANNER__LANELET2_IMPL__MISSION_PLANNER_LANELET2_HPP_
#endif // MISSION_PLANNER_LANELET2__MISSION_PLANNER_LANELET2_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "mission_planner/lanelet2_impl/utility_functions.hpp"
#include "utility_functions.hpp"

#include <rclcpp/rclcpp.hpp>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef MISSION_PLANNER__LANELET2_IMPL__UTILITY_FUNCTIONS_HPP_
#define MISSION_PLANNER__LANELET2_IMPL__UTILITY_FUNCTIONS_HPP_
#ifndef MISSION_PLANNER_LANELET2__UTILITY_FUNCTIONS_HPP_
#define MISSION_PLANNER_LANELET2__UTILITY_FUNCTIONS_HPP_
#include <rclcpp/rclcpp.hpp>

#include <geometry_msgs/msg/pose.hpp>
Expand Down Expand Up @@ -43,4 +43,4 @@ void setColor(std_msgs::msg::ColorRGBA * cl, double r, double g, double b, doubl
void insertMarkerArray(
visualization_msgs::msg::MarkerArray * a1, const visualization_msgs::msg::MarkerArray & a2);
std::string toString(const geometry_msgs::msg::Pose & pose);
#endif // MISSION_PLANNER__LANELET2_IMPL__UTILITY_FUNCTIONS_HPP_
#endif // MISSION_PLANNER_LANELET2__UTILITY_FUNCTIONS_HPP_