8 this->
node_->create_subscription<custom_interfaces::msg::OperationalStatus>(
9 "/vehicle/operational_status", 10,
10 [
this](
const custom_interfaces::msg::OperationalStatus::SharedPtr msg) {
11 RCLCPP_DEBUG(this->
node_->get_logger(),
12 "Operational status received. Mission: %d - Go: %d", msg->as_mission,
14 this->
node_->_go_ = msg->go_signal;
20 this->
_imu_sync_ = std::make_shared<message_filters::Synchronizer<ImuPolicy>>(
27 this->
_xsens_imu_sync_ = std::make_shared<message_filters::Synchronizer<XsensImuPolicy>>(
35 this->
_sync_ = std::make_shared<message_filters::Synchronizer<WheelSteerPolicy>>(
41 this->
node_->create_client<std_srvs::srv::Trigger>(
"/as_srv/mission_finished");
45 const custom_interfaces::msg::WheelRPM& rl_wheel_rpm_msg,
46 const custom_interfaces::msg::WheelRPM& rr_wheel_rpm_msg,
47 const custom_interfaces::msg::SteeringAngle& steering_angle_msg) {
48 RCLCPP_INFO(this->
node_->get_logger(),
"Received WSS!");
50 this->
node_->_wheel_speeds_subscription_callback(rl_wheel_rpm_msg.rl_rpm, rr_wheel_rpm_msg.rr_rpm,
51 0.0, 0.0, steering_angle_msg.steering_angle,
52 steering_angle_msg.header.stamp);
56 const custom_interfaces::msg::ImuData& roll_accx_data,
57 const custom_interfaces::msg::ImuData& yaw_accy_data) {
58 auto imu_msg = sensor_msgs::msg::Imu();
59 imu_msg.angular_velocity.z = yaw_accy_data.gyro;
60 imu_msg.linear_acceleration.x = roll_accx_data.acc;
61 imu_msg.linear_acceleration.y = yaw_accy_data.acc;
62 this->
node_->_imu_subscription_callback(imu_msg);
66 const geometry_msgs::msg::Vector3Stamped::SharedPtr& free_acceleration_msg,
67 const geometry_msgs::msg::Vector3Stamped::SharedPtr& angular_velocity_msg) {
68 auto imu_msg = sensor_msgs::msg::Imu();
69 imu_msg.angular_velocity.z = angular_velocity_msg->vector.z;
70 imu_msg.linear_acceleration.x = free_acceleration_msg->vector.x;
71 imu_msg.linear_acceleration.y = free_acceleration_msg->vector.y;
72 this->
node_->_imu_subscription_callback(imu_msg);
78 std::make_shared<std_srvs::srv::Trigger::Request>(),
79 [
this](rclcpp::Client<std_srvs::srv::Trigger>::SharedFuture future) {
80 if (future.get()->success) {
81 RCLCPP_INFO(this->node_->get_logger(),
"Finished signal sent");
83 RCLCPP_ERROR(this->node_->get_logger(),
"Failed to send finished signal");
Class that handles the communication between the SpeedEstimation node and the other nodes in the syst...
std::shared_ptr< SENode > node_
friend class VehicleAdapter
rclcpp::Client< std_srvs::srv::Trigger >::SharedPtr _finished_client_
Client for finished signal.
message_filters::Subscriber< custom_interfaces::msg::ImuData > _yaw_accy_imu_subscription_
message_filters::Subscriber< custom_interfaces::msg::WheelRPM > _rr_wheel_rpm_subscription_
Subscriber for rr wheel rpm.
message_filters::sync_policies::ApproximateTime< custom_interfaces::msg::ImuData, custom_interfaces::msg::ImuData > ImuPolicy
Policy for synchronizing IMU data.
message_filters::Subscriber< custom_interfaces::msg::ImuData > _roll_accx_imu_subscription_
message_filters::Subscriber< custom_interfaces::msg::SteeringAngle > _steering_angle_subscription_
Subscriber for steering angle.
void xsens_imu_subscription_callback(const geometry_msgs::msg::Vector3Stamped::SharedPtr &free_acceleration_msg, const geometry_msgs::msg::Vector3Stamped::SharedPtr &angular_velocity_msg)
Xsens IMU subscription callback, which receives both free acceleration and angular velocity data sepa...
std::shared_ptr< message_filters::Synchronizer< WheelSteerPolicy > > _sync_
Synchronizer for wheel speeds and steering angle.
message_filters::sync_policies::ApproximateTime< geometry_msgs::msg::Vector3Stamped, geometry_msgs::msg::Vector3Stamped > XsensImuPolicy
Policy for synchronizing Xsens IMU data.
rclcpp::Subscription< custom_interfaces::msg::OperationalStatus >::SharedPtr _operational_status_subscription_
Subscriber for operational status.
message_filters::sync_policies::ApproximateTime< custom_interfaces::msg::WheelRPM, custom_interfaces::msg::WheelRPM, custom_interfaces::msg::SteeringAngle > WheelSteerPolicy
Policy for synchronizing wheel speeds and steering angle.
message_filters::Subscriber< geometry_msgs::msg::Vector3Stamped > _free_acceleration_subscription_
void imu_subscription_callback(const custom_interfaces::msg::ImuData &roll_accx_data, const custom_interfaces::msg::ImuData &yaw_accy_data)
IMU subscriptio callback, which receives both roll and yaw acceleration data separately and synchroni...
std::shared_ptr< message_filters::Synchronizer< ImuPolicy > > _imu_sync_
message_filters::Subscriber< custom_interfaces::msg::WheelRPM > _rl_wheel_rpm_subscription_
Subscriber for rl wheel rpm.
message_filters::Subscriber< geometry_msgs::msg::Vector3Stamped > _angular_velocity_subscription_
void finish() final
Function that sends the finish signal to the respective node.
std::shared_ptr< message_filters::Synchronizer< XsensImuPolicy > > _xsens_imu_sync_
void wheel_speeds_subscription_callback(const custom_interfaces::msg::WheelRPM &rl_wheel_rpm_msg, const custom_interfaces::msg::WheelRPM &rr_wheel_rpm_msg, const custom_interfaces::msg::SteeringAngle &steering_angle_msg)
Wheel speed subscription callback, which receives both wheel speeds and steering angle through a sync...