This project integrates Optitrack with OpenSAI to simulate a game of volleyball between two robots: the humanoid robot Toro and the Panda robot arm on a mobile base. The user controls Toro using Optitrack, and the Panda arm returns the ball. The game ends when the ball hits the ground. The camera can switch between a global view and Toro's first-person view, allowing for future VR capabilities.
Global View:
global_view.mov
Head View:
head_view.mp4
Optitrack Human Interface:
optitrack.mov
- OpenSAI: OpenSAI GitHub Repository
- Motive for Optitrack system
- Connect the laptop to the white ethernet cable.
- Set your laptop IP manually to
172.24.68.64
.
-
Launch Motive.
-
Create rigid bodies:
- Select a group of markers.
- Right-click and create a new rigid body.
- Rename and re-order the rigid bodies in the Assets tab.
-
Streaming Settings:
- Go to
Edit
->Settings
. - Click the
Streaming
tab. - Change the IP to
172.24.68.48
. - Ensure the streaming setting is
Unicast
. - Tick
Rigid Bodies
andMarkers
(labeled and unlabeled). - Enable streaming.
- Make sure to disable all streaming before turning off system
- Go to
- Navigate to the
cs225a/drivers/PythonClient
directory. - Run
StreamData.py
to stream rigid body information to your local Redis server.
- Position keys:
sai2::optitrack::rigid_body_pos::(rigid body number)
- Orientation keys:
sai2::optitrack::rigid_body_ori::(rigid body number)
- Note:
(rigid body number)
correlates to the rigid body ordering in the Assets tab.
Run the following commands:
mkdir build && cd build
cmake ..
make -j4
### Running the Controllers and Simulation
1. Go to the /bin/optitrack/ directory.
2. Run the following commands in separate terminals:
./toro-controller
./panda-controller
./simviz
### Changing Camera View
Use `redis-cli` to change the camera view by setting the camera position Redis key to zero:
```sh
redis-cli
SET "sai2::sim::toro::global_cam" 1 # for global view
SET "sai2::sim::toro::global_cam" 0 # for local camera attached to head view