Skip to content

Launch Control Palmer#23

Open
nistath wants to merge 16 commits into
romanfrom
launch-control
Open

Launch Control Palmer#23
nistath wants to merge 16 commits into
romanfrom
launch-control

Conversation

@nistath

@nistath nistath commented Sep 8, 2018

Copy link
Copy Markdown
Member

This pull request updates the VCU code to include launch control for testing at palmer on Sunday Sept. 9.

@sebLopezCot sebLopezCot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Some stylistic things

Comment thread src/vcu/inc/controls.h Outdated
#define MAX_ACCEL_VAL 1000
#define MIN_ACCEL_VAL 0

// Launch control contants

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Spelling error

Comment thread src/vcu/inc/controls.h Outdated
#define LC_cGR 347 // Gear ratio times 100
#define LC_ACCEL_BEGIN 950 // 95%
#define LC_ACCEL_RELEASE 50 // 5%
#define LC_BRAKE_BEGIN 100 // We want a lower threshold

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we still want this comment?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Sorry, this comment was to indicate that we want lower threshold than normal. I can fix it to make it clearer

Comment thread src/vcu/src/controls.c Outdated

int32_t voltage_limited_torque = get_voltage_limited_torque(torque_command);
// static uint32_t last_vt = 0;
// if (HAL_GetTick() - last_vt > 10) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just remove this commented code

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

And also there is a typo here "loggind"

Comment thread src/vcu/src/controls.c Outdated
@@ -90,13 +103,14 @@ void execute_controls(void) {
// }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same here: remove commented code

Comment thread src/vcu/src/controls.c
Comment thread can_spec_my18.yml Outdated
position: 0
length: 1
c_type: bool
launch_ctrl_slip_ratio: # Ranges from 105 to 115

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why does it range between these values? Will this ever change?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I talk about this is confluence docs. This number was something that Luis suggested but could use some more backing.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yeah, might be good to at least show how you might come up with this on confluence.

Comment thread src/vcu/src/controls.c Outdated
control_settings.torque_temp_limited = false;

lc_settings.using_launch_ctrl = false;
lc_settings.slip_ratio = 112;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would recommend bringing 112 out to a DEFAULT_SLIP_RATIO constant

Comment thread src/vcu/src/controls.c
Comment thread src/vcu/src/controls.c
if (pedalbox_min(accel) < LC_ACCEL_BEGIN) {
printf("[LAUNCH CONTROL ERROR] Accel min (%d) too low\r\n", pedalbox_min(accel));
return true;
} else if (pedalbox.brake_2 > LC_BRAKE_BEGIN) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why only brake_2? Don't we want the max of the 2 brakes?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I have learned the reason, but would still like a comment here explaining why we only need to check brake 2

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I actually don't remember the reason myself...should definitely go in a comment

Comment thread src/vcu/src/controls.c Outdated
return false;
}

void set_lc_state_before() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this function ever used? Can we delete it?

Comment thread src/vcu/src/controls.c Outdated
Comment thread src/vcu/src/controls.c Outdated
}
break;
case SPEEDING_UP:
if (torque_command < 1000) sendSpeedCmdMsg(500, torque_command);

@sebLopezCot sebLopezCot Sep 8, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In confluence, we have "LC_SPEEDING_UP_TORQUE", but here it is not a constant. Can we fix this?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also can we make 300 and 500 some sort of constants too and add them to the documentation in confluence?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also technically the if statement here with < 1000 should probably be reflected in the state machine somehow. I think you intended to back off on the torque command if we start to exceed 1000, right?

@daniwhite daniwhite Sep 8, 2018

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Oh yeah I realized I had made it a constant and forgot to push it. I'll fix the others

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

And yeah my intention we to command max(commanded torque, 1000)

@sebLopezCot

sebLopezCot commented Sep 8, 2018

Copy link
Copy Markdown
Contributor

Hey Dani, I think in terms of state machine logic, this looks good. Nick and I both went through the diagrams in confluence and it seems to match. Some stylistic things are in order. Also make sure to pull our changes before resolving issues. Also, nice work on the diagrams! Super easy to read.

Comment thread src/vcu/src/can_handles.c
@nistath

nistath commented Sep 26, 2018

Copy link
Copy Markdown
Member Author

This PR has been open for too long, @daniwhite .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants