5 steering_pub_(create_publisher<pacsim::msg::
StampedScalar>(
"/pacsim/steering_setpoint", 10)),
6 throttle_pub_(create_publisher<pacsim::msg::
Wheels>(
"/pacsim/throttle_setpoint", 10)) {
11 car_pose_sub_ = this->create_subscription<geometry_msgs::msg::TwistWithCovarianceStamped>(
17 car_velocity_sub_ = this->create_subscription<geometry_msgs::msg::TwistWithCovarianceStamped>(
18 "/pacsim/velocity", 1,
21 "/pacsim/state_vector", 1,
25 RCLCPP_INFO(this->get_logger(),
"Pacsim adapter created");
29 const geometry_msgs::msg::TwistWithCovarianceStamped& msg) {
30 custom_interfaces::msg::Pose pose;
31 pose.header.stamp = msg.header.stamp;
32 pose.theta = msg.twist.twist.angular.z;
33 pose.x = msg.twist.twist.linear.x;
34 pose.y = msg.twist.twist.linear.y;
40 const geometry_msgs::msg::TwistWithCovarianceStamped& msg) {
41 custom_interfaces::msg::Velocities vel_msg;
42 vel_msg.header.stamp = msg.header.stamp;
43 vel_msg.velocity_x = msg.twist.twist.linear.x;
44 vel_msg.velocity_y = msg.twist.twist.linear.y;
45 vel_msg.angular_velocity = msg.twist.twist.angular.z;
50 const custom_interfaces::msg::VehicleStateVector& msg) {
55 auto steering_msg = pacsim::msg::StampedScalar();
56 auto throttle_msg = pacsim::msg::Wheels();
Class responsible for the ROS2 communication of the control module.
void vehicle_state_callback(const custom_interfaces::msg::Velocities &msg)
Called when a new velocity is received.
ControlParameters params_
void vehicle_pose_callback(const custom_interfaces::msg::Pose &msg)
Called when a new vehicle pose is received.
void publish_command(common_lib::structures::ControlCommand cmd) override
Adapters override this function to publish control commands in their environment.
rclcpp::Subscription< custom_interfaces::msg::VehicleStateVector >::SharedPtr car_state_vector_sub_
rclcpp::Publisher< pacsim::msg::Wheels >::SharedPtr throttle_pub_
rclcpp::Subscription< geometry_msgs::msg::TwistWithCovarianceStamped >::SharedPtr car_pose_sub_
rclcpp::Subscription< geometry_msgs::msg::TwistWithCovarianceStamped >::SharedPtr car_velocity_sub_
rclcpp::Publisher< pacsim::msg::StampedScalar >::SharedPtr steering_pub_
void _pacsim_gt_velocities_callback(const geometry_msgs::msg::TwistWithCovarianceStamped &msg)
Callback for the pacsim ground truth velocity topic, used when using simulated velocity estimation.
void _pacsim_gt_pose_callback(const geometry_msgs::msg::TwistWithCovarianceStamped &msg)
Callback for the pacsim ground truth pose topic, used when using simulated SLAM.
void _pacsim_gt_state_vector_callback(const custom_interfaces::msg::VehicleStateVector &msg)
Callback for the pacsim ground truth state vector topic, used when using simulated full state estimat...
friend class PacSimAdapter
bool using_simulated_slam_
bool using_simulated_velocities_