Skip to content

feat /foot pedal integration#36

Open
Pruthvi-Neuracore wants to merge 4 commits intomainfrom
refactor/foot_pedal_teleop_alignment
Open

feat /foot pedal integration#36
Pruthvi-Neuracore wants to merge 4 commits intomainfrom
refactor/foot_pedal_teleop_alignment

Conversation

@Pruthvi-Neuracore
Copy link

Key Changes:

  1. Architectural Alignment: Moved the FootPedal logic from the core neuracore package into example_agilex/examples/common/threads/.

  2. Threaded Implementation: Refactored the FootPedal from a heavy class into a lightweight thread function. This matches our standard pattern: threads are plain functions that use the DataManager for shutdown signaling and accept callbacks directly.

  3. Robust Imports: Implemented an importlib-based solution in 9_leader_arm_teleop_agilex.py to bypass the common namespace collision between the AgileX and SO-101 repos, ensuring both can be used together reliably.

  4. New Unified Teleop: Created 9_leader_arm_teleop_agilex.py for SO-101 leader + PiPER teleoperation, incorporating the new pedal logic (A: Enable, B: Home, C: Record).

  5. Driver Fixes: Optimized the foot pedal driver to use evdev for exclusive device access on Linux, preventing key leakage to the terminal, with a pynput fallback.

@@ -0,0 +1,51 @@
# Foot Pedal Control System
Copy link
Contributor

Choose a reason for hiding this comment

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

No need for a READ here. can be a short description in the script docstring

@@ -0,0 +1,9 @@
#!/bin/bash
Copy link
Contributor

Choose a reason for hiding this comment

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

as discussed offline, to be deleted

@@ -0,0 +1,341 @@
#!/usr/bin/env python3
Copy link
Contributor

Choose a reason for hiding this comment

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

As discussed offline, we will remove this for now

with self._ik_state._lock:
return self._ik_state.success

# ============================================================================
Copy link
Contributor

Choose a reason for hiding this comment

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

not needed after removing example 10

self.rgb_image: np.ndarray | None = None


class LeaderMappedState:
Copy link
Contributor

Choose a reason for hiding this comment

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

not needed after removing example 10

from common.threads.joint_state import joint_state_thread
from common.threads.quest_reader import quest_reader_thread
from meta_quest_teleop.reader import MetaQuestReader
from neuracore.core.input_devices.foot_pedal import FootPedal
Copy link
Contributor

Choose a reason for hiding this comment

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

Neuracore should never have hardware devices.

the foot pedal class should be here inside this example.

# Foot Pedal Initialization
print("\n⌨️ Initializing Foot Pedals...")
pedal = FootPedal()
pedal.on("activate", toggle_robot_state)
Copy link
Contributor

Choose a reason for hiding this comment

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

Better event naming would be
button_a
button_b
button_c

as this keeps them task-agnostic, making the FootPedal class more useful for any task.

sys.path.insert(0, str(Path(__file__).parent.parent.parent))

import neuracore as nc
from neuracore.core.input_devices.foot_pedal import FootPedal
Copy link
Contributor

Choose a reason for hiding this comment

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

Neuracore should never have hardware devices.

the foot pedal class should be here inside this example.

print("\n⌨️ Initializing Foot Pedal...")
pedal = FootPedal()

if not any(pedal.mappings.values()):
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this checking and what is run_pedal_config.sh

@@ -0,0 +1,113 @@
#!/usr/bin/env python3
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the script is obsoleted by the example 7 as it is doing a very similar job. might not be needed

@Pruthvi-Neuracore Pruthvi-Neuracore force-pushed the refactor/foot_pedal_teleop_alignment branch from f98f447 to f78d085 Compare March 16, 2026 14:58
Copy link
Author

@Pruthvi-Neuracore Pruthvi-Neuracore left a comment

Choose a reason for hiding this comment

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

Integrated the foot pedal into the standard thread system, and removed the discussed Leader arm files for now. the Foot_pedal.py acts as the main class and the 7_teleop_with_pedal.py imports from this class to follow the threads, Ready for review again!

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