Class SetMaskedCoordinates#
Defined in File SetMaskedCoordinates.h
Inheritance Relationships#
Base Type#
public Karana::Models::KModel< SetMaskedCoordinates >(Template Class KModel)
Class Documentation#
-
class SetMaskedCoordinates : public Karana::Models::KModel<SetMaskedCoordinates>#
Set masked joint coordinates from shared vector profiles.
A Q mask supplies position \( q(t) = p_q(t) \). A U mask supplies velocity \( u(t) = p_u(t) \), and Q_U supplies both. U and Q_U joints are prescribed: the profile supplies acceleration \( \dot{u}(t) = p_{\dot{u}}(t) \) so hybrid dynamics can solve the required force. A Q mask does not change the joint’s prescribed flag.
Construction and registration require unmasked, unprescribed joints. Registering installs the masks and samples the profiles. Unregistering clears the installed masks and prescribed flags. Rebuild the propagator state after either operation to continue from the current joint state. The caller creates and retargets the profiles; each derivative evaluation samples them at the supplied time.
See also
Public Types
-
using Coordinate = std::pair<kc::ks_ptr<kd::SubhingeBase>, kd::SubhingeMask>#
Joint and components to be omitted from the integrated state.
-
using Profile = kc::ks_ptr<ProfileGenerator<km::ArrayVec>>#
Vector profile for this joint’s coordinates.
Public Functions
-
SetMaskedCoordinates(std::string_view name, const kc::ks_ptr<kd::ModelManager> &mm, const std::vector<Coordinate> &coordinates, const std::vector<Profile> &profiles)#
Model constructor; please use create to allocate and register it.
- Parameters:
name – Unique model name.
mm – The ModelManager to register this model with.
coordinates – Joint/mask pairs with unique joints, one per profile.
profiles – Shared vector profiles, one per coordinate.
- Throws:
std::invalid_argument – if counts differ, a joint repeats, a mask is NONE, or a joint is null, masked, or prescribed.
-
~SetMaskedCoordinates() override#
Destructor for SetMaskedCoordinates.
-
void preDeriv(const km::Ktime &t, const km::Vec &x)#
Sample each profile at the solver’s evaluation time and enforce that masked values follow the profile.
- Parameters:
t – Current time; used to evaluate profiles.
x – Current state. Not used.
-
const std::vector<Binding> &getBindings() const#
Return bindings in their original coordinate order.
- Returns:
The joint, mask, and profile tuples retained by this model.
-
void updateProfiles(const std::map<kc::ks_ptr<kd::SubhingeBase>, Profile> &profiles)#
Update profiles for any subset of the bound joints.
- Parameters:
profiles – Map from bound joint to replacement vector profile. May be empty.
- Throws:
std::invalid_argument – if a joint is not bound, a profile is null, or its dimension does not match the joint. A rejected update changes no profiles.
Public Static Functions
-
static kc::ks_ptr<SetMaskedCoordinates> create(std::string_view name, const kc::ks_ptr<kd::ModelManager> &mm, const std::vector<Coordinate> &coordinates, const std::vector<Profile> &profiles)#
Install masks, sample initial profiles, and register the model.
- Parameters:
name – Unique model name.
mm – The ModelManager to register this model with.
coordinates – Joint/mask pairs with unique joints to mask.
profiles – One shared vector profile per coordinate.
- Throws:
std::invalid_argument – if counts differ, a joint repeats, a mask is NONE, or a joint is null, masked, or prescribed.
std::invalid_argument – if a joint or profile is null or a profile has the wrong joint dimension. Invalid bindings are rejected before any masks are changed.
- Returns:
The registered model.
-
using Coordinate = std::pair<kc::ks_ptr<kd::SubhingeBase>, kd::SubhingeMask>#