This sensor computes the magnetic field vector, at the sensor position. It relies on the WMM2015 model, available at NOAA.
For proper computation, the sensor needs a real position on Earth, and so the following properties should be added at the environment level:
- longitude in degrees (double) of Blender origin
- latitude in degrees (double) of Blender origin
- altitude in m of the Blender origin
- optionnaly angle_against_north in degrees is the angle between geographic north and the blender X axis. angle_against_north is positive when the blender X-axis is east of true north, and negative when it is to the west.
You can set these properties in your scripts with <component>.properties(<property1>=..., <property2>=...).
the date used to adjust for magnetic field. If not precised, consider the today date
This sensor exports these datafields at each simulation step:
number of seconds in simulated time
Northern component of the magnetic field vector, in nT
Eastern component of the magnetic field vector, in nT
Downward component of the magnetic field vector, in nT
Returns the properties of a component.
a dictionary of the current component’s properties
Returns the current data stored in the sensor.
a dictionary of the current sensor’s data
Modify one property on a component
Returns the configurations of a component (parsed from the properties).
a dictionary of the current component’s configurations
The following examples show how to use this component in a Builder script:
from morse.builder import * # adds a default robot (the MORSE mascott!) robot = Morsy() # creates a new instance of the sensor magnetometer = Magnetometer() # place your component at the correct location magnetometer.translate(<x>, <y>, <z>) magnetometer.rotate(<rx>, <ry>, <rz>) robot.append(magnetometer) # define one or several communication interface, like 'socket' magnetometer.add_interface(<interface>) env = Environment('empty')