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

SliceByTime for PiecewisePolynomials #22099

Merged
merged 12 commits into from
Nov 11, 2024

Conversation

sadraddini
Copy link
Contributor

@sadraddini sadraddini commented Oct 31, 2024

Part of #22100

This change is Reviewable

@sadraddini sadraddini marked this pull request as ready for review October 31, 2024 02:22
@jwnimmer-tri jwnimmer-tri added the release notes: feature This pull request contains a new feature label Oct 31, 2024
@sadraddini
Copy link
Contributor Author

@jwnimmer-tri or @RussTedrake Do you mind reviewing this or assigning someone?

@RussTedrake RussTedrake self-assigned this Nov 5, 2024
Copy link
Contributor

@RussTedrake RussTedrake left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+@RussTedrake for feature review.

Reviewed 4 of 5 files at r1, 1 of 1 files at r2, all commit messages.
Reviewable status: 3 unresolved discussions, LGTM missing from assignee RussTedrake(platform), needs at least two assigned reviewers, commits need curation (https://drake.mit.edu/reviewable.html#curated-commits) (waiting on @sadraddini)


common/trajectories/piecewise_polynomial.h line 766 at r2 (raw file):

   *        trajectory's time range.
   */
  PiecewisePolynomial Trim(const T& start_time, const T& end_time) const;

I mildly worry that "trim" sounds like it's changing the current object, whereas this is a const method returning a new object.

we already have "slice" method which does the same thing, except by segment index instead of by time. I actually prefer the name "slice" because it slightly sounds more like it's making the new object? In either case, i'd like this method to be connected to that method.

perhaps "SliceByTime()". I don't love that, but it's clear. Having two overloads for slice, one that takes two ints, and the other that takes two doubles seems too risky.


common/trajectories/test/piecewise_polynomial_test.cc line 215 at r2 (raw file):

                                piecewise1.value(t), 1e-8,
                                MatrixCompareType::absolute));
    // Pick 10 random samples and check that the sampled values are the same.

btw -- the use of random samples in here is vestigial. it's better to use arbitrary but fixed sample times.


common/trajectories/test/piecewise_polynomial_test.cc line 221 at r2 (raw file):

                                  piecewise1.value(t_sample), 1e-8,
                                  MatrixCompareType::absolute));
    }

we don't actually have any guarantee that the impacted segment is being checked in here. we should definitely have that. (it's also good to check the other segments).

Copy link
Contributor Author

@sadraddini sadraddini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 2 unresolved discussions, LGTM missing from assignee RussTedrake(platform), needs at least two assigned reviewers, commits need curation (https://drake.mit.edu/reviewable.html#curated-commits)


common/trajectories/piecewise_polynomial.h line 766 at r2 (raw file):

Previously, RussTedrake (Russ Tedrake) wrote…

I mildly worry that "trim" sounds like it's changing the current object, whereas this is a const method returning a new object.

we already have "slice" method which does the same thing, except by segment index instead of by time. I actually prefer the name "slice" because it slightly sounds more like it's making the new object? In either case, i'd like this method to be connected to that method.

perhaps "SliceByTime()". I don't love that, but it's clear. Having two overloads for slice, one that takes two ints, and the other that takes two doubles seems too risky.

Done changed it to SliceByTime


common/trajectories/test/piecewise_polynomial_test.cc line 215 at r2 (raw file):

Previously, RussTedrake (Russ Tedrake) wrote…

btw -- the use of random samples in here is vestigial. it's better to use arbitrary but fixed sample times.

Done See the response to your next comment.


common/trajectories/test/piecewise_polynomial_test.cc line 221 at r2 (raw file):

Previously, RussTedrake (Russ Tedrake) wrote…

we don't actually have any guarantee that the impacted segment is being checked in here. we should definitely have that. (it's also good to check the other segments).

Done made one sample at every segment.

Copy link
Contributor

@RussTedrake RussTedrake left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 3 of 3 files at r3, all commit messages.
Reviewable status: needs at least two assigned reviewers, commits need curation (https://drake.mit.edu/reviewable.html#curated-commits) (waiting on @sadraddini)

@sadraddini
Copy link
Contributor Author

+@sammy-tri for platform review, per schedule, please!

@sadraddini sadraddini added the status: squashing now https://drake.mit.edu/reviewable.html#curated-commits label Nov 11, 2024
Copy link
Contributor

@sammy-tri sammy-tri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 2 of 5 files at r1, 3 of 3 files at r3, all commit messages.
Reviewable status: :shipit: complete! all discussions resolved, LGTM from assignees sammy-tri(platform),RussTedrake(platform)

@sammy-tri sammy-tri merged commit 2a39984 into RobotLocomotion:master Nov 11, 2024
9 checks passed
@sadraddini sadraddini deleted the ss.trim_piecewise_polys branch November 11, 2024 20:41
@sadraddini sadraddini changed the title Trim PiecewisePolynomials SliceByTime for PiecewisePolynomials Nov 13, 2024
RussTedrake pushed a commit to RussTedrake/drake that referenced this pull request Dec 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release notes: feature This pull request contains a new feature status: squashing now https://drake.mit.edu/reviewable.html#curated-commits
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants