Skip to content

Commit fcbae08

Browse files
committed
Working on M frame methods for curvilinear mobilizer.
1 parent 012cc0f commit fcbae08

File tree

2 files changed

+30
-24
lines changed

2 files changed

+30
-24
lines changed

multibody/tree/curvilinear_mobilizer.h

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -22,36 +22,42 @@ namespace drake {
2222
namespace multibody {
2323
namespace internal {
2424

25-
/** A Mobilizer that describes the motion of the mobilized frame M along a
25+
/* A Mobilizer that describes the motion of the mobilized frame M along a
2626
piecewise constant curvature path contained in a plane.
2727
2828
The path is specified as a PiecewiseConstantCurvatureTrajectory, refer to that
2929
class documentation for further details on parameterization, conventions and
3030
notation used.
3131
3232
This mobilizer grants a single degree of freedom q that corresponds to the
33-
length s (in meters) along the path. The generalized velocity v = q̇
34-
corresponds to the magnitude of the tangential velocity. The mobilized frame M
35-
is defined according to the convention documented in
33+
length s (in meters) along the path. The generalized velocity v = q̇ (= ṡ)
34+
corresponds to the signed magnitude of the tangential velocity. The mobilized
35+
frame M is defined according to the convention documented in
3636
PiecewiseConstantCurvatureTrajectory. That is, axis Mx is the tangent to the
37-
trajectory, Mz equals the (constant) normal p̂ to the plane, and My = Mz x Mx.
37+
trajectory, Mz equals the (constant) normal p̂ to the plane, and My = Mz Mx.
3838
It is not required that M coincides with F at distance q = 0.
3939
40-
If the specified trajectory is periodic, the mobilizer describes a trajectory
41-
of length s_f that satisfies X_FM(q) = X_FM(q + s_f).
42-
4340
At any given point along the path, the turning rate ρ(q) (units of 1/m) is
44-
defined such the angular velocity is given by w_FM = ρ⋅v⋅Mz_F, i.e. |ρ(q)|
41+
defined such the angular velocity is given by ω_FM = ρ⋅v⋅Mz_F, i.e. |ρ(q)|
4542
corresponds to the path's curvature and its sign is defined via the right-hand
4643
rule about the plane's normal Mz.
4744
45+
If the specified trajectory is periodic, the mobilizer describes a trajectory
46+
of length s_f that satisfies X_FM(q) = X_FM(q + s_f) and ρ(q) = ρ(q + s_f).
47+
4848
Therefore the hinge matrix H_FM ∈ ℝ⁶ˣ¹ and its time derivative are
4949
50-
H_FM(q) = [ρ(q)⋅Mz_F(q)] Hdot_FM(q) = [ 0 ]
51-
[ Mx_F(q)], [ρ(q)⋅v⋅My_F(q)].
50+
H_FM_F(q) = [ρ(q)⋅Mz_F(q)] Hdot_FM_F(q,v) = [ 0 ]
51+
[ Mx_F(q)], [ρ(q)⋅v⋅My_F(q)]
52+
53+
(Recall that the time derivative taken in F of a vector r⃗ fixed in a frame
54+
M is given by ω_FM ⨯ r⃗, so DtF(Mx) = (ρ⋅v⋅Mz) ⨯ Mx = ρ⋅v⋅My.)
55+
56+
This is of course much nicer in M:
57+
H_FM_M(q) = [0 0 ρ(q) 1 0 0]ᵀ Hdot_FM_M = [ 0₆ ]ᵀ
5258
53-
where the angular component of Hdot_FM is zero since ρ(q) is constant within
54-
each piecewise segment in PiecewiseConstantCurvatureTrajectory.
59+
The angular component of Hdot_FM is zero since ρ(q) is constant within each
60+
piecewise segment in PiecewiseConstantCurvatureTrajectory.
5561
5662
@tparam_default_scalar */
5763
template <typename T>
@@ -67,7 +73,7 @@ class CurvilinearMobilizer final : public MobilizerImpl<T, 1, 1> {
6773
template <typename U>
6874
using HMatrix = typename MobilizerBase::template HMatrix<U>;
6975

70-
/** Constructor for a CurvilinearMobilizer describing the motion of outboard
76+
/* Constructor for a CurvilinearMobilizer describing the motion of outboard
7177
frame M along `curvilinear_path` with pose X_FM in the inboard frame F. Refer
7278
to the class documentation for further details on notation and conventions.
7379
@@ -96,49 +102,49 @@ class CurvilinearMobilizer final : public MobilizerImpl<T, 1, 1> {
96102
bool can_rotate() const final { return true; }
97103
bool can_translate() const final { return true; }
98104

99-
/** Gets the distance of travel along the path of the mobilizer from
105+
/* Gets the distance of travel along the path of the mobilizer from
100106
the provided context in meters.
101107
@param context The context of the model this mobilizer belongs to.
102108
@returns The distance coordinate of the mobilizer in the context. */
103109
const T& get_distance(const systems::Context<T>& context) const;
104110

105-
/** Sets the distance of travel along the path of the mobilizer from
111+
/* Sets the distance of travel along the path of the mobilizer from
106112
the provided context in meters.
107113
@param context The context of the model this mobilizer belongs to.
108114
@param distance The desired distance coordinate of the mobilizer.
109115
@returns a const reference to this mobilizer */
110116
const CurvilinearMobilizer<T>& SetDistance(systems::Context<T>* context,
111117
const T& distance) const;
112118

113-
/** Gets the tangential velocity of the mobilizer from the provided context in
119+
/* Gets the tangential velocity of the mobilizer from the provided context in
114120
meters per second.
115121
@param context The context of the model this mobilizer belongs to.
116122
@returns The velocity coordinate of the mobilizer in the context. */
117123
const T& get_tangential_velocity(const systems::Context<T>& context) const;
118124

119-
/** Sets the tangential velocity of the mobilizer from the provided context in
125+
/* Sets the tangential velocity of the mobilizer from the provided context in
120126
meters per second.
121127
@param context The context of the model this mobilizer belongs to.
122128
@param tangential_velocity The desired velocity coordinate of the mobilizer.
123129
@returns a const reference to this mobilizer */
124130
const CurvilinearMobilizer<T>& SetTangentialVelocity(
125131
systems::Context<T>* context, const T& tangential_velocity) const;
126132

127-
/** Computes the across-mobilizer transform X_FM(q) as a function of the
133+
/* Computes the across-mobilizer transform X_FM(q) as a function of the
128134
distance traveled along the mobilizer's path.
129135
@param q The distance traveled along the mobilizer's path in meters.
130136
@returns The across-mobilizer transform X_FM(q). */
131137
math::RigidTransform<T> calc_X_FM(const T* q) const;
132138

133-
/** Computes the across-mobilizer spatial velocity V_FM(q, v) as a function of
139+
/* Computes the across-mobilizer spatial velocity V_FM(q, v) as a function of
134140
the distance traveled and tangential velocity along the mobilizer's path.
135141
@param q The distance traveled along the mobilizer's path in meters.
136142
@param v The tangential velocity along the mobilizer's path in meters per
137143
second.
138144
@returns The across-mobilizer spatial velocity V_FM(q, v). */
139145
SpatialVelocity<T> calc_V_FM(const T* q, const T* v) const;
140146

141-
/** Computes the across-mobilizer spatial acceleration A_FM(q, v, v̇) as a
147+
/* Computes the across-mobilizer spatial acceleration A_FM(q, v, v̇) as a
142148
function of the distance traveled, tangential velocity, and tangential
143149
acceleration along the mobilizer's path.
144150
@param q The distance traveled along the mobilizer's path in meters.
@@ -149,7 +155,7 @@ class CurvilinearMobilizer final : public MobilizerImpl<T, 1, 1> {
149155
@returns The across-mobilizer spatial acceleration A_FM(q, v, v̇). */
150156
SpatialAcceleration<T> calc_A_FM(const T* q, const T* v, const T* vdot) const;
151157

152-
/** Projects the spatial force `F_Mo_F` on `this` mobilizer's outboard
158+
/* Projects the spatial force `F_Mo_F` on `this` mobilizer's outboard
153159
frame M onto the path tangent. Mathematically, tau = F_Mo_F⋅H_FMᵀ.
154160
155161
The result of this projection is the magnitude of a force (in N) along

multibody/tree/test/prismatic_spring_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ class SpringTester : public ::testing::Test {
2929
// Create an empty model.
3030
auto model = std::make_unique<MultibodyTree<double>>();
3131

32-
bodyA_ = &model->AddRigidBody("BodyA", SpatialInertia<double>::Zero());
33-
bodyB_ = &model->AddRigidBody("BodyB", SpatialInertia<double>::Zero());
32+
bodyA_ = &model->AddRigidBody("BodyA", SpatialInertia<double>::NaN());
33+
bodyB_ = &model->AddRigidBody("BodyB", SpatialInertia<double>::NaN());
3434

3535
model->AddJoint<WeldJoint>("WeldBodyAToWorld", model->world_body(), {},
3636
*bodyA_, {},

0 commit comments

Comments
 (0)