Skip to content

lemontea3515/Unity_ROS_Teleop

Repository files navigation

项目简介

本项目基于 Unity (2022.3.62f1)ROS (ROS/ROS2),实现了 VR 环境下与 ROS 的实时通信功能。通过 Meta Quest 3 头显与手柄输入,Unity 端可向 ROS 端发送手柄按键、姿态等数据,并支持 在 VR 内动态修改 ROS IP 地址,适用于多设备环境调试与快速部署。

项目核心结构

The-Unity-project-used-for-VR-robot-teleoperation/
├── Assets/
│   ├── Scripts/
│   │   ├── DynamicROSConnector.cs       # ROS IP动态连接脚本
│   │   └── VRControllerPublisher.cs     # 手柄位姿数据话题发布  
│   ├── Scenes/
│   │   └── Interact.unity               # unity项目,可直接运行(在安装过Unity2022.3.62f1后)
│   └── ...
├── Packages/
│   ├── manifest.json                    # 项目需要安装的依赖
│   └── packages-lock.json
├── ...
└── README.md

使用方法

  1. 设置ROS-TCP-Connector

在 Unity 中打开:

Edit → Project Settings → ROS Settings

设置:

ROS IP: <任意默认IP>
ROS Port: 10000 (根据ROS端ros_tcp_endpoint设置)
  1. 启动ROS端节点

功能包下载:

https://github.com/Unity-Technologies/ROS-TCP-Endpoint.git

编译ROS-TCP-Endpoint功能包:

colcon build
source ./install/setup.bash

运行节点,用于接收到VR控制器数据:

ros2 run ros_tcp_endpoint default_server_endpoint
  1. 运行 Unity 端场景
  • 打开 Interact.unity
  • 在 Hierarchy 中确保存在:
    • OVRCameraRigInteraction
    • ROSManager
    • Canvas
    • EventSystem

点击 PlayBuild & Run 到 Quest 3。

  1. 在VR头显内修改ROS IP
  • 使用手柄指向 ROS IP 输入框并点击
  • 弹出虚拟键盘
  • 输入新的 IP 地址后按下 “CONNECT!”
  • 系统自动断开旧连接并重连新 ROS 主机

运行示例:

1

2

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published