Skip to content

Commit

Permalink
use controlsState instead of carState for engaged
Browse files Browse the repository at this point in the history
  • Loading branch information
gregjhogan committed Dec 3, 2020
1 parent 9b24cfd commit 6211c2f
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 34 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"joi-browser": "^13.4.0",
"localforage": "^1.7.1",
"mapbox-gl": "^1.4.0",
"material-ui-pickers": "^1.0.0-rc.10",
"material-ui-pickers": "^1.0.1",
"mathjs": "^6.2.1",
"memoize-one": "^5.1.1",
"obstruction": "^2.1.0",
Expand Down
2 changes: 1 addition & 1 deletion src/components/Annotations/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class Annotations extends Component {
</div>
</div>
<div className={classes.footer}>
<AnnotationsFooter segment={visibleSegment} loop={loop} start={start} />
{ visibleSegment && <AnnotationsFooter segment={visibleSegment} loop={loop} start={start} /> }
</div>
</div>
);
Expand Down
29 changes: 14 additions & 15 deletions src/components/DriveVideo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ class VideoPreview extends Component {
const events = {
model: TimelineWorker.currentModel,
mpc: TimelineWorker.currentMPC,
carState: TimelineWorker.currentCarState,
controlsState: TimelineWorker.currentControlsState,
};
this.renderEventToCanvas(
this.canvas_road.current, params, events, this.drawLaneFull
Expand All @@ -530,7 +530,10 @@ class VideoPreview extends Component {
}
if (this.canvas_carstate.current) {
const params = { calibration, shouldScale: true };
const events = { carState: TimelineWorker.currentCarState };
const events = {
carState: TimelineWorker.currentCarState,
controlsState: TimelineWorker.currentControlsState,
};
this.renderEventToCanvas(
this.canvas_carstate.current, params, events, this.renderCarState
);
Expand Down Expand Up @@ -708,10 +711,10 @@ class VideoPreview extends Component {
this.drawLaneBoundary(ctx, events.model.Model.RightLane);
this.drawLaneTrack(options, events.model.Model.Path);
}
if (events.mpc && events.carState) {
if (events.mpc && events.controlsState) {
this.drawLaneTrack(options, events.mpc.LiveMpc, {
isMpc: true,
isEnabled: events.carState.CarState.CruiseState.Enabled,
isEnabled: events.controlsState.ControlsState.Enabled,
});
}
}
Expand Down Expand Up @@ -858,9 +861,9 @@ class VideoPreview extends Component {
}

renderCarState(options, events) {
if (events && events.carState) {
this.drawCarStateBorder(options, events.carState.CarState);
this.drawCarStateWheel(options, events.carState.CarState);
if (events && events.carState && events.controlsState) {
this.drawCarStateBorder(options, events.controlsState.ControlsState);
this.drawCarStateWheel(options, events.carState.CarState, events.controlsState.ControlsState);
}
}

Expand Down Expand Up @@ -1065,7 +1068,7 @@ class VideoPreview extends Component {
}
}

drawCarStateWheel(options, CarState) {
drawCarStateWheel(options, CarState, ControlsState) {
const { ctx } = options;

const radius = 80;
Expand All @@ -1075,10 +1078,8 @@ class VideoPreview extends Component {
// Wheel Background
ctx.beginPath();
ctx.arc(x, y, radius, 0, 2 * Math.PI, false);
if (CarState.CruiseState.Enabled) {
if (ControlsState.Enabled) {
ctx.fillStyle = theme.palette.states.engagedGreen;
} else if (CarState.CruiseState.Available) {
ctx.fillStyle = theme.palette.states.drivingBlue;
} else {
ctx.fillStyle = theme.palette.states.drivingBlue;
}
Expand All @@ -1101,14 +1102,12 @@ class VideoPreview extends Component {
ctx.fill();
}

drawCarStateBorder(options, carState) {
drawCarStateBorder(options, ControlsState) {
const { ctx } = options;
ctx.lineWidth = bdr_s * 2;

if (carState.CruiseState.Enabled) {
if (ControlsState.Enabled) {
ctx.strokeStyle = theme.palette.states.engagedGreen;
} else if (carState.CruiseState.Available) {
ctx.strokeStyle = theme.palette.states.drivingBlue;
} else {
ctx.strokeStyle = theme.palette.states.drivingBlue;
}
Expand Down
4 changes: 4 additions & 0 deletions src/timeline/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,10 @@ export class TimelineInterface {
return this.getEventByType(EventWhich.CAR_STATE, 1000);
}

currentControlsState() {
return this.getEventByType(EventWhich.CONTROLS_STATE);
}

currentDriverMonitoring() {
return this.getEventByType(EventWhich.DRIVER_MONITORING, 1000);
}
Expand Down
1 change: 1 addition & 0 deletions src/timeline/logReader/allowedEventTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export default function filterEvent(which) {
case EventWhich.LIVE_MPC:
case EventWhich.INIT_DATA:
case EventWhich.CAR_STATE:
case EventWhich.CONTROLS_STATE:
case EventWhich.LIVE_CALIBRATION:
case EventWhich.DRIVER_MONITORING:
case EventWhich.THUMBNAIL:
Expand Down
68 changes: 51 additions & 17 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,13 @@
core-js "^2.5.7"
regenerator-runtime "^0.11.1"

"@babel/runtime@^7.2.0":
version "7.12.5"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.12.5.tgz#410e7e487441e1b360c29be715d870d9b985882e"
integrity sha512-plcc+hbExy3McchJCEQG3knOsuh3HH+Prx1P6cLIkET/0dLuQDEnrT+s27Axgc9bqfsmNUNHfscgMUdBpC9xfg==
dependencies:
regenerator-runtime "^0.13.4"

"@babel/template@^7.1.0", "@babel/template@^7.4.0", "@babel/template@^7.4.4", "@babel/template@^7.6.0":
version "7.6.0"
resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.6.0.tgz#7f0159c7f5012230dad64cca42ec9bdb5c9536e6"
Expand Down Expand Up @@ -1755,12 +1762,6 @@
dependencies:
csstype "^2.2.0"

"@types/recompose@^0.26.1":
version "0.26.1"
resolved "https://registry.yarnpkg.com/@types/recompose/-/recompose-0.26.1.tgz#a21c5728dea223551882b763335cb1bc641bf1d0"
dependencies:
"@types/react" "*"

"@types/stack-utils@^1.0.1":
version "1.0.1"
resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-1.0.1.tgz#0a851d3bd96498fa25c33ab7278ed3bd65f06c3e"
Expand Down Expand Up @@ -5528,7 +5529,7 @@ dom-converter@~0.1:
dependencies:
utila "~0.3"

"dom-helpers@^2.4.0 || ^3.0.0":
"dom-helpers@^2.4.0 || ^3.0.0", dom-helpers@^3.4.0:
version "3.4.0"
resolved "https://registry.yarnpkg.com/dom-helpers/-/dom-helpers-3.4.0.tgz#e9b369700f959f62ecde5a6babde4bccd9169af8"
integrity sha512-LnuPJ+dwqKDIyotW1VzmOZ5TONUN7CwkCR5hrgawTUbkBGYdeoNLZo6nNfGkCrjtE1nXXaj7iMMpDa8/d9WoIA==
Expand Down Expand Up @@ -9475,7 +9476,7 @@ key-difference@~1.0.0:
array-differ "~1.0.0"
xtend "~4.0.0"

keycode@^2.1.9:
keycode@^2.1.9, keycode@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/keycode/-/keycode-2.2.0.tgz#3d0af56dc7b8b8e5cba8d0a97f107204eec22b04"

Expand Down Expand Up @@ -10018,14 +10019,17 @@ material-ui-icons@^1.0.0-alpha.19:
dependencies:
recompose "^0.26.0"

material-ui-pickers@^1.0.0-rc.10:
version "1.0.0-rc.10"
resolved "https://registry.yarnpkg.com/material-ui-pickers/-/material-ui-pickers-1.0.0-rc.10.tgz#c6917c9f8e0ad6e318b7eac04ffb46aae2bd0f3f"
material-ui-pickers@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/material-ui-pickers/-/material-ui-pickers-1.0.1.tgz#396f90fff2f2dbb7c477bce2b9a62101eb3bd26d"
integrity sha512-FRJwgeFUQdQxzNAybZvf11204KFBxqKS6sg4JvAO0cWmHULXJhrc9kuEDT8F7Pomwnv6+AyfxygsoMgIRcBMNg==
dependencies:
"@types/recompose" "^0.26.1"
babel-runtime "^6.26.0"
react-text-mask "^5.3.1"
recompose "^0.27.1"
classnames "^2.2.6"
keycode "^2.2.0"
react-event-listener "^0.6.4"
react-text-mask "=5.4.1"
react-transition-group "^2.5.0"
tslib "^1.9.3"

math-expression-evaluator@^1.2.14:
version "1.2.17"
Expand Down Expand Up @@ -12944,6 +12948,15 @@ react-event-listener@^0.6.0:
prop-types "^15.6.0"
warning "^4.0.1"

react-event-listener@^0.6.4:
version "0.6.6"
resolved "https://registry.yarnpkg.com/react-event-listener/-/react-event-listener-0.6.6.tgz#758f7b991cad9086dd39fd29fad72127e1d8962a"
integrity sha512-+hCNqfy7o9wvO6UgjqFmBzARJS7qrNoda0VqzvOuioEpoEXKutiKuv92dSz6kP7rYLmyHPyYNLesi5t/aH1gfw==
dependencies:
"@babel/runtime" "^7.2.0"
prop-types "^15.6.0"
warning "^4.0.1"

react-extras@^0.7.1:
version "0.7.1"
resolved "https://registry.yarnpkg.com/react-extras/-/react-extras-0.7.1.tgz#e41850a1fbd7ecd30a02c74a386a3ceee6a31815"
Expand Down Expand Up @@ -13193,9 +13206,10 @@ react-test-renderer@^16.0.0-0:
react-is "^16.9.0"
scheduler "^0.15.0"

react-text-mask@^5.3.1:
react-text-mask@=5.4.1:
version "5.4.1"
resolved "https://registry.yarnpkg.com/react-text-mask/-/react-text-mask-5.4.1.tgz#c3dd3e550e31d38b7c9da0178a2725960770e443"
integrity sha512-mGx1n0x0skktwsKcpgAGnrgExFlXDflbWEHh8PC1UaQP8+EdHkW7JYczTghsBo2rnVwU9/4A9x/2bVt3HY46/w==
dependencies:
prop-types "^15.5.6"

Expand All @@ -13207,6 +13221,16 @@ react-transition-group@^2.0.0, react-transition-group@^2.2.1:
loose-envify "^1.3.1"
prop-types "^15.6.1"

react-transition-group@^2.5.0:
version "2.9.0"
resolved "https://registry.yarnpkg.com/react-transition-group/-/react-transition-group-2.9.0.tgz#df9cdb025796211151a436c69a8f3b97b5b07c8d"
integrity sha512-+HzNTCHpeQyl4MJ/bdE0u6XRMe9+XG/+aL4mCxVN4DnPBQ0/5bfHWPDuOZUzYdMj94daZaZdCCc1Dzt9R/xSSg==
dependencies:
dom-helpers "^3.4.0"
loose-envify "^1.4.0"
prop-types "^15.6.2"
react-lifecycles-compat "^3.0.4"

react-treebeard@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/react-treebeard/-/react-treebeard-2.1.0.tgz#fbd5cf51089b6f09a9b18350ab3bddf736e57800"
Expand Down Expand Up @@ -13386,7 +13410,7 @@ recompose@^0.26.0:
hoist-non-react-statics "^2.3.1"
symbol-observable "^1.0.4"

"recompose@^0.26.0 || ^0.27.0", recompose@^0.27.0, recompose@^0.27.1:
"recompose@^0.26.0 || ^0.27.0", recompose@^0.27.0:
version "0.27.1"
resolved "https://registry.yarnpkg.com/recompose/-/recompose-0.27.1.tgz#1a49e931f183634516633bbb4f4edbfd3f38a7ba"
dependencies:
Expand Down Expand Up @@ -13499,6 +13523,11 @@ regenerator-runtime@^0.11.0, regenerator-runtime@^0.11.1:
version "0.11.1"
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9"

regenerator-runtime@^0.13.4:
version "0.13.7"
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.7.tgz#cac2dacc8a1ea675feaabaeb8ae833898ae46f55"
integrity sha512-a54FxoJDIr27pgf7IgeQGxmqUNYrcV338lf/6gH456HZ/PhX+5BcwHXG9ajESmwe6WRO0tAzRUrRmNONWgkrew==

regenerator-transform@^0.10.0:
version "0.10.1"
resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.10.1.tgz#1e4996837231da8b7f3cf4114d71b5691a0680dd"
Expand Down Expand Up @@ -15505,6 +15534,11 @@ tslib@^1.7.1, tslib@^1.8.1, tslib@^1.9.0:
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a"
integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==

tslib@^1.9.3:
version "1.14.1"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==

tsutils@^3.17.1:
version "3.17.1"
resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.17.1.tgz#ed719917f11ca0dee586272b2ac49e015a2dd759"
Expand Down

0 comments on commit 6211c2f

Please sign in to comment.