20 namespace std_ph = std::placeholders;
23 : carma_ros2_utils::CarmaLifecycleNode(options),
24 pdw_(get_node_logging_interface(), get_clock(),
41 auto error = update_params<std::string>({
44 auto error_2 = update_params<bool>({
48 rcl_interfaces::msg::SetParametersResult result;
50 result.successful = !error && !error_2;
52 if (result.successful) {
65 RCLCPP_INFO_STREAM(get_logger(),
"port_drayage_plugin trying to configure");
76 RCLCPP_INFO_STREAM(get_logger(),
"Loaded params: " <<
config_);
82 pose_subscriber_ = create_subscription<geometry_msgs::msg::PoseStamped>(
"current_pose", 5,
107 return CallbackReturn::SUCCESS;
116 auto future_status = route_result.wait_for(std::chrono::milliseconds(100));
118 if (future_status == std::future_status::ready) {
119 if(route_result.get()->error_status == carma_planning_msgs::srv::SetActiveRoute::Response::NO_ERROR){
120 RCLCPP_DEBUG_STREAM(get_logger(),
"Route Generation succeeded for Set Active Route service call.");
124 RCLCPP_DEBUG_STREAM(get_logger(),
"Route Generation failed for Set Active Route service call.");
130 RCLCPP_DEBUG_STREAM(get_logger(),
"Set Active Route service call was not successful.");
148#include "rclcpp_components/register_node_macro.hpp"
bool callSetActiveRouteClient(std::shared_ptr< carma_planning_msgs::srv::SetActiveRoute::Request > req)
Calls the /guidance/set_active_route service client to set an active route.
carma_ros2_utils::PubPtr< carma_v2x_msgs::msg::MobilityOperation > outbound_mobility_operations_publisher_
carma_ros2_utils::SubPtr< std_msgs::msg::String > georeference_subscriber_
carma_ros2_utils::PubPtr< carma_msgs::msg::UIInstructions > ui_instructions_publisher_
carma_ros2_utils::SubPtr< geometry_msgs::msg::PoseStamped > pose_subscriber_
carma_ros2_utils::CallbackReturn handle_on_configure(const rclcpp_lifecycle::State &prev_state)
carma_ros2_utils::SubPtr< carma_planning_msgs::msg::GuidanceState > guidance_state_subscriber_
carma_ros2_utils::SubPtr< carma_v2x_msgs::msg::MobilityOperation > inbound_mobility_operation_subscriber_
void publishMobilityOperation(const carma_v2x_msgs::msg::MobilityOperation &msg)
Publishes a Mobility Operation message to the outgoing mobility operation topic.
PortDrayagePlugin(const rclcpp::NodeOptions &)
PortDrayagePlugin constructor.
carma_ros2_utils::SubPtr< carma_planning_msgs::msg::RouteEvent > route_event_subscriber_
void publishUIInstructions(const carma_msgs::msg::UIInstructions &msg)
Publishes a UI Instructions message to the outgoing UI Instructions topic.
rcl_interfaces::msg::SetParametersResult parameter_update_callback(const std::vector< rclcpp::Parameter > ¶meters)
Callback for dynamic parameter updates.
carma_ros2_utils::ClientPtr< carma_planning_msgs::srv::SetActiveRoute > set_active_route_client_
void setVehicleID(const std::string &cmv_id)
Setter function to set this object's cmv_id_ string.
void setStartingAtStagingAreaFlag(bool starting_at_staging_area)
Setter function to set this object's starting_at_staging_area flag.
void onRouteEvent(const carma_planning_msgs::msg::RouteEvent::UniquePtr msg)
Callback to process each Route Event.
void setEnablePortDrayageFlag(bool enable_port_drayage)
Setter function to set this object's enable_port_drayage flag.
void onNewPose(geometry_msgs::msg::PoseStamped::UniquePtr msg)
Callback for the pose subscriber. The pose will be converted into lat/lon and stored locally.
void onGuidanceState(const carma_planning_msgs::msg::GuidanceState::UniquePtr msg)
Callback to process the current status of the guidance state machine.
void onInboundMobilityOperation(carma_v2x_msgs::msg::MobilityOperation::UniquePtr msg)
Callback to process a received MobilityOperation message.
void setCargoID(const std::string &cargo_id)
Setter function to set this object's cargo_id_ string.
void onNewGeoreference(std_msgs::msg::String::UniquePtr msg)
Callback for map projection string to define lat/lon <--> map conversion.
Struct containing the algorithm configuration values for port_drayage_plugin.
bool starting_at_staging_area