What is the correct syntax for creating a Fixed
Joint, so it can be added to a Mechanism?
A Revolute Joint is created by
revolute_joint = Joint("revolute_joint", Revolute(axis) )
but a Fixed Joint I can’t get to accept anything.
# these all fail
fixed_joint1 = Joint("fixed_joint", Fixed() )
fixed_joint2 = Joint("fixed_joint", Fixed )
fixed_joint3 = Joint("fixed_joint", Fixed(axis) )
all result in a form of
MethodError: no method matching RigidBodyDynamics.Fixed( ....)
The type `RigidBodyDynamics.Fixed` exists, but no method is defined for this combination of argument types when trying to construct it.
Looking at the docs and source it shows the struct
for Revolute()
takes an axis, but Fixed
takes nothing
struct Fixed{T} <: JointType{T} end
struct Revolute{T} <: JointType{T}
axis::SVector{3, T}
rotation_from_z_aligned::RotMatrix3{T}
function Revolute{T}(axis::AbstractVector) where {T}
a = normalize(axis)
new{T}(a, rotation_between(SVector(zero(T), zero(T), one(T)), SVector{3, T}(a)))
end
end
Example use in the quick start Double Pendulum :
Application in Mechanism replacing the elbow joint by a fixed joint:
l_1 = -1. # length of the upper link
I_2 = 0.333 # moment of inertia about joint axis
c_2 = -0.5 # center of mass location with respect to joint axis
m_2 = 1. # mass
inertia2 = SpatialInertia(CartesianFrame3D("lower_link"),
moment=I_2 * axis * axis',
com=SVector(0, 0, c_2),
mass=m_2)
lowerlink = RigidBody(inertia2)
elbow = Joint("elbow", Revolute(axis)) # <<<< Change this to Fixed
# elbox_fixed = Joint("elbow", Fixed???? )
before_elbow_to_after_shoulder = Transform3D(
frame_before(elbow), frame_after(shoulder), SVector(0, 0, l_1))
attach!(doublependulum, upperlink, lowerlink, elbow,
joint_pose = before_elbow_to_after_shoulder)