Skip to content
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

[choreo] revert making intervals an option #687

Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 3 additions & 3 deletions src-core/src/generation/intervals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ pub fn guess_control_interval_counts(
.iter()
.enumerate()
.map(|(i, w)| {
if let Some(intervals) = w.intervals {
intervals
if w.override_intervals {
w.intervals
} else {
guess_control_interval_count(i, params, config, w)
}
Expand All @@ -66,7 +66,7 @@ pub fn guess_control_interval_count(
) -> usize {
let next = params.waypoints.get(i + 1);
match next {
None => this.intervals.unwrap_or(40),
None => this.intervals,
Some(next) => {
let dx = next.x - this.x;
let dy = next.y - this.y;
Expand Down
6 changes: 3 additions & 3 deletions src-core/src/generation/transformers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ fn postprocess(result: &[Sample], mut path: TrajFile, counts_vec: Vec<usize>) ->
.zip(snapshot.waypoints.iter_mut())
.zip(counts_vec)
.for_each(|w| {
w.0 .0.intervals = Some(w.1);
w.0 .1.intervals = Some(w.1);
w.0 .0.intervals = w.1;
w.0 .1.intervals = w.1;
});
// convert the result from trajoptlib to a format matching the save file.
// Calculate the waypoint timing
Expand All @@ -225,7 +225,7 @@ fn postprocess(result: &[Sample], mut path: TrajFile, counts_vec: Vec<usize>) ->
.enumerate()
.map(|pt| {
let total_intervals = interval;
interval += pt.1.intervals.unwrap_or(40);
interval += pt.1.intervals;
(
pt.1.split || pt.0 == 0 || pt.0 == snapshot.waypoints.len() - 1,
total_intervals,
Expand Down
5 changes: 4 additions & 1 deletion src-core/src/spec/traj.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ pub struct Waypoint<T: SnapshottableType> {
/// Units: radians
pub heading: T,
/// The number of control intervals to use between this waypoint and the next.
pub intervals: Option<usize>,
pub intervals: usize,
/// Whether to split the trajectory at this waypoint.
pub split: bool,
/// TODO
pub fix_translation: bool,
/// TODO
pub fix_heading: bool,
/// Whether to override the intervals.
shueja marked this conversation as resolved.
Show resolved Hide resolved
pub override_intervals: bool,
/// Whether this waypoint is an initial guess,
/// completely invisible to the frontend.
#[serde(skip, default)]
Expand All @@ -44,6 +46,7 @@ impl<T: SnapshottableType> Waypoint<T> {
split: self.split,
fix_translation: self.fix_translation,
fix_heading: self.fix_heading,
override_intervals: self.override_intervals,
is_initial_guess: self.is_initial_guess,
}
}
Expand Down
Loading