Skip to content

Conversation

@bchung2017
Copy link

@bchung2017 bchung2017 commented Feb 21, 2025

This pull request concerns the sample Python scripts mentioned as the sample UDP code for OpenBCI/Documentation#188

Previously, udp_receive_marker.py expected incoming UDP packets to be in JSON format. However, udp_send_marker.py (and the OpenBCI GUI's Java implementation) sends raw 4-byte data instead. This mismatch caused decoding errors when receiving markers, as shown below:

(venv) bchung2017@LAPTOP-N4UVVLMN:~/openbci$ python3 -m udp_receive_marker --ip 127.0.0.1 --port 12345 --option print
--------------------
-- UDP LISTENER --
--------------------
IP: 127.0.0.1
PORT: 12345
--------------------
print option selected
Listening...
'utf-8' codec can't decode byte 0x8b in position 3: invalid start byte
'utf-8' codec can't decode byte 0x80 in position 2: invalid start byte
'utf-8' codec can't decode byte 0xe0 in position 1: invalid continuation byte
<continued>

The script has been updated to properly handle raw byte data, ensuring compatibility with udp_send_marker.py and OpenBCI GUI. After the fix, the sample script now correctly receives and prints markers:

(venv) bchung2017@LAPTOP-N4UVVLMN:~/openbci$ python3 -m udp_receive_marker --ip 127.0.0.1 --port 12345 --option print
--------------------
-- UDP LISTENER --
--------------------
IP: 127.0.0.1
PORT: 12345
--------------------
print option selected
Listening for UDP packets...
Received Marker: 2.506424330049714
Received Marker: 1.5585284066901215
Received Marker: 2.8304827346407384
Received Marker: 1.0063118242670144

…m udp packets but now receives raw byte data sent by udp_send_marker.py
@bchung2017 bchung2017 changed the title Fixed udp_receive_marker.py Updated udp_receive_marker.py to receive byte input instead of JSON Feb 21, 2025
@retiutut
Copy link
Member

Unable to replicate using #1239

@retiutut retiutut closed this Mar 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants