Generic motion sensor plugin for Hydromagic
The generic motion sensor plugin can be used to decode serial data from a motion sensor or IMU, without the need to have a dedicated plugin. In this generic plugin, you can define the data format which is expected to be sent by the motion sensor. This plugin should allow you to use virtually any motion sensor which outputs ASCII or NMEA0183 data over a serial connection, like RS232 or RS485 (with a RS485 to RS232 converter), or over a network connection, like Ethernet or WiFi.
By defining a header, angle (yaw, pitch and roll) value offsets, angle value lengths and optional scales, you should be able to decode data from almost any single, dual or triple axis motion sensor.
NOTE: Some motion sensors support the so called "Polling Mode". Make sure that your motion sensor device is in "Continuous Output Mode" when it is used with this plugin. Please refer to the documentation on how to switch between the modes if supported.
Loading the generic motion sensor plugin for Hydromagic
To load this plugin, open the preferences window by selecting "Preferences..." from the "Options" menu. In the window that appears, select the "Devices" tab. Next, click the 'Add...' button.
The devices tab in the "Preferences" dialog.
A list of available plugins will be displayed. In this list, select the "Hydromagic Generic Motion Sensor" plugin and click "OK" to load and display the configuration dialog.
select the Hydromagic Generic Motion Sensor plugin from the list of plugins and click "OK".
Configuring the generic motion sensor plugin
Serial or Ethernet Communications
First, you must configure the serial or Ethernet communication with the motion sensor. This plugin supports incoming data over a serial port, Ethernet or WiFi. For more information on this, please see the General information on using plugins document.
Configuring the data format
In this example we will show an example of how to configure a custom data format. Most sensors output the axis direction, a sign (+/-) and the angle value. Below is a sample ASCII (NMEA0183) output. In this example (taken from the VectorNav VN-100 IMU device), the first value after the header is yaw, the second value is the pitch and the third value is the roll angle. The remaining values are raw IMU values and can be ignored.
$VNYMR,-093.897,-000.510,+000.958,-00.0096,+00.1950,+00.3955,-00.067,-00.127,-09.647,+00.000068,-00.000370,+00.000722*68<CR><LF> $VNYMR,-093.870,-000.510,+000.955,-00.0108,+00.1950,+00.3940,-00.080,-00.154,-09.702,+00.000599,+00.000564,+00.000206*6E<CR><LF> $VNYMR,-093.926,-000.518,+000.942,-00.0152,+00.2306,+00.4206,-00.106,-00.145,-09.606,-00.000352,-00.001053,+00.000405*67<CR><LF> $VNYMR,-093.927,-000.519,+000.942,-00.0190,+00.2320,+00.4218,-00.099,-00.139,-09.745,+00.000562,+00.000372,+00.000552*6F<CR><LF> $VNYMR,-093.929,-000.518,+000.941,-00.0177,+00.2320,+00.4190,-00.040,-00.159,-09.618,-00.000242,+00.001208,+00.000450*6F<CR><LF> $VNYMR,-093.933,-000.518,+000.941,-00.0165,+00.2266,+00.4263,-00.087,-00.185,-09.668,-00.000175,-00.000868,-00.000178*63<CR><LF> $VNYMR,-093.938,-000.518,+000.941,-00.0177,+00.2306,+00.4219,-00.117,-00.155,-09.656,-00.000320,+00.000204,-00.000540*62<CR><LF> $VNYMR,-093.941,-000.518,+000.940,-00.0190,+00.2306,+00.4275,-00.070,-00.159,-09.601,-00.000146,+00.000892,+00.001445*64<CR><LF> $VNYMR,-093.946,-000.518,+000.941,-00.0152,+00.2292,+00.4221,-00.090,-00.132,-09.734,-00.000049,-00.000528,+00.001260*60<CR><LF> $VNYMR,-093.947,-000.518,+000.940,-00.0203,+00.2280,+00.4232,-00.094,-00.171,-09.634,+00.000315,+00.000059,-00.000090*67<CR><LF> 012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789Output data captured from the VectorNav VN-100 IMU device - Yaw, pitch and roll data is sent as NMEA0183 sentence.
Header
The header field is used to check whether the data line contains the data we need. When this field is empty, each data sentence is parsed. In this example, all values are in the same line (starting with $VNYMR), so we leave the header field values empty. When for instance you are using a dual axis sensor where the pitch and roll angle values are prefix by "X=" or "Y=" respectively, and only the vertical value is required, you must set the header value to "Y=".
Angle values and lengths
Now we need to tell the software where the actual angle values are in the data sentence. Please note that this only will work when the angle is sent as an ASCII (readable) value. Binary data formats are not supported by this plugin. For binary formats a dedicated plugin needs to be developed. Also note that the characters are zero indexed, which means that the first character is at index zero ("$" = 0, "V" = 1, "N" = 3 etc..).
The (yaw) angle value starts at index '7' and is '10' characters long in our example (the sign also counts as a character). For the value length, always count the number of digits including the sign (+/-) and decimal dot (.). In the same line, the pitch value starts at index '17' and the roll values at index '27. All values are 10 characters in length.
Scale / Units
Use a scale only when the angle is not in degrees. For instance, when the angle is in hundreds of degrees, use 100. In this example, scaling is not used, so the scale values should be set to '1.0'.
The Generic motion sensor plugin configuration window.
Using the "Yaw" value as vessel heading
When your motion sensor or IMU is capable of outputting the magnetic heading as well (like the sensor in the example above), you have to set the heading source to magnetic in the software. To do so, select the "Preferences" option from the "Options" menu, and select the "Calibration" tab in the "Preferences" window:
Select the "Use Magnetic Heading" option in the "Calibration" tab.
In this tab, select the "Use Magnetic Heading" option from the "Heading Mode" drop-down list. After saving the selection by clicking the "OK", Hydromagic will use the IMU yaw value as heading for the vessel and data processing. To switch back to the heading reported by the GNSS receiver, set this value to 'Use True Heading,' which causes the software to use the "Course Over Ground" value instead.
Testing the plugin configuration
When data is received, you should be able to see the incoming yaw, pitch, and roll data information in the data window. If no data is displayed, you can check whether data is coming in using the 'Communications Monitor'. The "Communications Monitor" can also be used to determine which data format is used by the motion sensor.
Open the preferences window by selecting "Preferences..." from the "Options" menu. In the window that appears, select the "Devices" tab. Next select the "Hydromagic Generic Motion Sensor" and click the "Monitor..." button. The communication monitor appears, and should display incoming ASCII or NMEA0183 sentences. If the monitor does not display any incoming data, the serial port or serial speed setting might be incorrect.
When you encounter problems getting the serial port to receive data, we suggest you look at our YouTube tutorial on troubleshooting serial communications using the puTTY software (free software).
Testing the generic motion sensor plugin settings using the device monitor.
Unloading the generic motion sensor plugin
To unload the generic motion sensor plugin, open the preferences window by selecting "Preferences..." from the "Options" menu. In the window that appears, select the "Devices" tab. Next select the "Hydromagic Generic Motion Sensor" plugin and click the "Remove..." button.
Plugins can be unloaded by using the "Remove" button.