diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 8cf16d5014..f5b1b5a1e2 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -65,6 +65,7 @@ enum ChoreoConstraintScope { enum Constraints { WptVelocityDirection{scope: ChoreoConstraintScope, direction:f64}, WptZeroVelocity{scope: ChoreoConstraintScope}, + StopPoint{scope: ChoreoConstraintScope}, MaxVelocity{scope: ChoreoConstraintScope, velocity:f64}, ZeroAngularVelocity{scope: ChoreoConstraintScope}, StraightLine{scope:ChoreoConstraintScope} @@ -139,6 +140,12 @@ async fn generate_trajectory(path: Vec, config: ChoreoRobotConfi path_builder.wpt_linear_velocity_max_magnitude(fix_scope(idx[0], &rm), 0.0f64); },_=>{}} }, + Constraints::StopPoint { scope } => { + match scope { ChoreoConstraintScope::Waypoint(idx) => { + path_builder.wpt_linear_velocity_max_magnitude(fix_scope(idx[0], &rm), 0.0f64); + path_builder.wpt_angular_velocity(fix_scope(idx[0], &rm), 0.0); + },_=>{}} + }, Constraints::MaxVelocity { scope , velocity} => { match scope { ChoreoConstraintScope::Waypoint(idx) => { path_builder.wpt_linear_velocity_max_magnitude(fix_scope(idx[0], &rm), *velocity) diff --git a/src/document/ConstraintStore.tsx b/src/document/ConstraintStore.tsx index d06dc0720d..f543d200db 100644 --- a/src/document/ConstraintStore.tsx +++ b/src/document/ConstraintStore.tsx @@ -7,6 +7,7 @@ import { KeyboardDoubleArrowRight, PriorityHigh, Stop, + StopCircleOutlined, SyncDisabledOutlined, Timeline, } from "@mui/icons-material"; @@ -94,6 +95,15 @@ export const constraints = { wptScope: true, sgmtScope: false, }, + StopPoint: { + name: "Stop Point", + shortName: "Stop Point", + description: "Zero linear and angular velocity at waypoint", + icon: , + properties: {}, + wptScope: true, + sgmtScope: false, + }, MaxVelocity: { name: "Max Velocity", shortName: "Max Velo", diff --git a/src/document/PathListStore.ts b/src/document/PathListStore.ts index b6a994f384..5acca115c6 100644 --- a/src/document/PathListStore.ts +++ b/src/document/PathListStore.ts @@ -62,12 +62,8 @@ export const PathListStore = types name: usedName, waypoints: [], }); - path - .addConstraint(ConstraintStores.WptZeroVelocity) - ?.setScope(["first"]); - path - .addConstraint(ConstraintStores.WptZeroVelocity) - ?.setScope(["last"]); + path.addConstraint(ConstraintStores.StopPoint)?.setScope(["first"]); + path.addConstraint(ConstraintStores.StopPoint)?.setScope(["last"]); self.paths.put(path); if (self.paths.size === 1 || select) { self.activePathUUID = newUUID;