SensorBody
A sensor attached to a body at a local position \(\pLocB\), which measures one of the output variables of the body at that point.
Parameters
The parameters of the item; in a dictionary, its type is ‘Body’:
name |
type |
size |
default |
description |
|---|---|---|---|---|
name |
String |
‘’ |
sensor’s unique name |
|
bodyNumber |
ObjectIndex |
invalid (-1) |
body (=object) number to which sensor is attached to |
|
localPosition |
Vector3D |
3 |
[0.,0.,0.] |
(symbol: \(\pLocB\)) local (body-fixed) body position of sensor |
writeToFile |
Bool |
True |
True: write sensor output to file; flag is ignored (interpreted as False), if fileName=’’ |
|
fileName |
String |
‘’ |
directory and file name for sensor file output; empty: no file is written; a relative name is placed in |
|
outputVariableType |
OutputVariableType |
OutputVariableType::_None |
OutputVariableType for sensor |
|
storeInternal |
Bool |
False |
true: store sensor data in memory (faster, but may consume large amounts of memory); false: internal storage not available |
|
visualization |
VSensorBody |
parameters for visualization of item |
Visualization parameters
The parameters of VSensorBody, 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 |
Drawing
Drawn as all sensors.
Detailed description
Attached to
The body bodyNumber, at the point localPosition \(\pLocB\). The local position is given in the
body frame and measured from the reference point of the body - the position of its node, which
is referencePosition in CreateRigidBody. The center of mass of an ObjectRigidBody lies at
centerOfMass from it, so a sensor at the center of mass has that local position.
Measures
outputVariableType is one of the output variables of the body, evaluated at \(\pLocB\), as its page
lists them under Output variables - e.g. Position, Velocity, Displacement,
AngularVelocity; for a flexible body also strains or forces along its axis.
Mini example
#a point of a body given by its local position: a planar rigid body spinning about its center
node = mbs.AddNode(NodeRigidBody2D(referenceCoordinates=[0.5,0.2,0], initialVelocities=[0,0,0.5*np.pi]))
body = mbs.AddObject(ObjectRigidBody2D(nodeNumber=node, mass=1, inertia=0.1))
sPoint = mbs.AddSensor(SensorBody(bodyNumber=body, localPosition=[0.5,0,0],
outputVariableType=exu.OutputVariableType.Position,
storeInternal=True, writeToFile=False))
mbs.Assemble()
mbs.SolveDynamic()
#after a quarter turn the point [0.5,0,0] of the body at [0.5,0.2] is at [0.5,0.7,0]
exu.sys['testResult'] = mbs.GetSensorValues(sPoint)[1] #0.7
Examples (Ex) and TestModels (TM) that show this item, with weblink to github: tutorialSpringDamperCreate.py (Ex), tutorialRigidBody.py (Ex), tutorialRigidBodyCreate.py (Ex), fourBarMechanism3D.py (Ex)