Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
5b01836
Main pieces of PID loop, still not compiled
sebLopezCot Oct 11, 2018
9eec3fb
removing unneeded code
sebLopezCot Oct 11, 2018
b3966b2
Precision updates should be correct now
sebLopezCot Oct 13, 2018
006034d
Adding can messages for speed controller
sebLopezCot Oct 13, 2018
03e951e
Sending proper can messages from speed_controller
sebLopezCot Oct 13, 2018
c10deee
Now sending speed controller command messages from speed controller
sebLopezCot Oct 13, 2018
db4525c
Bringing speed controller into launch control for testing on the jacks
sebLopezCot Oct 13, 2018
2d7e90d
Adding in the driver toque command limiting
sebLopezCot Oct 14, 2018
8da3f67
ZERO GAINS TESTED, DOES NOTHING! pass
sebLopezCot Oct 14, 2018
b4d0d6b
Added new display page to dash for PID
SreyaV Oct 14, 2018
2622873
SPEED CONTROLS PROPERLY PROPORTIONAL 10 NM, 1500 RPM
sebLopezCot Oct 14, 2018
4a10cb6
TEST WORKS PROP GAIN AT MAX_TORQUE: 50 Nm
sebLopezCot Oct 14, 2018
f4f3404
PROP CONTROL 240 Nm good:
sebLopezCot Oct 14, 2018
eca848d
Bringing setpoint down again for safety
sebLopezCot Oct 14, 2018
890393f
Merge branch 'launch-control-internal-speed-controller' of https://gi…
SreyaV Oct 14, 2018
27aa862
INTEGRATOR TERM TESTED ON JACKS
sebLopezCot Oct 14, 2018
4c1a06f
Merge branch 'launch-control-internal-speed-controller' of github.com…
sebLopezCot Oct 14, 2018
cfc25f6
Derivative term tested on jacks
sebLopezCot Oct 14, 2018
82cea62
Setpoint to 0 for safety
sebLopezCot Oct 14, 2018
a57023e
Revert "Constant speed, no backwards check"
sebLopezCot Oct 14, 2018
0f9ef25
Adding in one more disable for safety
sebLopezCot Oct 14, 2018
edf9a9f
Change max speed -> 500 and no backwards check
sebLopezCot Oct 14, 2018
cf4b8db
Shuddering P
daniwhite Oct 14, 2018
608e157
No speeding up state, shuddering gains
daniwhite Oct 14, 2018
0ac25e8
Configure PID constants from the dash
daniwhite Oct 19, 2018
595b8ff
Fix wrong names and defaults
daniwhite Oct 19, 2018
bf496d3
Change max input speed
daniwhite Oct 20, 2018
236b71a
Setting max input speed higher for testing
sebLopezCot Oct 20, 2018
5290511
FIRST PALMER RUN: PID TESTING AT HIGHER SPEEDS
sebLopezCot Oct 21, 2018
5d62ad6
end of pid tuning
sebLopezCot Oct 21, 2018
4f1f29b
Fix junk files
nistath Oct 23, 2018
8a2ae6a
Fix 255 bug
nistath Oct 23, 2018
f293b5c
Fixing state machine bug
sebLopezCot Mar 25, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
path = lib/CANlib
url = https://github.com/MITMotorsports/CANlib.git
branch = master
ignore = dirty
ignore = dirty
251 changes: 249 additions & 2 deletions can_spec_my18.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,28 @@ boards:
- MCCommand
- VCUControlsParams
- VCUControlsMonitoring
- VCUSpeedCntrlKpTimes1000
- VCUSpeedCntrlKiTimes1000
- VCUSpeedCntrlKdTimes1000
- VCUSpeedCntrlIWindupMax
- VCUSpeedCntrlIWindupMin
- VCUSpeedCntrlMinOutputValue
- VCUSpeedCntrlMaxOutputValue
- VCUSpeedCntrlMinInputValue
- VCUSpeedCntrlMaxInputValue
- VCUSpeedCntrlErrorUpdateTimeout
- VCUSpeedCntrlDt
- VCUSpeedCntrlEnabled
- VCUSpeedCntrlOutOfInputRangeThrottled
- VCUSpeedCntrlOutOfOutputRangeThrottled
- VCUSpeedCntrlErrorUpdateTimedOut
- VCUSpeedCntrlRPMSetpoint
- VCUSpeedCntrlCommandedTorque
- VCUSpeedCntrlRPMError
- VCUSpeedCntrlLastRPMError
- VCUSpeedCntrlDerivRPMError
- VCUSpeedCntrlRPMErrorAccumulated
- VCUSpeedCntrlLastErrorUpdateTimestamp
subscribe:
can0:
- FrontCanNodeBrakeThrottle
Expand Down Expand Up @@ -695,10 +717,10 @@ buses:
c_type: uint16_t
launch_ctrl_slip_ratio: # Ranges from 105 to 115
position: 48
length: 8
length: 9
c_type: uint16_t
using_launch_ctrl:
position: 56
position: 57
length: 1
c_type: bool
VCUControlsParams:
Expand Down Expand Up @@ -869,6 +891,231 @@ buses:
position: 48
length: 16
c_type: uint16_t
VCUSpeedCntrlKpTimes1000:
can_id: 0x223
period: 200ms
is_big_endian: true
segments:
kp_times_1000:
position: 0
length: 32
c_type: int32_t
VCUSpeedCntrlKiTimes1000:
can_id: 0x225
period: 200ms
is_big_endian: true
segments:
ki_times_1000:
position: 0
length: 32
c_type: int32_t
VCUSpeedCntrlKdTimes1000:
can_id: 0x227
period: 200ms
is_big_endian: true
segments:
kd_times_1000:
position: 0
length: 32
c_type: int32_t
VCUSpeedCntrlIWindupMax:
can_id: 0x229
period: 200ms
is_big_endian: true
segments:
i_windup_max:
position: 0
length: 32
c_type: int32_t
VCUSpeedCntrlIWindupMin:
can_id: 0x22B
period: 200ms
is_big_endian: true
segments:
i_windup_min:
position: 0
length: 32
c_type: int32_t
VCUSpeedCntrlMinOutputValue:
can_id: 0x22D
period: 200ms
is_big_endian: true
segments:
min_output_value:
position: 0
length: 32
c_type: int32_t
VCUSpeedCntrlMaxOutputValue:
can_id: 0x22F
period: 200ms
is_big_endian: true
segments:
max_output_value:
position: 0
length: 32
c_type: int32_t
VCUSpeedCntrlMinInputValue:
can_id: 0x231
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 space after : gore

period: 200ms
is_big_endian: true
segments:
min_input_value:
position: 0
length: 32
c_type: int32_t
VCUSpeedCntrlMaxInputValue:
can_id: 0x233
period: 200ms
is_big_endian: true
segments:
max_input_value:
position: 0
length: 32
c_type: int32_t
VCUSpeedCntrlErrorUpdateTimeout:
can_id: 0x235
period: 200ms
is_big_endian: true
segments:
error_update_timeout:
position: 0
length: 32
c_type: int32_t
VCUSpeedCntrlDt:
can_id: 0x237
period: 200ms
is_big_endian: true
segments:
dt:
position: 0
length: 32
c_type: int32_t
VCUSpeedCntrlEnabled:
can_id: 0x239
period: 200ms
is_big_endian: true
segments:
enabled:
position: 0
length: 1
c_type: bool
VCUSpeedCntrlOutOfInputRangeThrottled:
can_id: 0x23B
period: 200ms
is_big_endian: true
segments:
out_of_input_range_throttled:
position: 0
length: 1
c_type: bool
VCUSpeedCntrlOutOfOutputRangeThrottled:
can_id: 0x23D
period: 200ms
is_big_endian: true
segments:
out_of_output_range_throttled:
position: 0
length: 1
c_type: bool
VCUSpeedCntrlErrorUpdateTimedOut:
can_id: 0x23F
period: 200ms
is_big_endian: true
segments:
error_update_timed_out:
position: 0
length: 1
c_type: bool
VCUSpeedCntrlRPMSetpoint:
can_id: 0x241
period: 200ms
is_big_endian: true
segments:
rpm_setpoint:
position: 0
length: 32
c_type: int32_t
VCUSpeedCntrlCommandedTorque:
can_id: 0x243
period: 200ms
is_big_endian: true
segments:
commanded_torque:
position: 0
length: 32
c_type: int32_t
VCUSpeedCntrlRPMError:
can_id: 0x245
period: 200ms
is_big_endian: true
segments:
rpm_error:
position: 0
length: 32
c_type: int32_t
VCUSpeedCntrlLastRPMError:
can_id: 0x247
period: 200ms
is_big_endian: true
segments:
last_rpm_error:
position: 0
length: 32
c_type: int32_t
VCUSpeedCntrlDerivRPMError:
can_id: 0x249
period: 200ms
is_big_endian: true
segments:
deriv_rpm_error:
position: 0
length: 32
c_type: int32_t
VCUSpeedCntrlRPMErrorAccumulated:
can_id: 0x24B
period: 200ms
is_big_endian: true
segments:
rpm_error_accumulated:
position: 0
length: 32
c_type: int32_t
VCUSpeedCntrlLastErrorUpdateTimestamp:
can_id: 0x24D
period: 200ms
is_big_endian: true
segments:
last_error_update_timestamp:
position: 0
length: 32
c_type: uint32_t
DashSpeedCntrlKpTimes1000:
can_id: 0x224
period: 200ms
is_big_endian: true
segments:
kp_times_1000:
position: 0
length: 32
c_type: int32_t
DashSpeedCntrlKiTimes1000:
can_id: 0x226
period: 200ms
is_big_endian: true
segments:
ki_times_1000:
position: 0
length: 32
c_type: int32_t
DashSpeedCntrlRPMSetpoint:
can_id: 0x242
period: 200ms
is_big_endian: true
segments:
rpm_setpoint:
position: 0
length: 32
c_type: int32_t
MCCommand:
can_id: 0x0C0 # From manual
period: 9ms # MC needs a message at 2 Hz or higher
Expand Down
3 changes: 3 additions & 0 deletions src/dashboard/inc/carstats.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ typedef struct {
can0_DashRequestLC_T lc_controls;
can0_VCUControlsParams_T vcu_controls;
can0_VCUControlsParamsLC_T vcu_lc_controls;
can0_DashSpeedCntrlKpTimes1000_T kp;
can0_DashSpeedCntrlKiTimes1000_T ki;
can0_DashSpeedCntrlRPMSetpoint_T rpm_setpoint;

bool vcu_controls_received;
bool vcu_lc_controls_received;
Expand Down
1 change: 1 addition & 0 deletions src/dashboard/inc/page_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ typedef enum {
DASH_PAGE_TRACTION,
DASH_PAGE_REGEN,
DASH_PAGE_LAUNCH_CONTROL,
DASH_LC_PID_DEBUG,
DASH_PAGE_TEMP_LIM,
DASH_PAGE_VOLT_LIM,
DASH_PAGE_FAULT,
Expand Down
7 changes: 7 additions & 0 deletions src/dashboard/src/dispatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ void dispatch_init() {
carstats.vcu_controls_received = false;
carstats.vcu_lc_controls_received = false;

carstats.rpm_setpoint.rpm_setpoint = 0;
carstats.ki.ki_times_1000 = 1000;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd recommend you just zero this when init'ing

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or loading in the default vals (we might want to start putting kp, ki as defines in a header for speed controller

carstats.kp.kp_times_1000 = 0;

init_button_state(&carstats.buttons.left);
init_button_state(&carstats.buttons.right);
init_button_state(&carstats.buttons.A);
Expand Down Expand Up @@ -177,6 +181,9 @@ void send_dash_controls(void) {
LIMIT(can0_DashRequest_period);
handle_can_error(can0_DashRequest_Write(&carstats.controls));
handle_can_error(can0_DashRequestLC_Write(&carstats.lc_controls));
handle_can_error(can0_DashSpeedCntrlKpTimes1000_Write(&carstats.kp));
handle_can_error(can0_DashSpeedCntrlKiTimes1000_Write(&carstats.ki));
handle_can_error(can0_DashSpeedCntrlRPMSetpoint_Write(&carstats.rpm_setpoint));
}

void vcu_controls_update(void) {
Expand Down
Loading