SensorNode
A sensor attached to a node, which measures one of the output variables of the node.
Parameters
The parameters of the item; in a dictionary, its type is ‘Node’:
name |
type |
size |
default |
description |
|---|---|---|---|---|
name |
String |
‘’ |
sensor’s unique name |
|
nodeNumber |
NodeIndex |
invalid (-1) |
node number to which sensor is attached to |
|
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 |
VSensorNode |
parameters for visualization of item |
Visualization parameters
The parameters of VSensorNode, 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 node nodeNumber: every node, with ODE2, ODE1 or other coordinates.
Measures
outputVariableType is one of the output variables of the node, as its page lists them under
Output variables - Position, Velocity, Coordinates, and for a rigid body node also
RotationMatrix, AngularVelocity and the like. The frame is the one the node page gives for the
variable.
Mini example
#the position of a node, stored during the simulation
node = mbs.AddNode(NodePoint(referenceCoordinates=[0,0,0], initialVelocities=[1,0,0]))
mbs.AddObject(ObjectMassPoint(nodeNumber=node, mass=1))
sNode = mbs.AddSensor(SensorNode(nodeNumber=node, outputVariableType=exu.OutputVariableType.Position,
storeInternal=True, writeToFile=False))
mbs.Assemble()
mbs.SolveDynamic()
#rows [t, x, y, z]; the last row at t=1
data = mbs.GetSensorStoredData(sNode)
exu.sys['testResult'] = data[-1,0] + data[-1,1] #1+1
Examples (Ex) and TestModels (TM) that show this item, with weblink to github: plotSensorExamples.py (Ex), sensorUserFunctionTest.py (TM), springDamperUserFunctionTest.py (TM), rigidBodyCOMtest.py (TM), plotSensorTest.py (TM)