Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -139,6 +140,12 @@ async fn generate_trajectory(path: Vec<ChoreoWaypoint>, 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)
Expand Down
10 changes: 10 additions & 0 deletions src/document/ConstraintStore.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
KeyboardDoubleArrowRight,
PriorityHigh,
Stop,
StopCircleOutlined,
SyncDisabledOutlined,
Timeline,
} from "@mui/icons-material";
Expand Down Expand Up @@ -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: <StopCircleOutlined></StopCircleOutlined>,
properties: {},
wptScope: true,
sgmtScope: false,
},
MaxVelocity: {
name: "Max Velocity",
shortName: "Max Velo",
Expand Down
8 changes: 2 additions & 6 deletions src/document/PathListStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down