forked from RobotLocomotion/drake
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add constructors to RollPitchYaw that takes RotationMatrix and Quater…
…nion (RobotLocomotion#8721)
- Loading branch information
Showing
16 changed files
with
409 additions
and
390 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
#include "drake/common/eigen_types.h" | ||
#include "drake/common/extract_double.h" | ||
#include "drake/math/quaternion.h" | ||
#include "drake/math/roll_pitch_yaw.h" | ||
#include "drake/math/rotation_matrix.h" | ||
|
||
namespace drake { | ||
|
@@ -92,22 +93,22 @@ class Rotation { | |
|
||
/// Provides a representation of rotation as a vector of angles | ||
/// `[roll, pitch, yaw]` (in radians). | ||
Vector3<double> rpy() const { | ||
return math::QuaternionToSpaceXYZ(quaternion_); | ||
math::RollPitchYaw<double> rpy() const { | ||
return math::RollPitchYaw<double>(quaternion_); | ||
} | ||
|
||
// TODO([email protected]) Deprecate and/or remove roll()/pitch()/yaw(), | ||
// since they hide the call to rpy(), and since | ||
// most call-sites should probably be using something | ||
// else (e.g., quaternion) anyway. | ||
/// Returns the roll component of the Rotation (in radians). | ||
double roll() const { return rpy().x(); } | ||
double roll() const { return rpy().get_roll_angle(); } | ||
|
||
/// Returns the pitch component of the Rotation (in radians). | ||
double pitch() const { return rpy().y(); } | ||
double pitch() const { return rpy().get_pitch_angle(); } | ||
|
||
/// Returns the yaw component of the Rotation (in radians). | ||
double yaw() const { return rpy().z(); } | ||
double yaw() const { return rpy().get_yaw_angle(); } | ||
|
||
private: | ||
explicit Rotation(const Quaternion<double>& quat) : quaternion_(quat) {} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.