-
Notifications
You must be signed in to change notification settings - Fork 111
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
RSDK-1592 - opt rdk vue code to use new sdk wrappers #1770
RSDK-1592 - opt rdk vue code to use new sdk wrappers #1770
Conversation
web/frontend/src/components/base.vue
Outdated
req.setName(props.name); | ||
req.setLinear(linear); | ||
req.setAngular(angular); | ||
|
||
rcLogConditionally(req); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is misleading - we are logging a request that never actually gets sent. We should add a hook to the SDK that allows clients to pass in a request logger.
8a692b4
to
d919f79
Compare
web/frontend/package.json
Outdated
@@ -8,7 +8,7 @@ | |||
"@mdi/js": "^6.9.96", | |||
"@viamrobotics/prime": "^0.0.106", | |||
"@viamrobotics/rpc": "^0.1.32", | |||
"@viamrobotics/sdk": "^0.0.11", | |||
"@viamrobotics/sdk": "file:../../../viam-typescript-sdk/viamrobotics-sdk-0.0.13.tgz", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
push an updated sdk with the log changes and swap this to the new version
web/frontend/src/components/base.vue
Outdated
return await bc.spin(angle.value * (spinType.value === 'Clockwise' ? -1 : 1), spinSpeed.value); | ||
} catch (error) { | ||
displayError(error as ServiceError); | ||
// eslint-disable-next-line no-useless-return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This lint check seems to be removing valid code. Do you think it is worth removing on the rdk as a whole?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CC @DTCurrie
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually think the linter is right. The first try/catch return is inside of an if block, so no further code is getting executed except for the second return, which does nothing. I would go one step further though and just remove all returns from this function as none of it is ever used:
const baseRun = async () => {
const bc = new BaseClient(props.client, props.name, { requestLogger: rcLogConditionally });
if (movementMode.value === 'Spin') {
try {
await bc.spin(angle.value * (spinType.value === 'Clockwise' ? -1 : 1), spinSpeed.value);
} catch (error) {
displayError(error as ServiceError);
}
} else if (movementMode.value === 'Straight') {
handleBaseStraight(props.name, {
movementType: movementType.value,
direction: direction.value === 'Forwards' ? 1 : -1,
speed: speed.value,
distance: increment.value,
});
}
};
|
Co-authored-by: Maxim Pertsov <maxim@viam.com>
This will opt the rdk remote control page to use the new typescript wrappers for the following components:
Base
Motor
Board
All wrappers have been successfully tested on a live robot running the updated rdk.