ROS 2¶
metaquest-teleop publishes the hands on ROS 2 topics, with standard messages only, so it works
on ROS 2 Humble and Jazzy with nothing to build.
Run it¶
Source ROS, then run it from any Python environment, a conda one too:
source /opt/ros/jazzy/setup.bash # or humble
metaquest-teleop
It says publishing on ROS 2, and ros2 topic list shows the /metaquest/... topics. ROS 2
runs on its own Python (3.10 for Humble, 3.12 for Jazzy); from another one, such as a conda
environment with Python 3.10, it publishes through a small helper with ROS’s Python, and says
so. Without ROS it runs as usual and says it is not publishing. --ros makes ROS required,
--no-ros turns it off, and --no-adapt leaves out the ADAPT hand’s topics.
Topics¶
Topic |
Message |
|
|---|---|---|
|
|
your 20 joint angles, radians |
|
|
your wrist |
|
|
your 25 joints |
|
|
thumb tip to index tip, metres |
|
|
the ADAPT hand’s 20 joint angles |
|
|
its 13 motor angles, then its 2 wrist motors at 0 (fixed): targets for a PID |
|
|
your wrist, with the ADAPT axes |
|
|
true: keep the robot still (teleoperation) |
|
|
|
|
|
where the robot’s wrist goes |
Your hand’s /metaquest/right/... topics always come; the /metaquest/adapt/... ones come
with them while the ADAPT hand is on, the default, and not with --no-adapt. Every frame
publishes, up to 120 times a second. The ADAPT joints and motors hold still while
the robot holds; hold and state keep coming, ten times a second, while frames stop. Poses
are in the frame metaquest_floor, the headset’s room: x right, y up, −z forward. With
--hands both, the left hand has its own /metaquest/left/... topics.
A controller¶
The ADAPT motors, with the hold:
import rclpy
from sensor_msgs.msg import JointState
from std_msgs.msg import Bool
rclpy.init()
node = rclpy.create_node("adapt_controller")
hold = True
def on_hold(msg):
global hold
hold = msg.data
def on_motors(msg):
if not hold:
targets = dict(zip(msg.name, msg.position)) # motor name -> angle, radians
# your PID: drive each motor towards targets[name]
node.create_subscription(Bool, "/metaquest/teleop/hold", on_hold, 10)
node.create_subscription(JointState, "/metaquest/adapt/motors", on_motors, 10)
rclpy.spin(node)
From Python¶
from metaquest_teleop import QuestHands, Teleop
from metaquest_teleop.ros import RosPublisher
with QuestHands() as quest:
ros = RosPublisher(quest, teleop=Teleop(quest)) # publishes every frame
...
ros.close()
From any Python, as the command. To publish from your own rclpy node, give it as node=: that
needs ROS’s Python.