-
Notifications
You must be signed in to change notification settings - Fork 6
Control
Tim Brewis edited this page Mar 17, 2022
·
3 revisions
The control thread receives a 10-bit throttle input from the sensor thread and maps it to a driver profile before sending a torque requests to the CAN thread.
A driver profile defines a mapping between a throttle input and a torque request and can be created and edited using the VCU Driver Profiles app. The raw data for profiles generated by this app is stored in driver_profile_data.c
. Each driver profile is assigned a unique integer ID which is used in driver_profiles.c
to fetch a pointer to the start of the corresponding look-up table.
To add a new profile:
- Generate the C code for the look-up table using the app.
- Paste the look-up table into
driver_profile_data.c
and give the array a suitable name. -
extern
the look-up table array indriver_profiles.c
. - Add a new ID number definition for the profile to
driver_profiles.h
and incrementNUM_DRIVER_PROFILES
. - Create a
static const driver_profile_t
instance indriver_profiles.c
to represent the profile and initialise it with{ID_NUMBER, "Name", look_up_table}
. - Add a pointer to the new
driver_profile_t
to thedriver_profiles
array indriver_profiles.c
, making sure that the array index at which it is stored corresponds to the ID number of the profile.