vr_linker¶
This is the node which connects the Meta Quest 3 VR headset to the ROS 2 ecosystem. It hosts a TCP socket server the headset can connect to. Data received here gets sent to the ROS 2 ecosystem.
Subscribed topics
robot_data (RobotData): The robot data received from the robot.
arm_angles (ArmAngles): The arm angles received from the robot.
depth_data (DepthData): The depth data received from the robot.
vr_mode (VRMode): The VR mode data received from the robot.
vr_arm (VRArm): The VR arm data received from the robot.
vr_drive (VRDrive): The VR drive data received from the robot.
message (Message): Message to be logged including level.
Published topics
_vr_drive (VRDrive): The VR drive data received from the headset.
_vr_arm (VRArm): The VR arm data received from the headset.
_vr_mode (VRMode): The VR mode data received from the headset.
_vr_screw (VRScrew): The VR screw data received from the headset.
message (Message): Message to be logged including level.
vr_linker node¶
- class robot.src.vr_linker.vr_linker.vr_linker_node.VRLinkerNode(*args: Any, **kwargs: Any)¶
- listen() None ¶
Listens for incoming connections and messages.
- client_disconnected(e) None ¶
Handles the case when the client disconnects.
- Parameters:
e – Exception message
- cleanup()¶
Cleans up the node.
- robot.src.vr_linker.vr_linker.vr_linker_node.main(args=None)¶
vr_linker¶
- class robot.src.vr_linker.vr_linker.vr_linker.AnyMessage¶
- class robot.src.vr_linker.vr_linker.vr_linker.VRLinker(node)¶
- static _to_json(data: dict | bytes) str | bytes ¶
Converts data to JSON.
- Parameters:
data – data to convert
- Returns:
JSON data as dict or bytes
- _is_vr_connected() bool ¶
Checks if the VR headset is connected.
- Returns:
True if the VR headset is connected
- _send(data: dict) None ¶
Sends data over the TCP socket.
- Parameters:
data – data
- _send_compressed(data: dict) None ¶
Sends compressed data over the TCP socket.
- Parameters:
data – data
- static _get_vector_data(msg, key: str) list[float] ¶
Gets the x, y, z data from a vector message.
- Parameters:
msg – message
key – key to get data from
- Returns:
x, y, z data
- static _get_content_any_msg_type(msg) dict ¶
Gets the content of a message of any type.
- Parameters:
msg – ROS 2 message
- Returns:
message content as dict
- handle_log_backup(msg) None ¶
Receives a message of any type and sends to VR headset as a backup.
- Parameters:
msg – message
- handle_robot_data(msg) None ¶
Receives RobotData messages and sends over socket.
- Parameters:
msg – RobotData message
- handle_arm_angles(msg) None ¶
Receives ArmAngles messages and sends over socket.
- Parameters:
msg – ArmAngles message
- handle_depth_data(msg) None ¶
Receives DepthData messages and sends over socket.
- Parameters:
msg – DepthData message
- process_message() None ¶
Processes a message sent by the VR headset over TCP socket.
- static _is_vr_arm_message(data: dict) bool ¶
Checks if the message is a VRArm message.
- Parameters:
data – data
- Returns:
True if the message is a VRArm message
- static _is_vr_drive_message(data: dict) bool ¶
Checks if the message is a VRDrive message.
- Parameters:
data – data
- Returns:
True if the message is a VRDrive message
- static _is_screw_message(data: dict) bool ¶
Checks if the message is a mode message.
- Parameters:
data – data
- Returns:
True if the message is a mode message
- static _is_mode_message(data: dict) bool ¶
Checks if the message is a mode message.
- Parameters:
data – data
- Returns:
True if the message is a mode message
- _publish_vr_arm(data: dict) None ¶
Publishes VRArm messages.
- Parameters:
data – data
- _publish_vr_drive(data: dict) None ¶
Publishes VRDrive messages.
- Parameters:
data – data
- _publish_ping(data: dict) None ¶
Publishes ping messages.
- Parameters:
data – data
- _publish_mode(data: dict) None ¶
Publishes mode messages.
- Parameters:
data – data
- _publish_screw(data: dict) None ¶
Publishes screw messages.
- Parameters:
data – data
- _publish_get_depth() None ¶
Publishes get depth messages.
- Parameters:
data – data
- static _is_drive_mode(data: dict) bool ¶
Checks if the message is a drive mode message.
- Parameters:
data – data
- Returns:
True if the message is a drive mode message
- static _is_get_depth_message(data: dict) bool ¶
Checks if the message is a get depth message.
- Parameters:
data – data
- Returns:
True if the message is a get depth message
- _set_drive_mode(data: dict) None ¶
Sets the driving mode.
- Parameters:
data – data
- static _is_ping_message(data: dict) bool ¶
Checks if the message is a ping message.
- Parameters:
data – data
- Returns:
True if the message is a ping message
- _publish_data(data: dict) None ¶
Publishes VRDrive messages.
- Parameters:
data – data
utils¶
- robot.src.vr_linker.vr_linker.utils.get_config() dict ¶
Reads the config file.
- Returns:
config
- robot.src.vr_linker.vr_linker.utils.get_arm_timeout_seconds() float ¶
Returns the arm timeout in seconds.
- Returns:
timeout in seconds