|
1 | | -## Experiment Instructions |
| 1 | +# Plate-Balancing |
2 | 2 |
|
3 | | -Central repo for C3 and its examples, including: |
4 | | -- https://arxiv.org/abs/2405.08731 |
| 3 | +This repository contains code for balancing a tray on the Franka Emika Panda robot, using Contact-Implicit Model Predictive Control (C3-MPC). The controller leverages contacts with the environment to perform manipulation tasks. |
5 | 4 |
|
6 | | -This branch/repo is being constantly updated so examples may be unstable. |
| 5 | +https://arxiv.org/abs/2405.08731 |
7 | 6 |
|
8 | 7 | ## Simulated Robot |
9 | 8 |
|
10 | | -1. Start the procman script containing a list of relevant processes |
| 9 | +1. Start the procman script from the workspace directory (dairlib). It contains a list of relevant processes |
11 | 10 | ``` |
12 | | -bot-procman-sheriff -l run_simulation.pmd |
| 11 | +bot-procman-sheriff -l examples/plate-balancing/procman/plate_balancing_simulation.pmd |
13 | 12 | ``` |
14 | 13 |
|
15 | | -2. In the procman window, start the operator processes (meshcat visualizer) using the script `script:start_operator_commands`. Scripts are located in the top bar of the procman window. |
| 14 | +2. In the procman window, start the operator processes (meshcat visualizer) using the script `script > start_operator_commands`. Scripts are located in the top bar of the procman window. |
16 | 15 |
|
17 | 16 | 3. The meshcat visualizer can be viewed by opening a browser and navigating to `localhost:7000` |
18 | 17 |
|
19 | | -4. The examples with the C3 controller can be run using the script `script:c3_mpc`. Note, the task can be changed by changing the `scene_index` in the parameters. More details in [changing the scene](#changing-the-scene). This script spawns three processes: |
| 18 | +4. The examples with the C3 controller can be run using the script `script > c3_mpc`. Note, the task can be changed by changing the `scene_index` in the parameters. More details in [changing the scene](#changing-the-scene). This script spawns three processes: |
20 | 19 | - `bazel-bin/examples/plate-balancing/run_simulation`: Simulated environment which takes in torques commands from `franka_osc` and publishes the state of the system via LCM on various channels. |
21 | 20 | - `bazel-bin/examples/plate-balancing/run_osc_controller`: Low-level task-space controller that tracks task-space trajectories it receives from the MPC |
22 | 21 | - `bazel-bin/examples/plate-balancing/run_c3_controller`: Contact Implicit MPC controller that takes in the state of the system and publishes end effector trajectories to be tracked by the OSC. |
23 | 22 |
|
24 | 23 | 5. The simulator and controller can be stopped using the script `script:stop_controllers_and_simulators`. |
25 | 24 | 6. A comparison using the sampling based MPC controllers from the [MJMPC controllers](https://github.com/google-deepmind/mujoco_mpc) can be run using `script:mjmpc_with_drake_sim`. This extracts out just the controller portion of the MJMPC code base and runs in on the identical task (scene 1) in the Drake simulator. Instructions to build and configure the standalone MJMPC controllers are a WIP. |
26 | 25 |
|
27 | | -## Physical Robot |
28 | | - |
29 | | -Hardware instructions updated for Ubuntu 22.04. We are no longer using ROS or ROS2 and instead relying on [drake-franka-driver](https://github.com/RobotLocomotion/drake-franka-driver), which works via LCM. Much thanks to the Drake developers who provided this! |
30 | | - |
31 | | -### Installing `drake-franka-driver` |
32 | | - |
33 | | -``` |
34 | | -git clone https://github.com/RobotLocomotion/drake-franka-driver |
35 | | -cd drake-franka-driver |
36 | | -bazel build ... |
37 | | -``` |
38 | | - |
39 | | - |
40 | | -### Running Experiments |
41 | | - |
42 | | -1. Start the procman script containing a list of relevant processes. The primary differences from`run_simulation.pmd` script are the lcm_channels and the drake-franka-driver and corresponding translators to communicate with the Franka via LCM. |
43 | | - |
44 | | - - In the root of dairlib: ``` bot-procman-sheriff -l examples/plate-balancing/franka_hardware.pmd ``` |
45 | | - - In the root of drake-franka-driver: ```bot-procman-deputy franka_control``` |
46 | | - |
47 | | -2. In the procman window, start the operator processes (meshcat visualizer and xbox controller) using the script `script:start_operator_commands`. Scripts are located in the top bar of the procman window. |
48 | | - |
49 | | -3. The meshcat visualizer can be viewed by opening a browser and navigating to `localhost:7000` |
50 | | - |
51 | | -4. The processes, except the C3 controller, can be run using the script `script:start_experiment`. This spawns the following processes: |
52 | | - - `start_logging.py`: Starts a lcm-logger with an automatic naming convention for the log number. |
53 | | - - `record_video.py`: Streams all available webcams to a .mp4 file corresponding to the log number. |
54 | | - - `torque_driver`: `drake-franka-driver` in torque control mode. |
55 | | - - `franka_driver_`(in/out): communicates with `drake-franka-driver` to receive/publish franka state information and torque commands. This is just a translator between Drake's Franka Panda specific lcm messages and the standardized robot commands that we use. |
56 | | - - `bazel-bin/examples/plate-balancing/run_osc_controller`: Low-level task-space controller that tracks task-space trajectories it receives from the MPC |
57 | | - |
58 | | - |
59 | | -5. For safety, start the C3 controller separately after verifying the rest of the processes have started successfully, by manually starting the `franka_c3` process. |
60 | | -6. Using the xbox controller, switch from tracking the teleop commands to the MPC plan by pressing "A". |
61 | | -7. Stop the experiment using `script:stop_experiment`. This also stops logging and recording. |
62 | | - |
63 | | - |
64 | 26 | ## Changing the scene |
65 | 27 |
|
66 | 28 | We currently have environment descriptions and gains for the following scenes: |
67 | 29 |
|
68 | | -The scene can be changed by updating the `scene_index` parameter in BOTH `run_simulation_params.yaml` and `run_c3_controller_params.yaml`. |
| 30 | +The scene can be changed by updating the `scene_index` parameter in `examples/plate-balancing/config/plate_balancing_config.yaml`. |
69 | 31 | The visualizer process must be restarted if changing the scene. |
70 | 32 |
|
71 | 33 | | Scene Index | Description | |
|
0 commit comments