Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

engage % is not correct #75

Open
BBBmau opened this issue Jul 13, 2024 · 0 comments · May be fixed by #76
Open

engage % is not correct #75

BBBmau opened this issue Jul 13, 2024 · 0 comments · May be fixed by #76
Labels
bug Something isn't working

Comments

@BBBmau
Copy link

BBBmau commented Jul 13, 2024

It was quick to realize when looking at the timeline that the engagement percentage did not match up. Grey represents overrides by driver such as pressing on the gas or moving the steering wheel.

My understanding is it's marking one state as two (engaged AND overriding) here's the place where the percentage is being calculated.

const formatEngagement = (timeline?: TimelineStatistics): string => {
if (!timeline) return ''
const { engagedDuration, duration } = timeline
return `${(100 * (engagedDuration / duration)).toFixed(0)}%`
}

This is where the state is determined (engaged, overriding, alert, userflag)

events.forEach((ev) => {
if (ev.type === 'state') {
const { enabled, alertStatus, state } = ev.data
if (lastEngaged && !enabled) {
res.push({
type: 'engaged',
route_offset_millis: lastEngaged.route_offset_millis,
end_route_offset_millis: ev.route_offset_millis,
} as EngagedTimelineEvent)
lastEngaged = undefined
}
if (!lastEngaged && enabled) {
lastEngaged = ev
}
if (lastAlert && lastAlert.data.alertStatus !== alertStatus) {
res.push({
type: 'alert',
route_offset_millis: lastAlert.route_offset_millis,
end_route_offset_millis: ev.route_offset_millis,
alertStatus: lastAlert.data.alertStatus,
} as AlertTimelineEvent)
lastAlert = undefined
}
if (!lastAlert && alertStatus !== 0) {
lastAlert = ev
}
if (lastOverride && !isOverriding(ev.data.state)) {
res.push({
type: 'overriding',
route_offset_millis: lastOverride.route_offset_millis,
end_route_offset_millis: ev.route_offset_millis,
} as OverridingTimelineEvent)
lastOverride = undefined
}
if (!lastOverride && isOverriding(state)) {
lastOverride = ev
}
} else if (ev.type === 'user_flag') {
res.push({
type: 'user_flag',
route_offset_millis: ev.route_offset_millis,
})
}
})

image

@griffinbaker12 griffinbaker12 linked a pull request Jul 13, 2024 that will close this issue
@incognitojam incognitojam added the bug Something isn't working label Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants