```{raw} latex \clearpage ``` (sec-item-sensormarker)= # SensorMarker A sensor attached to a marker, which measures what the marker provides, in the current configuration. ## Parameters The parameters of the item; in a dictionary, its type is 'Marker': | name | type | size | default | description | |---|---|---|---|---| | **name** | String | | '' | sensor's unique name | | **markerNumber** | MarkerIndex | | invalid (-1) | marker 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 `exudyn.config.outputDirectory` if that is set; the directory is created if it does not exist | | **outputVariableType** | OutputVariableType | | OutputVariableType::_None | OutputVariableType for sensor; output variables are only possible according to markertype, see general description of SensorMarker | | **storeInternal** | Bool | | False | true: store sensor data in memory (faster, but may consume large amounts of memory); false: internal storage not available | | **visualization** | VSensorMarker | | | parameters for visualization of item | ## Visualization parameters The parameters of `VSensorMarker`, 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](#sec-drawing-sensors). (description-sensormarker)= ## Detailed description ### Attached to The marker `markerNumber`, any kind of marker. ### Measures What the marker provides, which depends on its types; the coordinates only in the **current** configuration: | the marker provides | `outputVariableType` can be | |---|---| | a position (`MarkerBodyPosition`, `MarkerNodePosition`, ...) | `Position`, `Displacement`, `Velocity` | | an orientation (`MarkerBodyRigid`, `MarkerNodeRigid`, ...) | in addition `RotationMatrix`, `Rotation`, `AngularVelocity`, `AngularVelocityLocal`, `HomogeneousTransformation` | | coordinates (`MarkerNodeCoordinate`, `MarkerNodeCoordinates`, ...) | `Coordinates`, `Coordinates_t` | | a relative coordinate of two bodies | `Coordinates`, `Coordinates_t` | Markers have no output variables of their own, which is why this sensor lists them here. (miniexample-sensormarker)= ## Mini example ```python #what a marker provides, here the velocity of a point of a body node = mbs.AddNode(NodePoint(referenceCoordinates=[0,0,0], initialVelocities=[0,2,0])) body = mbs.AddObject(ObjectMassPoint(nodeNumber=node, mass=1)) mBody = mbs.AddMarker(MarkerBodyPosition(bodyNumber=body, localPosition=[0,0,0])) mbs.AddLoad(LoadForceVector(markerNumber=mBody, loadVector=[0,-1,0])) sVelocity = mbs.AddSensor(SensorMarker(markerNumber=mBody, outputVariableType=exu.OutputVariableType.Velocity, storeInternal=True, writeToFile=False)) mbs.Assemble() mbs.SolveDynamic() #v = v0 + F/m*t at t=1 exu.sys['testResult'] = mbs.GetSensorValues(sVelocity)[1] #1 ``` Examples (Ex) and TestModels (TM) that show this item, with weblink to github: [`plotSensorTest.py`](https://github.com/jgerstmayr/EXUDYN/blob/master/python/TestModels/plotSensorTest.py) (TM), [`pendulumFriction.py`](https://github.com/jgerstmayr/EXUDYN/blob/master/python/TestModels/pendulumFriction.py) (TM)