From df47962b0b1cda243d5ec470a283cbb448ae1b8a Mon Sep 17 00:00:00 2001 From: hello-vinitha <145490650+hello-vinitha@users.noreply.github.com> Date: Thu, 18 Jul 2024 12:14:22 -0700 Subject: [PATCH] Cancel Autonomous Behaviors when Joints are Moved (#66) * stop any action being executed when joints are moved * don't stop the trajectory client for incremental move to prevent jerky movements * fixes from pre-commit --------- Co-authored-by: hello-amal --- src/pages/robot/tsx/robot.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/pages/robot/tsx/robot.tsx b/src/pages/robot/tsx/robot.tsx index ed18b44c..990196b1 100644 --- a/src/pages/robot/tsx/robot.tsx +++ b/src/pages/robot/tsx/robot.tsx @@ -864,12 +864,14 @@ export class Robot extends React.Component { executePoseGoal(pose: RobotPose) { this.switchToPositionMode(); + this.stopExecution(); this.poseGoal = this.makePoseGoal(pose); this.trajectoryClient.createClient(this.poseGoal); } async executePoseGoals(poses: RobotPose[], index: number) { this.switchToPositionMode(); + this.stopExecution(); this.poseGoal = this.makePoseGoals(poses); this.trajectoryClient.createClient(this.poseGoal); } @@ -885,6 +887,7 @@ export class Robot extends React.Component { executeIncrementalMove(jointName: ValidJoints, increment: number) { this.switchToPositionMode(); + this.stopAutonomousClients(); this.poseGoal = this.makeIncrementalMoveGoal(jointName, increment); this.trajectoryClient.createClient(this.poseGoal); } @@ -895,6 +898,11 @@ export class Robot extends React.Component { this.stopMoveToPregraspClient(); } + stopAutonomousClients() { + this.stopMoveBaseClient(); + this.stopMoveToPregraspClient(); + } + stopTrajectoryClient() { if (!this.trajectoryClient) throw "trajectoryClient is undefined"; if (this.poseGoal) {