Some optional functions may not be available, depending on your type of license.
UDP Output Overview¶
The data received from the sensor insoles can be exported in real-time via UDP. Using this feature, the Moticon sensor insoles can be used as a component of a larger system. For example, you may wish to combine the sensor insole data with other (third party) sensors, and use custom software to combine the different sensor systems in real-time for providing e.g. motion feedback.
The UDP export sends the sensor insole data obtained during a Live Capture to a specified IP address as periodic UPD packets. The packet contents (a timestamp is always included) and packet rate can be configured.
The Moticon Science Software provides extensive functionality for importing video and numeric data, both in real-time and using file import. It allows in particular for asynchronous data, heterogenous sampling rates, and unit assignment. Instead of exporting data via UDP, you may also consider to import external data into the Moticon Science Software.
The following illustration shows both the case of software running on different computers, and the case where data shall be exported to a program running on the same computer. Note that the IP addresses and port numbers are just examples and must be adapted to your system.
Setting up UDP Output¶
Please follow these instructions to set up the UDP export in the Moticon software:
- In Settings, go to the UDP Output section.
- Make sure that the UDP output is turned Off, otherwise the settings cannot be edited.
- Enter the IP address and Port number to which the UDP packets should be sent.
- Use the channel filter to specify the desired data channels. This is recommended, since otherwise the UDP packets are extremely large. Example: If you wish to export the total force and all acceleration values of both left and right insole, type "total_force acc" in the channel filter. The preview of the UDP packet setup is helpful for checking the result of the current channel filter settings. The timestamp is always part of the UDP packet.
- Finally, turn On the UDP output.
Carrying out a UDP Data Export¶
When the toggle box in the UDP output settings has been turned to 'On', the configured channels will be transmitted to the configured IP address as soon as Live Capture data is received from sensor insoles.
No UDP packes are sent when downloading Recording data from sensor insoles, or when replaying measurements in Analyze.
Python Example for UDP Receiver¶
An example for a program receiving UDP packets exported from the Moticon software is given below as Python code (UDP server). If your external system has no UDP software interface, this Python code may serve as a basis for an adapter software.
Extending this code to transfer data to an external measurement system requires additional development effort which is not provided by Moticon.
import socket import argparse def receive_messages(input_ip, port): sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.bind((input_ip, port)) while True: data, addr = sock.recvfrom(1024) datachannels = data.split() values = [float(x) for x in datachannels] print values if __name__ == '__main__': parser = argparse.ArgumentParser(description="Example UDP receiver") parser.add_argument("--host", default="192.168.0.20", help="IP address of the receiving network interface") parser.add_argument("--port", default=8888, type=int, help="Port to listen on") args = parser.parse_args() receive_messages(args.host, args.port)