Skip to content

Conversation

@jannick-schroeer
Copy link

Proposed change(s)

handle_syscommand uses a un-robust JSON decoding implementation. This leads to errors when using it in combination with Unity ROS Teleoperation.

[default_server_endpoint-1] json.decoder.JSONDecodeError: Expecting ',' delimiter: line 1 column 58 (char 57)
[default_server_endpoint-1] [INFO] [1761210822.634175002] [UnityEndpoint]: Connection from 127.0.0.1
[default_server_endpoint-1] [INFO] [1761210822.635462761] [UnityEndpoint]: Disconnected from 127.0.0.1
[default_server_endpoint-1] Exception in thread Thread-36:
[default_server_endpoint-1] Traceback (most recent call last):
[default_server_endpoint-1]   File "/usr/lib/python3.12/threading.py", line 1073, in _bootstrap_inner
[default_server_endpoint-1]     self.run()
[default_server_endpoint-1]   File "/home/jannick/ros-ws/build/ros_tcp_endpoint/ros_tcp_endpoint/client.py", line 213, in run
[default_server_endpoint-1]     self.tcp_server.handle_syscommand(destination, data)
[default_server_endpoint-1]   File "/home/jannick/ros-ws/build/ros_tcp_endpoint/ros_tcp_endpoint/server.py", line 126, in handle_syscommand
[default_server_endpoint-1]     params = json.loads(message_json)
[default_server_endpoint-1]              ^^^^^^^^^^^^^^^^^^^^^^^^
[default_server_endpoint-1]   File "/usr/lib/python3.12/json/__init__.py", line 346, in loads
[default_server_endpoint-1]     return _default_decoder.decode(s)
[default_server_endpoint-1]            ^^^^^^^^^^^^^^^^^^^^^^^^^^
[default_server_endpoint-1]   File "/usr/lib/python3.12/json/decoder.py", line 337, in decode
[default_server_endpoint-1]     obj, end = self.raw_decode(s, idx=_w(s, 0).end())
[default_server_endpoint-1]                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[default_server_endpoint-1]   File "/usr/lib/python3.12/json/decoder.py", line 353, in raw_decode
[default_server_endpoint-1]     obj, end = self.scan_once(s, idx)
[default_server_endpoint-1]    

Types of change(s)

  • Bug fix
  • New feature
  • Code refactor
  • Documentation update
  • Other (please describe)

Testing and Verification

Test Configuration:

  • Unity Version: 2022.3.12f1
  • Unity machine OS + version: Kubuntu 24.04.3 LTS x86_64, 2022.3.12f1
  • ROS machine OS + version: Kubuntu 24.04.3 LTS x86_64, ROS2 Jazzy
  • ROS–Unity communication: Local (Both Natively run on OS)

Checklist

(Note there is no dev branch, hence I would guess a pr to main-ros2 is acceptable)

  • Ensured this PR is up-to-date with the dev branch
  • Created this PR to target the dev branch
  • Followed the style guidelines as described in the Contribution Guidelines
  • Added tests that prove my fix is effective or that my feature works
  • Updated the Changelog and described changes in the Unreleased section
  • Updated the documentation as appropriate

Other comments

None

@Soldann
Copy link

Soldann commented Oct 23, 2025

This looks great :D

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