20 namespace std_ph = std::placeholders;
23 : carma_ros2_utils::CarmaLifecycleNode(options),
24 gsm_(this->get_node_logging_interface())
37 rcl_interfaces::msg::SetParametersResult result;
39 result.successful = !error;
46 RCLCPP_INFO_STREAM(get_logger(),
"GuidanceWorker trying to configure");
54 RCLCPP_INFO_STREAM(get_logger(),
"Loaded params: " <<
config_);
68 state_publisher_ = create_publisher<carma_planning_msgs::msg::GuidanceState>(
"state", 5);
71 enable_client_ = create_client<carma_driver_msgs::srv::SetEnableRobotic>(
"enable_robotic");
78 return CallbackReturn::SUCCESS;
87 std::chrono::milliseconds(guidance_spin_period_ms),
93 return CallbackReturn::SUCCESS;
103 const std::shared_ptr<carma_planning_msgs::srv::SetGuidanceActive::Request> req,
104 std::shared_ptr<carma_planning_msgs::srv::SetGuidanceActive::Response> resp)
107 if(!req->guidance_active)
109 auto enable_robotic_request = std::make_shared<carma_driver_msgs::srv::SetEnableRobotic::Request>();
110 enable_robotic_request->set = carma_driver_msgs::srv::SetEnableRobotic::Request::DISABLE;
122 auto req = std::make_shared<carma_driver_msgs::srv::SetEnableRobotic::Request>();
123 req->set = carma_driver_msgs::srv::SetEnableRobotic::Request::ENABLE;
127 carma_planning_msgs::msg::GuidanceState state;
150#include "rclcpp_components/register_node_macro.hpp"
void onGuidanceShutdown()
Updates Guidance State Machine with SHUTDOWN signal.
void onRoboticStatus(carma_driver_msgs::msg::RobotEnabled::UniquePtr msg)
Handle robotic_status message from ROS network.
uint8_t getCurrentState()
Get current state machine status.
void onVehicleStatus(autoware_msgs::msg::VehicleStatus::UniquePtr msg)
Handle vehicle status message from ROS network.
void onRouteEvent(carma_planning_msgs::msg::RouteEvent::UniquePtr msg)
Handle route event message.
void onGuidanceInitialized()
Updates Guidance State Machine with INITIALIZED signal.
bool shouldCallSetEnableRobotic()
Indicate if SetEnableRobotic needs to be called in ACTIVE state.
void onSetGuidanceActive(bool msg)
Handle set_guidance_active service call from ROS network.
Worker class for the Guidance node.
bool spin_cb()
Timer callback.
void route_event_cb(carma_planning_msgs::msg::RouteEvent::UniquePtr msg)
Callback for route event messages.
rclcpp::TimerBase::SharedPtr spin_timer_
carma_ros2_utils::SubPtr< autoware_msgs::msg::VehicleStatus > vehicle_status_subscriber_
carma_ros2_utils::CallbackReturn handle_on_activate(const rclcpp_lifecycle::State &)
carma_ros2_utils::SubPtr< carma_driver_msgs::msg::RobotEnabled > robot_status_subscriber_
carma_ros2_utils::ServicePtr< carma_planning_msgs::srv::SetGuidanceActive > guidance_activate_service_server_
GuidanceStateMachine gsm_
carma_ros2_utils::CallbackReturn handle_on_shutdown(const rclcpp_lifecycle::State &prev_state)
GuidanceWorker(const rclcpp::NodeOptions &)
GuidanceWorker constructor.
void robot_status_cb(carma_driver_msgs::msg::RobotEnabled::UniquePtr msg)
Callback for robot enabled messages.
rcl_interfaces::msg::SetParametersResult parameter_update_callback(const std::vector< rclcpp::Parameter > ¶meters)
Callback for dynamic parameter updates.
carma_ros2_utils::ClientPtr< carma_driver_msgs::srv::SetEnableRobotic > enable_client_
carma_ros2_utils::PubPtr< carma_planning_msgs::msg::GuidanceState > state_publisher_
carma_ros2_utils::CallbackReturn handle_on_configure(const rclcpp_lifecycle::State &prev_state)
carma_ros2_utils::SubPtr< carma_planning_msgs::msg::RouteEvent > route_event_subscriber_
void vehicle_status_cb(const autoware_msgs::msg::VehicleStatus::UniquePtr msg)
Callback for vehicle status messages.
bool guidance_activation_cb(const std::shared_ptr< rmw_request_id_t >, const std::shared_ptr< carma_planning_msgs::srv::SetGuidanceActive::Request > req, std::shared_ptr< carma_planning_msgs::srv::SetGuidanceActive::Response > resp)
Set_guidance_active service callback. User can attempt to activate the guidance system by calling thi...
Stuct containing the algorithm configuration values for GuidanceWorker.