|
Formula Student Autonomous Systems
The code for the main driverless system
|
PI-D Controller class. More...
#include <pid.hpp>


Public Member Functions | |
| PID (const ControlParameters ¶ms) | |
| Construct a new PID object. | |
| void | path_callback (const custom_interfaces::msg::PathPointArray &msg) override |
| Called when a new path is sent by Path Planning. | |
| void | vehicle_state_callback (const custom_interfaces::msg::Velocities &msg) override |
| Called when the car state (currently just velocity) is updated. | |
| void | vehicle_pose_callback (const custom_interfaces::msg::Pose &msg) override |
| Called when the car pose is updated by SLAM. | |
| common_lib::structures::ControlCommand | get_throttle_command () override |
| Returns the throttle command calculated by the solver (only throttle) | |
| void | publish_solver_data (std::shared_ptr< rclcpp::Node > node, std::map< std::string, std::shared_ptr< rclcpp::PublisherBase > > &publisher_map) override |
| Publishes solver specific data using the provided ControlNode. | |
| FRIEND_TEST (PidTests, TestAntiWindUp1) | |
| FRIEND_TEST (PidTests, TestAntiWindUp2) | |
| FRIEND_TEST (PidTests, TestAntiWindUp3) | |
| FRIEND_TEST (PidTests, ProportionalTerm) | |
| FRIEND_TEST (PidTests, IntegralTerm1) | |
| FRIEND_TEST (PidTests, IntegralTerm2) | |
| FRIEND_TEST (PidTests, DerivativeTerm1) | |
| FRIEND_TEST (PidTests, DerivativeTerm2) | |
| FRIEND_TEST (PidTests, Output1) | |
| FRIEND_TEST (PidTests, Output2) | |
| FRIEND_TEST (PidTests, Output3) | |
| FRIEND_TEST (PidTests, Update1) | |
Public Member Functions inherited from LongitudinalController | |
| LongitudinalController (const ControlParameters ¶ms) | |
| virtual | ~LongitudinalController ()=default |
Private Member Functions | |
| double | calculate_error (double setpoint, double measurement) const |
| Calculate the error signal. | |
| void | calculate_proportional_term (double error) |
| Calculate the proportional term. | |
| void | calculate_integral_term (double error) |
| Calculate the integral term. | |
| void | anti_wind_up () |
| Anti-wind-up via dynamic integrator clamping. | |
| void | calculate_derivative_term (double measurement) |
| Calculate the derivative term (derivative on measurement) | |
| void | compute_output () |
| Compute the output value and apply limits. | |
| double | update (double setpoint, double measurement) |
| Calculate the output value. | |
Private Attributes | |
| std::vector< custom_interfaces::msg::PathPoint > | last_path_msg_ |
| custom_interfaces::msg::Velocities | last_velocity_msg_ |
| custom_interfaces::msg::Pose | last_pose_msg_ |
| double | absolute_velocity_ = 0.0 |
| bool | received_first_path_ = false |
| bool | received_first_state_ = false |
| bool | received_first_pose_ = false |
| double | proportional_ {0.0f} |
| Proportional term current value. | |
| double | integrator_ {0.0f} |
| Integrator term current value. | |
| double | differentiator_ {0.0f} |
| Differentiator term current value. | |
| double | prev_error_ {0.0f} |
| Previous error value, required for integrator. | |
| double | prev_measurement_ {0.0f} |
| Previous measurement value, required for defferentiator. | |
| double | out_ {0.0f} |
| Current output value. | |
Additional Inherited Members | |
Protected Attributes inherited from LongitudinalController | |
| std::shared_ptr< ControlParameters > | params_ |
PI-D Controller class.
This class implements a PI-D controller. Its a PI-D because the P and I terms operates on the Error signal and the D works with the feedback signal (measurement).
| PID::PID | ( | const ControlParameters & | params | ) |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
| PID::FRIEND_TEST | ( | PidTests | , |
| DerivativeTerm1 | |||
| ) |
| PID::FRIEND_TEST | ( | PidTests | , |
| DerivativeTerm2 | |||
| ) |
| PID::FRIEND_TEST | ( | PidTests | , |
| IntegralTerm1 | |||
| ) |
| PID::FRIEND_TEST | ( | PidTests | , |
| IntegralTerm2 | |||
| ) |
| PID::FRIEND_TEST | ( | PidTests | , |
| Output1 | |||
| ) |
| PID::FRIEND_TEST | ( | PidTests | , |
| Output2 | |||
| ) |
| PID::FRIEND_TEST | ( | PidTests | , |
| Output3 | |||
| ) |
| PID::FRIEND_TEST | ( | PidTests | , |
| ProportionalTerm | |||
| ) |
| PID::FRIEND_TEST | ( | PidTests | , |
| TestAntiWindUp1 | |||
| ) |
| PID::FRIEND_TEST | ( | PidTests | , |
| TestAntiWindUp2 | |||
| ) |
| PID::FRIEND_TEST | ( | PidTests | , |
| TestAntiWindUp3 | |||
| ) |
| PID::FRIEND_TEST | ( | PidTests | , |
| Update1 | |||
| ) |
|
overridevirtual |
Returns the throttle command calculated by the solver (only throttle)
Implements LongitudinalController.
Definition at line 117 of file pid.cpp.

|
overridevirtual |
Called when a new path is sent by Path Planning.
Implements LongitudinalController.
|
overridevirtual |
Publishes solver specific data using the provided ControlNode.
| node | shared pointer to the ControlNode |
| publisher_map | map of topic names to publisher pointers |
Implements LongitudinalController.
|
private |
|
overridevirtual |
Called when the car pose is updated by SLAM.
Implements LongitudinalController.
|
overridevirtual |
Called when the car state (currently just velocity) is updated.
Implements LongitudinalController.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |