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

Automotive TrajectoryAgents #8725

Merged
merged 1 commit into from
May 7, 2018

Conversation

jadecastro
Copy link
Contributor

@jadecastro jadecastro commented May 1, 2018

Toward #8529.


This change is Reviewable

@jadecastro
Copy link
Contributor Author

+@stonier feature review.


Review status: 0 of 4 files reviewed at latest revision, all discussions resolved.


Comments from Reviewable

/// * velocity
/// (OutputPort getter: raw_pose_output())
///
/// output port 1: A PoseVector containing X_WC, where C is the car frame.
Copy link
Contributor

Choose a reason for hiding this comment

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

Agent, !Car -> X_WA?

@jadecastro jadecastro force-pushed the auto-traj-agents branch 3 times, most recently from 9e71bd0 to 7517361 Compare May 4, 2018 02:00
@stonier
Copy link
Contributor

stonier commented May 4, 2018

:LGTM: pending conflict fixes / CI resolution


Comments from Reviewable

@jadecastro
Copy link
Contributor Author

+@sherm1 for platform review please.


Review status: 0 of 5 files reviewed at latest revision, all discussions resolved, some commit checks failed.


Comments from Reviewable

@jadecastro
Copy link
Contributor Author

BTW, I’m not entirely sure what to make of the CI error. It looks like a pybind thing but not sure.
@EricCousineau-TRI do you have any thoughts on how to fix this?


Review status: 0 of 5 files reviewed at latest revision, all discussions resolved, some commit checks failed.


Comments from Reviewable

@EricCousineau-TRI
Copy link
Contributor

I don't think it's pybind-related (whew!), but rather related to this PR: #8664

Per the fixes Jeremy submitted in #8726, I think you'd add the target to the dependency list:

error: Missing deps in //automotive's drake_cc_package_library.
note: In the automotive/BUILD.bazel rule for drake_cc_package_library, add the following lines to the deps:
        ":trajectory_agent",

@jadecastro
Copy link
Contributor Author

Ah, 🤦, thanks. I should have looked at the updated BUILD file. It's clear to me now.


Review status: 0 of 5 files reviewed at latest revision, all discussions resolved, some commit checks failed.


Comments from Reviewable

@sherm1
Copy link
Member

sherm1 commented May 5, 2018

Platform :lgtm: pending some BTWs.


Reviewed 1 of 4 files at r1, 2 of 3 files at r2, 2 of 2 files at r3.
Review status: all files reviewed at latest revision, all discussions resolved.


automotive/trajectory_agent.h, line 34 at r3 (raw file):

/// taking as input an AgentData structure and an AgentTrajectory.
///
/// output port 0:

BTW consider saying this is a SimpleCarState.


automotive/trajectory_agent.h, line 38 at r3 (raw file):

///   heading is 0 rad when pointed +x, pi/2 rad when pointed +y;
///   heading is defined around the +z axis, so positive-turn-left
/// * velocity

BTW is this ẋ ẏ heading_dot? (consider clarifying)


automotive/trajectory_agent.h, line 45 at r3 (raw file):

///   (OutputPort getter: pose_output())
///
/// output port 2: A FrameVelocity containing Xdot_WA, where A is the agent's

BTW this is not correct (and I see FrameVelocity's documentation is wrong too :( ). What you are outputting here is the spatial velocity of A in W, which we write V_WA. That is not the same thing as Xdot_WA, which literally means d/dt X_WA. The derivative of a vector or matrix quantity is an identically-shaped quantity whose elements are the time derivatives of the original elements. That is definitely not true here since (1) a PoseVector has 7 elements while FrameVelocity has 6, and (I hate to say this) (2) the rotational and translational elements are flipped around (!!).


automotive/trajectory_agent.h, line 47 at r3 (raw file):

/// output port 2: A FrameVelocity containing Xdot_WA, where A is the agent's
/// reference frame.
///   (OutputPort getter: velocity_output())

BTW why do you use FrameVelocity here rather than SpatialVelocity? I notice you use PoseVelocity elsewhere and that uses SpatialVelocity.


automotive/trajectory_agent.h, line 66 at r3 (raw file):

  /// @param trajectory an AgentTrajectory containing the trajectory.
  /// @param sampling_time_sec the requested sampling time (in sec) for this
  /// system.  @default 0.01.

BTW does this format correctly in doxygen?


automotive/trajectory_agent.h, line 76 at r3 (raw file):

      : TrajectoryAgent<T>(other.agent_data_, other.trajectory_) {}

  /// Accessors for the outputs, as enumerated in the class documentation.

BTW you need an @name here for grouping to work in doxygen.

Please generate the doxygen for this PR and inspect it to make sure it is formatted as you expected (and confirm here that it is).


automotive/trajectory_agent.h, line 103 at r3 (raw file):

  // FrameVelocity output.
  void CalcVelocityOutput(const systems::Context<T>& context,
                          systems::rendering::FrameVelocity<T>* velocity) const;

BTW could this be SpatialVelocity? Then you can just copy it directly out of PoseVelocity.


automotive/trajectory_agent.cc, line 40 at r3 (raw file):

void TrajectoryAgent<T>::CalcPoseOutput(const systems::Context<T>& context,
                                        PoseVector<T>* pose) const {
  const PoseVelocity values = GetValues(context);

BTW I see that PoseVelocity isn't templatized. Does that mean the derivatives produced when T=AutoDiff are wrong? If so, please document. Otherwise please add a comment (not sure if this is the right place) explaining why everything is still good.


automotive/test/trajectory_agent_test.cc, line 57 at r3 (raw file):

  const std::vector<TestCase> test_cases{
      {0., 1.},           {M_PI_2, 1.},      {-M_PI_2, 1.}, {0.125 * M_PI, 10.},
      {0.125 * M_PI, 1.}, {0.125 * M_PI, 1.}};

FYI spacing seems odd.


Comments from Reviewable

@jadecastro
Copy link
Contributor Author

Comments addressed.


Review status: 3 of 5 files reviewed at latest revision, 9 unresolved discussions.


automotive/trajectory_agent.h, line 34 at r3 (raw file):

Previously, sherm1 (Michael Sherman) wrote…

BTW consider saying this is a SimpleCarState.

Done.


automotive/trajectory_agent.h, line 38 at r3 (raw file):

Previously, sherm1 (Michael Sherman) wrote…

BTW is this ẋ ẏ heading_dot? (consider clarifying)

Done.


automotive/trajectory_agent.h, line 45 at r3 (raw file):

Previously, sherm1 (Michael Sherman) wrote…

BTW this is not correct (and I see FrameVelocity's documentation is wrong too :( ). What you are outputting here is the spatial velocity of A in W, which we write V_WA. That is not the same thing as Xdot_WA, which literally means d/dt X_WA. The derivative of a vector or matrix quantity is an identically-shaped quantity whose elements are the time derivatives of the original elements. That is definitely not true here since (1) a PoseVector has 7 elements while FrameVelocity has 6, and (I hate to say this) (2) the rotational and translational elements are flipped around (!!).

Done.


automotive/trajectory_agent.h, line 47 at r3 (raw file):

Previously, sherm1 (Michael Sherman) wrote…

BTW why do you use FrameVelocity here rather than SpatialVelocity? I notice you use PoseVelocity elsewhere and that uses SpatialVelocity.

I'm using FrameVelocity simply because I want all outputs to be Vector-based, as opposed to Abstract outputs. SpatialVelocity does not specialize BasicVector, so instead I'm using its BasicVector container (FrameVelocity).


automotive/trajectory_agent.h, line 66 at r3 (raw file):

Previously, sherm1 (Michael Sherman) wrote…

BTW does this format correctly in doxygen?

Here's the result:
Screen Shot 2018-05-06 at 10.04.54 PM.png


automotive/trajectory_agent.h, line 76 at r3 (raw file):

Previously, sherm1 (Michael Sherman) wrote…

BTW you need an @name here for grouping to work in doxygen.

Please generate the doxygen for this PR and inspect it to make sure it is formatted as you expected (and confirm here that it is).

Done. The @name keyword fixed the formatting. Thanks!


automotive/trajectory_agent.h, line 103 at r3 (raw file):

Previously, sherm1 (Michael Sherman) wrote…

BTW could this be SpatialVelocity? Then you can just copy it directly out of PoseVelocity.

(see above for the FrameVelocity rationale)


automotive/trajectory_agent.cc, line 40 at r3 (raw file):

Previously, sherm1 (Michael Sherman) wrote…

BTW I see that PoseVelocity isn't templatized. Does that mean the derivatives produced when T=AutoDiff are wrong? If so, please document. Otherwise please add a comment (not sure if this is the right place) explaining why everything is still good.

Done. (I've added a note within the class documentation to clarify.)


automotive/test/trajectory_agent_test.cc, line 57 at r3 (raw file):

Previously, sherm1 (Michael Sherman) wrote…

FYI spacing seems odd.

Done. (I think this was clang-format's fault)


Comments from Reviewable

@sherm1
Copy link
Member

sherm1 commented May 7, 2018

Reviewed 2 of 2 files at r4.
Review status: all files reviewed at latest revision, all discussions resolved, some commit checks pending.


automotive/trajectory_agent.h, line 41 at r4 (raw file):

///   heading is 0 rad when pointed +x, pi/2 rad when pointed +y;
///   heading is defined around the +z axis, positive-left-turn.
/// * speed: ṡ = √{ẋ² + ẏ²}

BTW ṡ -> s ? (Looks more like an acceleration if it is speed_dot.)


Comments from Reviewable

@jadecastro
Copy link
Contributor Author

Review status: 4 of 5 files reviewed at latest revision, 1 unresolved discussion.


automotive/trajectory_agent.h, line 41 at r4 (raw file):

Previously, sherm1 (Michael Sherman) wrote…

BTW ṡ -> s ? (Looks more like an acceleration if it is speed_dot.)

Done.


Comments from Reviewable

@jadecastro
Copy link
Contributor Author

@drake-jenkins-bot linux-xenial-clang-bazel-experimental-cache please

@jadecastro jadecastro merged commit ac1b321 into RobotLocomotion:master May 7, 2018
@jadecastro jadecastro deleted the auto-traj-agents branch May 7, 2018 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants