Parameters: |
---|
This is the base class for all holonomic constraints in a System. It should never be created directly. Constraints are created by instantiating a specific type of constraint.
See trep.constraints - Holonomic Constraints for the built-in types of constraints. Additional constraints can be added through either the Python or C-API.
Holonomic constraints restrict the allowable configurations of a mechanical system. Every constraint has an associated constraint function \(h(q) : Q \rightarrow R\). A configuration \(q\) is acceptable if and only if \(h(q) = 0\).
The name of this constraint or None.
The index of the constraint in System.constraints. This is also the index of the constraint’s force in any values of \(\lambda\) or its derivatives used through trep.
(read-only)
The constraint should be considered satisfied if \(|h(q)| < tolerance\). This is primarly used by the variational integrator when it finds the next configuration, or by System.satisfy_constraints().
Return type: | Float |
---|
Return the value of the constraint function at the system’s current state. This function should be implemented by derived Constraints.
Parameters: | q1 (Config) – Derivative variable |
---|---|
Return type: | Float |
Return the derivative of h with respect to q1.
Parameters: | |
---|---|
Return type: | Float |
Return the second derivative of h with respect to q1 and q2.
Parameters: | |
---|---|
Return type: | Float |
Return the third derivative of h with respect to q1, q2, and q3.
It is important that the derivatives of h() are correct. The easiest way to check their correctness is to approximate each derivative using numeric differentiation. These methods are provided to perform this test. The derivatives are only compared at the current configuration of the system. For improved coverage, try running each test several times at different configurations.
Parameters: |
|
---|---|
Return type: | Boolean indicating if all tests passed |
Check the derivatives against the approximate numeric derivative calculated from one less derivative (ie, approximate h_dq() from h() and h_dqdq() from h_dq()).
See System.test_derivative_dq() for details of the approximation and comparison.