Formula Student Autonomous Systems
The code for the main driverless system
Loading...
Searching...
No Matches
pacsim.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "custom_interfaces/msg/vehicle_state_vector.hpp"
4#include "geometry_msgs/msg/twist_with_covariance_stamped.hpp"
5#include "pacsim/msg/stamped_scalar.hpp"
6#include "pacsim/msg/wheels.hpp"
8#include "std_srvs/srv/empty.hpp"
9#include "tf2_ros/buffer.h"
10#include "tf2_ros/transform_listener.h"
11
16class PacSimAdapter : public ControlNode {
17private:
18 // Publishers of commands to PacSim
19 rclcpp::Publisher<pacsim::msg::StampedScalar>::SharedPtr steering_pub_;
20 rclcpp::Publisher<pacsim::msg::Wheels>::SharedPtr throttle_pub_;
21
22 // If using simulated (ground truth) State Estimation (and SLAM) from PacSim
23 rclcpp::Subscription<geometry_msgs::msg::TwistWithCovarianceStamped>::SharedPtr car_velocity_sub_;
24 rclcpp::Subscription<geometry_msgs::msg::TwistWithCovarianceStamped>::SharedPtr car_pose_sub_;
25 rclcpp::Subscription<custom_interfaces::msg::VehicleStateVector>::SharedPtr car_state_vector_sub_;
26
27public:
28 explicit PacSimAdapter(const ControlParameters &params);
29
33 void _pacsim_gt_pose_callback(const geometry_msgs::msg::TwistWithCovarianceStamped &msg);
34
39 void _pacsim_gt_velocities_callback(const geometry_msgs::msg::TwistWithCovarianceStamped &msg);
40
45 void _pacsim_gt_state_vector_callback(const custom_interfaces::msg::VehicleStateVector &msg);
46
48};
Class responsible for the ROS2 communication of the control module.
Definition ros_node.hpp:26
Adapter for the PacSim simulator.
Definition pacsim.hpp:16
void publish_command(common_lib::structures::ControlCommand cmd) override
Adapters override this function to publish control commands in their environment.
Definition pacsim.cpp:54
rclcpp::Subscription< custom_interfaces::msg::VehicleStateVector >::SharedPtr car_state_vector_sub_
Definition pacsim.hpp:25
rclcpp::Publisher< pacsim::msg::Wheels >::SharedPtr throttle_pub_
Definition pacsim.hpp:20
rclcpp::Subscription< geometry_msgs::msg::TwistWithCovarianceStamped >::SharedPtr car_pose_sub_
Definition pacsim.hpp:24
rclcpp::Subscription< geometry_msgs::msg::TwistWithCovarianceStamped >::SharedPtr car_velocity_sub_
Definition pacsim.hpp:23
rclcpp::Publisher< pacsim::msg::StampedScalar >::SharedPtr steering_pub_
Definition pacsim.hpp:19
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.
Definition pacsim.cpp:39
void _pacsim_gt_pose_callback(const geometry_msgs::msg::TwistWithCovarianceStamped &msg)
Callback for the pacsim ground truth pose topic, used when using simulated SLAM.
Definition pacsim.cpp:28
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...
Definition pacsim.cpp:49
friend class PacSimAdapter
Definition planning.hpp:85