```{raw} latex \clearpage ``` (sec-item-noderigidbody2d)= # NodeRigidBody2D A 2D rigid body node for rigid bodies or beams. The node has 2 displacement degrees of freedom and one rotation coordinate (rotation around z-axis: $\psi_0$). All coordinates are {ref}`ODE2 `, used for second order differetial equations. ## Interface - Python names: `NodeRigidBody2D` or `Rigid2D`, and `VRigid2D` for its visualization - Provides: `Position2D`, `Orientation2D`, `RigidBody` - Node markers that can be attached: [](#sec-item-markernodeposition), [](#sec-item-markernoderigid) - Objects that take this node: [](#sec-item-objectmasspoint2d), [](#sec-item-objectrigidbody2d), [](#sec-item-objectbeamgeometricallyexact2d) ## Parameters The parameters of the item; in a dictionary, its type is 'RigidBody2D': | name | type | size | default | description | |---|---|---|---|---| | **name** | String | | '' | node's unique name | | **referenceCoordinates** | Vector3D | 3 | [0.,0.,0.] | (symbol: $\qv\cRef = [q_0,\,q_1,\,\psi_0]\tp\cRef$) reference coordinates (x-pos,y-pos and rotation) of node ==> e.g. ref. coordinates for finite elements; global position of node without displacement | | **initialCoordinates** | Vector3D | 3 | [0.,0.,0.] | (symbol: $\qv\cIni = [q_0,\,q_1,\,\psi_0]\tp\cIni$) initial displacement coordinates and angle (relative to reference coordinates) | | **initialVelocities** | Vector3D | 3 | [0.,0.,0.] | (symbol: $\dot \qv\cIni = [\dot q_0,\,\dot q_1,\,\dot \psi_0]\tp\cIni = [v_0,\,v_1,\,\omega_2]\tp\cIni$) initial velocity coordinates | | **visualization** | VNodeRigidBody2D | | | parameters for visualization of item | ## Visualization parameters The parameters of `VNodeRigidBody2D`, given as `visualization`: | name | type | size | default | description | |---|---|---|---|---| | **show** | Bool | | True | set true, if item is shown in visualization and false if it is not shown | | **drawSize** | float | | -1. | drawing size (diameter, dimensions of underlying cube, etc.) for item; size == -1.f means that default size is used | | **color** | Float4 | 4 | [-1.,-1.,-1.,-1.] | Default RGBA color for nodes; 4th value is alpha-transparency; R=-1.f means, that default color is used | ## Drawing Drawn as [all nodes](#sec-drawing-nodes); with `nodes.showBasis`, also its frame, of length `nodes.basisSize`. Settings beyond those of all nodes: [`general.axesTiling`](#sec-vsettingsgeneral), [`nodes.basisSize`](#sec-vsettingsnodes), [`nodes.showBasis`](#sec-vsettingsnodes). ## Output variables Available as `OutputVariableType` in sensors, `Get...Output()` and other functions: ```{tabularcolumns} \Y{0.25}\Y{0.25}\Y{0.5} ``` | output variable | symbol | description | |---|---|---| | Position | $\LU{0}{\pv}\cConfig = \LU{0}{[p_0,\,p_1,\,0]}\cConfig\tp= \LU{0}{\uv}\cConfig + \LU{0}{\pv}\cRef$ | global 3D position vector of node; $\uv\cRef=0$ | | Displacement | $\LU{0}{\uv}\cConfig = [q_0,\,q_1,\,0]\cConfig\tp$ | global 3D displacement vector of node | | Velocity | $\LU{0}{\vv}\cConfig = [\dot q_0,\,\dot q_1,\,0]\cConfig\tp$ | global 3D velocity vector of node | | Acceleration | $\LU{0}{\av}\cConfig = [\ddot q_0,\,\ddot q_1,\,0]\cConfig\tp$ | global 3D acceleration vector of node | | AngularVelocity | $\LU{0}{\tomega}\cConfig = \LU{0}{[0,\,0,\,\dot \psi_0]}\cConfig\tp$ | global 3D angular velocity vector of node | | CoordinatesTotal | | displacement/rotation coordinates of node including reference configuration | | Coordinates | $\cv\cConfig = [q_0,\,q_1,\,\psi_0]\tp\cConfig$ | coordinate vector of node, having 2 displacement coordinates and 1 angle | | Coordinates_t | $\dot\cv\cConfig = [\dot q_0,\,\dot q_1,\,\dot \psi_0]\tp\cConfig$ | velocity coordinates vector of node | | Coordinates_tt | $\ddot\cv\cConfig = [\ddot q_0,\,\ddot q_1,\,\ddot \psi_0]\tp\cConfig$ | acceleration coordinates vector of node | | RotationMatrix | $[A_{00},\,A_{01},\,A_{02},\,A_{10},\,\ldots,\,A_{21},\,A_{22}]\cConfig\tp$ | vector with 9 components of the rotation matrix $\LU{0b}{\Rot}\cConfig$ in row-major format, in any configuration; the rotation matrix transforms local ($b$) to global (0) coordinates | | Rotation | $[0,\,0,\,\theta_0]\tp\cConfig = [0,\,0,\,\psi_0]\tp\cRef + [0,\,0,\,\psi_0]\tp\cConfig$ | vector with 3rd angle around out of plane axis | | AngularVelocityLocal | $\LU{b}{\tomega}\cConfig = \LU{b}{[0,\,0,\,\dot \psi_0]}\cConfig\tp$ | local (body-fixed) 3D angular velocity vector of node | | AngularAcceleration | $\LU{0}{\talpha}\cConfig = \LU{0}{[0,\,0,\,\ddot \psi_0]}\cConfig\tp$ | global 3D angular acceleration vector of node | (description-noderigidbody2d)= ## Detailed description ### Coordinates | index | symbol | kind | meaning | frame | |---|---|---|---|---| | 0, 1 | $q_0,\,q_1$ | {ref}`ODE2 ` | displacement of the reference point of the body in $x$ and $y$ | global | | 2 | $\psi_0$ | {ref}`ODE2 ` | change of the rotation angle about the $z$-axis | - | ### Configuration With the rotation angle $\theta_{0} = \psi_{0}\cRef + \psi_{0}\cConfig$, the rotation matrix is $$ \LU{0b}{\Rot}\cConfig = \mr{\cos(\theta_0)}{-\sin(\theta_0)}{0}{\sin(\theta_0)}{\cos(\theta_0)}{0}{0}{0}{1}\cConfig $$ ### Frame and interpretation The displacement is given in the global $x$-$y$ plane and the angle about the global $z$-axis; body frame and global frame share the $z$-axis. ### Action on the equations of motion The three coordinates lead to three {ref}`ODE2 ` equations: the residuals of the forces in $x$ and $y$, and the residual of the torque about the $z$-axis, which is the same in the body and in the global frame. The velocity transformation is the identity, $\omega_z = \dot\theta_0$. **Example**: see [](#sec-item-objectrigidbody2d) (miniexample-noderigidbody2d)= ## Mini example ```python #a planar rigid body: x, y and the rotation angle, thrown with a spin node = mbs.AddNode(NodeRigidBody2D(referenceCoordinates=[0.5,0.2,0], initialVelocities=[1,0,2])) mbs.AddObject(ObjectRigidBody2D(nodeNumber=node, mass=2, inertia=0.1)) mbs.Assemble() mbs.SolveDynamic() #x = 1*t, angle = 2*t at t=1 exu.sys['testResult'] = sum(mbs.GetNodeOutput(node, exu.OutputVariableType.Coordinates)) #3 ``` Examples (Ex) and TestModels (TM) that show this item, with weblink to github: [`rigidPendulum.py`](https://github.com/jgerstmayr/EXUDYN/blob/master/python/Examples/rigidPendulum.py) (Ex), [`doublePendulum2D.py`](https://github.com/jgerstmayr/EXUDYN/blob/master/python/Examples/doublePendulum2D.py) (Ex), [`SliderCrank.py`](https://github.com/jgerstmayr/EXUDYN/blob/master/python/Examples/SliderCrank.py) (Ex), [`simple4linkPendulumBing.py`](https://github.com/jgerstmayr/EXUDYN/blob/master/python/Examples/simple4linkPendulumBing.py) (Ex), [`slidercrankWithMassSpring.py`](https://github.com/jgerstmayr/EXUDYN/blob/master/python/Examples/slidercrankWithMassSpring.py) (Ex)