Skip to content

Commit

Permalink
Complete the temp fix from #63 (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
hello-amal authored Jul 22, 2024
1 parent 20c7d49 commit ba50f79
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ export abstract class FunctionProvider {
}, 150);
}

// NOTE: When we undo this temp fix (of not stopping the
// trajectory client) we also need to undo it in robot.jsx
// `stopExecution()`.
public stopCurrentAction(send_stop_command: boolean = false) {
if (send_stop_command) FunctionProvider.remoteRobot?.stopTrajectory();
if (this.activeVelocityAction) {
Expand Down
20 changes: 16 additions & 4 deletions src/pages/robot/tsx/robot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -927,10 +927,22 @@ export class Robot extends React.Component {
this.trajectoryClient.createClient(this.poseGoal);
}

stopExecution() {
this.stopTrajectoryClient();
this.stopMoveBaseClient();
this.stopMoveToPregraspClient();
// NOTE: When we undo this temp fix (of not stopping the
// trajectory client) we also need to undo it in FunctionProvider.jsx
// `stopCurrentAction()`.
// However, we should consider not stopping the trajectory client here,
// regardless, because:
// (1) there is a race condition where ROS can receive the cancellation
// request *after* the new goal, and thus cancel the new goal (e.g.,
// this occurs often when toggling the tablet between portrait and
// landscape mode);
// (2) the trajectory client smoothly interpolates between goals anyway,
// so there is no need to stop it.
// If we premanently don't stop the trajectory client here, then
// `stopExecution` should just be replaced with `stopAutonomousClients`.
stopExecution(stop_trajectory_client: boolean = false) {
if (stop_trajectory_client) this.stopTrajectoryClient();
this.stopAutonomousClients();
}

stopAutonomousClients() {
Expand Down

0 comments on commit ba50f79

Please sign in to comment.