Skip to content

Refactor - Multithread modbus communication#21

Merged
macmacal merged 46 commits intohumble-develfrom
feature/multithread_refactor
Aug 18, 2025
Merged

Refactor - Multithread modbus communication#21
macmacal merged 46 commits intohumble-develfrom
feature/multithread_refactor

Conversation

@macmacal
Copy link
Contributor

@macmacal macmacal commented Aug 12, 2025

Description

After an attempt of introduction of a separate thread for the modbus communication in #19, more changes in the codebase were needed.
This resulted in a major refactor of the codebase.

  • It fixes the bug in the aegis_ros repository: Gripper communication takes too much bandwidth (causes RTDE errors) aegis_ros#38
  • The issue with the ros2_control_examples warnings is not showing anymore, so it was possible to to re-enable the -Werror compile flag Fix compile warnings from the ros2_control example #5 .
  • The new thread with mutexes are placed in the HW interface.
  • Introducing SocatManager - the robotiq_hande_driver can now manage the external socat process and spawn it at will (via new boolean URDF param called create_socat_tty).
  • Improved logging with colors, new namespace colour in a brand new utils.hpp.
  • Cleanup of the doc strings.
  • Renamed application.hpp/cpp into hande_gripper.hpp/cpp.
  • Changed plain arrays uint8_t bytes_[] into std::array<uint8_t, *>.
  • Moved all logic from the communication.cpp/hpp to protocol_logic.cpp/hpp.
  • Moved all non-trivial definitions from *.hpps to *.cpps.
  • Moved from C-like functions to C++ ones (e.g. to chrono and thread instead of usleep()).
  • Encapsulated whole Communication config into CommunicationConfig struct.
  • Fixed typos with wrong values in GRIPPER_OUTPUT_FIRST_REG and GRIPPER_INPUT_FIRST_REG.
  • Introduced 4 new params for URDFs:
    • frequency_hz (int) to control the ammount of sleep rate in new thread
    • create_socat_tty (bool) to create a virtual serial port,
    • ip_adress and port to configure the creation of virtual serial port with socat,
  • renamed tty param to tty_port for better clarity.

Note

For this PR we should use the squash marge option

Motivation and context

  • To fix the integration with the UR's RTDE protocol.

Related PRs

Related issues

How has this been tested?

  • Tested manually on the Aegis robot, on the geonosis PC, with the whole aegis_ros stack.

Checklist

  • All TODOs in the code have been resolved or linked to a proper issue.
  • Code has been (auto)formatted.
  • Documentation (e.g., README, CHANGELOG, Wiki) has been updated.
  • All automated checks have passed.

Clickup task: 869972nfu

@macmacal macmacal requested review from sivral and slimasziom August 12, 2025 13:03
@macmacal macmacal marked this pull request as ready for review August 13, 2025 19:31
Copy link
Contributor

@slimasziom slimasziom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor changes, if any. LGTM 👍

Copy link
Contributor

@sivral sivral left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@macmacal macmacal merged commit 834c9b0 into humble-devel Aug 18, 2025
1 check passed
@macmacal macmacal deleted the feature/multithread_refactor branch August 18, 2025 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gripper communication takes too much bandwidth (causes RTDE errors) Fix compile warnings from the ros2_control example

3 participants