File constants.hpp
Generates an action based on state and spline (both are cuda globals), returns it. Tunable parameters in and.
-
namespace controls
-
Functions
- const rclcpp::QoS state_qos (rclcpp::KeepLast(1))
- const rclcpp::QoS world_twist_qos (rclcpp::KeepLast(1))
- const rclcpp::QoS world_quat_qos (rclcpp::KeepLast(1))
- const rclcpp::QoS world_pose_qos (rclcpp::KeepLast(1))
Variables
-
constexpr const char *controller_node_name = "controller"
-
constexpr const char *control_action_topic_name = "control_action"
-
constexpr const char *spline_topic_name = "spline"
-
constexpr const char *state_topic_name = "state"
-
constexpr const char *world_twist_topic_name = "filter/twist"
-
constexpr const char *world_quat_topic_name = "filter/quaternion"
-
constexpr const char *world_pose_topic_name = "filter/pose"
-
constexpr const char *controller_info_topic_name = "controller_info"
-
static const rmw_qos_profile_t best_effort_profile = {RMW_QOS_POLICY_HISTORY_KEEP_LAST, 1, RMW_QOS_POLICY_RELIABILITY_BEST_EFFORT, RMW_QOS_POLICY_DURABILITY_VOLATILE, RMW_QOS_DEADLINE_DEFAULT, RMW_QOS_LIFESPAN_DEFAULT, RMW_QOS_POLICY_LIVELINESS_SYSTEM_DEFAULT, RMW_QOS_LIVELINESS_LEASE_DURATION_DEFAULT, false}
Profile for best effort communication.
-
const rclcpp::QoS best_effort_qos = rclcpp::QoS(rclcpp::QoSInitialization(best_effort_profile.history, best_effort_profile.depth), best_effort_profile)
-
const rclcpp::QoS control_action_qos = best_effort_qos
-
const rclcpp::QoS spline_qos = best_effort_qos
-
const rclcpp::QoS controller_info_qos = best_effort_qos
-
constexpr rcl_clock_type_t default_clock_type = RCL_ROS_TIME
-
constexpr double controller_freq = 10.
Target number of controller steps per second, in Hz. 1 controller step outputs 1 control action.
-
constexpr float controller_period = 1. / controller_freq
Target duration between control actions, in sec.
-
constexpr uint32_t num_samples = 1024 * 64
Number of trajectories sampled each controller step.
-
constexpr uint32_t num_timesteps = 16
Number of controller steps simulated into the future.
-
constexpr float temperature = 1.0f
Convergence speed/stability tradeoff, see LaTeX for more details.
-
constexpr unsigned long long seed = 0
For brownian pseudo-RNG.
-
constexpr uint32_t num_action_trajectories = action_dims * num_timesteps * num_samples
Number of elements in the tensor containing all the sampled action trajectories.
-
constexpr float init_action_trajectory[num_timesteps * action_dims] = {}
Best guess of action trajectory when controller first starts.
-
constexpr float action_momentum = 0.0f
How much of last action taken to retain in calculation of next action.
-
constexpr float offset_1m_cost = 5.0f
Cost for being 1m away from midline.
-
constexpr float target_speed = 10.0f
Linear cost for under target speed, NO cost for above, in m/s.
-
constexpr float speed_off_1mps_cost = 1.0f
Cost for being 1m/s below target_speed
-
constexpr float out_of_bounds_cost = 100.0f
Cost for being out of (fake) track bound as defined by track_width.
Reason for not using infinity: reduction uses log of the cost (trading precision for representable range). This covers the edge case where every trajectory goes out of bounds, allowing us to still extract useful information.
-
constexpr float spline_frame_separation = 0.5f
-
constexpr uint32_t curv_frame_lookup_tex_width = 512
-
constexpr float curv_frame_lookup_padding = 0
-
constexpr float track_width = 30.0f
Not real track width, used for curvilinear frame lookup table generation.
-
constexpr float car_padding = std::max(spline_frame_separation, M_SQRT2f32 * track_width)
Represents space the car occupies, used to calculate the size of the curvilinear lookup table.
-
constexpr bool reset_pose_on_spline = true
Sets pose to 0 vector for new spline (sensor POV)
-
constexpr float cg_to_front = 0.775
-
constexpr float cg_to_rear = 0.775
-
constexpr float cg_to_nose = 1.5f
-
constexpr float whl_radius = 0.2286
-
constexpr float gear_ratio = 15.0f
gear ratio = motor speed / wheel speed = wheel torque / motor torque
-
constexpr float car_mass = 210.0f
-
constexpr float rolling_drag = 100.0f
-
constexpr float long_tractive_capability = 2.0f
Maximum forward acceleration in m/s^2. Can be an imposed limit or the actual physics limitation.
Total drag forces on the car (rolling friction + air drag) in N
-
constexpr float lat_tractive_capability = 3.0f
Maximum centripetal acceleration in m/s^2. Can be an imposed limit or the actual physics limitation. Usually slightly more than
long_tractive_capability
-
constexpr float understeer_slope = 0.0f
How much car understeers as speed increases. See.
-
constexpr float brake_enable_speed = 1.0f
-
constexpr float saturating_motor_torque = (long_tractive_capability + rolling_drag / car_mass) * car_mass * whl_radius / gear_ratio
Maximum torque request (N m)
-
constexpr float approx_propogation_delay = 0.02f
Time from MPPI control action request to physical change, in sec.
-
constexpr float approx_mppi_time = 0.02f
Time from MPPI launch to control action calculation, in sec.
-
constexpr TorqueMode torque_mode = TorqueMode::FWD
Because back two wheels don’t currently work.
-
constexpr uint8_t state_x_idx = 0
-
constexpr uint8_t state_y_idx = 1
-
constexpr uint8_t state_yaw_idx = 2
-
constexpr uint8_t state_speed_idx = 3
-
constexpr uint8_t action_swangle_idx = 0
-
constexpr uint8_t action_torque_idx = 1
-
constexpr const char *clear_term_sequence = "\033c"