Skip to content

Add GUI node with shared memory communication system - #1

Merged
mmmarinho merged 5 commits into
jazzyfrom
add-gui-and-shared-memory
Aug 14, 2026
Merged

Add GUI node with shared memory communication system#1
mmmarinho merged 5 commits into
jazzyfrom
add-gui-and-shared-memory

Conversation

@mmmarinho

Copy link
Copy Markdown
Contributor

This PR ports the GUI and shared memory system from sas_force_sensor_bota into sas_force_sensor, and creates a new Python node that bridges sas::ForceSensorClient to the GUI via shared memory.

This PR was created by an AI agent (OpenHands) on behalf of the user.

Changes

  • Shared memory module (sas_force_sensor/shared_memory/)

    • common.py – shared memory field index map
    • server.pyForceSensorSharedMemoryServer for writing wrench data
    • client.pyForceSensorSharedMemoryClient for reading wrench data
    • Ported from sas_force_sensor_bota with updated import paths.
  • GUI (sas_force_sensor/gui.py)

    • Live plots for force (fx, fy, fz) and torque (τx, τy, τz)
    • Vertical sliders for force/torque norm
    • Reads from ForceSensorSharedMemoryClient via shared memory.
  • Node (sas_force_sensor/gui_node.py)

    • Creates an sas::ForceSensorClient to subscribe to wrench data.
    • Spins the ROS 2 node and writes force/torque readings to shared memory.
    • Launches the GUI in a separate process via multiprocessing.
  • Entry point (scripts/sas_force_sensor_gui.py)

    • Run via ros2 run sas_force_sensor sas_force_sensor_gui.
  • Docker (docker/Dockerfile, docker/compose.yml)

    • Added pyqtgraph, PyQt6, qdarktheme pip packages to Dockerfile.
    • Added sas_force_sensor_gui service to compose.yml with X11 forwarding.
    • Added X11 environment variables to the existing sas_force_sensor service.

Usage

# Run the GUI node (requires an active force sensor publisher on the same ROS domain)
docker compose up sas_force_sensor_gui

- Port shared memory module from sas_force_sensor_bota (server, client, common)
- Port GUI (gui.py) from sas_force_sensor_bota with force/torque live plots
- Add gui_node.py: ROS 2 node that bridges sas::ForceSensorClient to the GUI
  via shared memory using ForceSensorSharedMemoryServer
- Add sas_force_sensor_gui entry point script
- Update Dockerfile to install PyQt6, pyqtgraph, qdarktheme dependencies
- Update compose.yml with sas_force_sensor_gui service and X11 forwarding
@mmmarinho mmmarinho self-assigned this Aug 14, 2026
@mmmarinho

Copy link
Copy Markdown
Contributor Author

Added Xvfb headless display support to the sas_force_sensor_gui service in compose.yml. The service now:

  1. Installs xvfb (sudo apt-get install -y xvfb)
  2. Starts a virtual framebuffer on display :99 (sudo /usr/bin/Xvfb :99 -screen 0 1280x1024x24 &)
  3. Exports DISPLAY=:99 so PyQt6 renders headlessly.

This allows the GUI service to run without a real display — e.g. on GitHub Actions CI.

This comment was added by an AI agent (OpenHands) on behalf of the user.

@mmmarinho

Copy link
Copy Markdown
Contributor Author

Replaced the qdarktheme pip install with an explicit pyqtdarktheme==2.1.0 install using --ignore-requires-python to work around Python version compatibility issues:

# https://github.com/bhowiebkr/laser-level-webcam/issues/28
RUN python3 -m pip install pyqtdarktheme==2.1.0 --ignore-requires-python --break-system-packages

This follows the workaround from laser-level-webcam#28.

This comment was added by an AI agent (OpenHands) on behalf of the user.

@mmmarinho mmmarinho left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

👍

@mmmarinho
mmmarinho merged commit 869a9d2 into jazzy Aug 14, 2026
6 checks passed
@mmmarinho
mmmarinho deleted the add-gui-and-shared-memory branch August 14, 2026 10:17
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