File constants.hpp

Generates an action based on state and spline (both are cuda globals), returns it. Tunable parameters in and.

namespace controls

Enums

enum class StateProjectionMode

Values:

enumerator MODEL_MULTISET
enumerator NAIVE_SPEED_ONLY
enumerator POSITIONLLA_YAW_SPEED
enum class TorqueMode

Values:

enumerator AWD
enumerator FWD
enumerator RWD

Variables

float approx_propogation_delay
bool follow_midline_only
bool testing_on_rosbag
bool ingest_midline
bool send_to_can
bool display_on
StateProjectionMode state_projection_mode
bool publish_spline
bool log_state_projection_history
bool no_midline_controller
float host_maximum_speed_ms
bool testing_on_breezway = false
bool republish_perc_cones = true
bool log_render_and_sync_timing = false
float whl_radius = 0.215f
float gear_ratio = 14.0f
bool print_svm_timing = false
double controller_freq = 10.

Target number of controller steps per second, in Hz. 1 controller step outputs 1 control action.

float controller_period = 1. / controller_freq

Target duration between control actions, in sec.

uint32_t num_samples = 64 * 1024

Number of trajectories sampled each controller step.

uint32_t num_timesteps = 16

Number of controller steps simulated into the future.

uint8_t action_dims = 2

\(q\), dimensions of Action

uint8_t state_dims = 4

\(p\), dimensions of State

float temperature = 1.0f

Convergence speed/stability tradeoff, see LaTeX for more details.

unsigned long long seed = 0

For brownian pseudo-RNG.

uint32_t num_action_trajectories = action_dims * num_timesteps * num_samples

Number of elements in the tensor containing all the sampled action trajectories.

float init_action_trajectory[num_timesteps * action_dims] = {}

Best guess of action tr ajectory when controller first starts.

float action_momentum = 0.0f

How much of last action taken to retain in calculation of next action.

float above_speed_threshold_cost = 1000.0f
float torque_1Nps_cost = 0.0f
float swangle_1radps_cost = 0.0f
float offset_1m_cost = 5.0f

Cost for being 1m away from midline DEPRECATED.

float target_speed = 4.0f

Linear cost for under target speed, NO cost for above, in m/s.

float speed_off_1mps_cost = 2.0f

Cost for being 1m/s below target_speed.

float progress_cost_multiplier = 0.6f
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.

float mesh_grid_spacing = 0.1f
float max_spline_length = 200.0f
int cone_augmentation_angle = 60
float lookahead_behind_squared = 25.0f
int aim_signal_period_ms = 20
float default_p = 2.5f
float default_feedforward = 0.0f
float spline_frame_separation = 0.5f
uint32_t curv_frame_lookup_tex_width = 512
float curv_frame_lookup_padding = 0
float fake_track_width = 10.0f

Not real track width, used for curvilinear frame lookup table generation.

float car_padding = std::max(spline_frame_separation, M_SQRT2f32 * fake_track_width)

Represents space the car occupies, used to calculate the size of the curvilinear lookup table.

bool reset_pose_on_cone = true

Sets pose to 0 vector for new cone (sensor POV)

float triangle_threshold_squared = 64.0f
float cg_to_side = 1.0f
float cg_to_nose = 2.025f
float cg_to_front = 0.775
float cg_to_rear = 0.775
float car_mass = 210.0f

gear ratio = motor speed / wheel speed = wheel torque / motor torque

float rolling_drag_constant_kN = 0.147287f
float rolling_drag_linear = 12.604f
float rolling_drag_squared = 0.0f
float understeer_slope_squared = 0.28980572
float torque_efficiency = 0.75152479f
float rolling_drag = 100.0f
float understeer_slope = 0.0f

Total drag forces on the car (rolling friction + air drag) in N.

How much car understeers as speed increases. See Model Overview .

float long_tractive_capability = 3.0f

Maximum forward acceleration in m/s^2. Can be an imposed limit or the actual physics limitation.

float lat_tractive_capability = 5.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

float brake_enable_speed = 1.0f
float saturating_motor_torque = (long_tractive_capability + rolling_drag / car_mass) * car_mass * whl_radius / gear_ratio

Maximum torque request (N m)

float min_torque = -saturating_motor_torque
float max_torque = saturating_motor_torque
float min_swangle_rad = degrees_to_radians(-20.0f)
float max_swangle_rad = degrees_to_radians(20.0f)
float max_swangle_rate = degrees_to_radians(50.0f)
float max_torque_rate = std::numeric_limits<float>::max()
float approx_mppi_time = 0.020f

Time from MPPI control action request to physical change, in sec.

Time from MPPI launch to control action calculation, in sec

TorqueMode torque_mode = TorqueMode::AWD

Because back two wheels don’t currently work.

uint8_t state_x_idx = 0
uint8_t state_y_idx = 1
uint8_t state_yaw_idx = 2
uint8_t state_speed_idx = 3
uint8_t action_swangle_idx = 0
uint8_t action_torque_idx = 1
const char *clear_term_sequence = "\033c"