|
1 | 1 | # Design Philosophy |
2 | 2 |
|
3 | | -## Reuse existing ROS2 infrastructure/community |
| 3 | +We follow a few design strategies in CRISP. |
| 4 | +This page describes our choices along with their respective pros and cons. |
4 | 5 |
|
5 | | -Pros: |
6 | | -- Large community with many users |
7 | | -- TODO |
| 6 | +Our most important goal is to find a **meeting point between robotics and machine learning engineers.** |
| 7 | +On the one hand, robotics engineers are already familiar with ROS2 and experienced in control and manipulation in general. |
| 8 | +On the other hand, machine learning engineers who might not be familiar with these tools prefer to work with python-only environments. |
| 9 | +We try to bring the strengths of both worlds in this project. |
8 | 10 |
|
9 | | -Cons: |
10 | | -- "Framework Jail" |
| 11 | +## Reuse Existing ROS2 Infrastructure |
11 | 12 |
|
12 | | -## Distributed System |
| 13 | +We decided to build CRISP on top of [ROS2](https://docs.ros.org/) for several reasons: |
| 14 | + |
| 15 | +**Pros:** |
| 16 | + |
| 17 | +- **Large community**: Many users and developers already familiar with tools for interacting with ROS2 systems (e.g., [rviz2](https://github.com/ros2/rviz), [rqt](https://docs.ros.org/en/rolling/Concepts/Intermediate/About-RQt.html), [ros2 CLI](https://docs.ros.org/en/rolling/Tutorials/Beginner-CLI-Tools.html)). |
| 18 | +- **Existing ecosystem**: Well-tested packages for robot drivers, sensors, and visualization that we can leverage directly. The [ROS Index](https://index.ros.org/) lists thousands of available packages. |
| 19 | +- **Simplified setup with pixi + robostack**: We use [pixi](https://pixi.sh/) with [robostack](https://robostack.github.io/) to provide a conda-like development environment. |
| 20 | +This removes the traditional friction of ROS2 installation (no more sourcing setup.bash files or managing system dependencies) and makes it accessible to ML engineers accustomed to Python-centric workflows. |
| 21 | + |
| 22 | +**Cons:** |
| 23 | + |
| 24 | +- **"Framework jail"**: ROS2 imposes certain patterns (nodes, topics, executors) that may feel constraining for simple use cases. |
| 25 | + Users must work within the ROS2 paradigm even for straightforward scripts. |
| 26 | + |
| 27 | +In all objects, we try to abstract away ROS2 details behind simple Python APIs: |
| 28 | +```python |
| 29 | +from crisp_py import Robot |
| 30 | + |
| 31 | +robot = Robot(...) # ROS2 node creation is hidden and spinned up internally to receive/send data |
| 32 | +robot.wait_until_ready() # Waits for ROS2 topics to be alive |
| 33 | +print(robot.end_effector_pose) # Direct access to data without dealing with ROS2 messages |
| 34 | +``` |
| 35 | + |
| 36 | +## Configuration: YAML Files with Programmatic Freedom |
| 37 | + |
| 38 | +CRISP uses YAML configuration files to define robots, sensors, and control pipelines. |
| 39 | +This provides a declarative way to set up common scenarios without writing code. |
| 40 | + |
| 41 | +**Pros:** |
| 42 | + |
| 43 | +- **Quick iteration**: Change parameters without modifying source code. |
| 44 | + |
| 45 | +**Cons:** |
| 46 | + |
| 47 | +- **Less flexibility**: Complex behaviors may be hard to express in YAML rather than code. |
| 48 | + |
| 49 | +However, we also provide full programmatic access. |
| 50 | +Users can instantiate objects directly in Python and modify them freely when the YAML approach becomes limiting. |
| 51 | +This is particularly useful for: |
| 52 | + |
| 53 | +- Rapid prototyping and debugging |
| 54 | +- *Custom components* that don't fit the YAML schema |
| 55 | + |
| 56 | +Here is an example for the YAML config for an environment: |
| 57 | +```yaml |
| 58 | +gripper_mode: "absolute_continuous" |
| 59 | + |
| 60 | +robot_config: |
| 61 | + robot_type: "franka" |
| 62 | + time_to_home: 2.0 |
| 63 | + publish_frequency: 50.0 |
| 64 | + home_config: [0.0, 0.1, 0.0,-1.94, 0.0, 2.0, 0.8] |
| 65 | + |
| 66 | +gripper_config: |
| 67 | + min_value: 0.0 |
| 68 | + max_value: 0.4 |
| 69 | + joint_state_topic: /gripper/joint_states |
| 70 | + command_topic: /gripper/command |
| 71 | + |
| 72 | +camera_configs: |
| 73 | + - camera_name: "primary" |
| 74 | + camera_frame: "primary_link" |
| 75 | + resolution: [256, 256] |
| 76 | + camera_color_image_topic: "third_person_camera/image_raw" |
| 77 | + camera_color_info_topic: "third_person_camera/camera_info" |
| 78 | + - camera_name: "wrist" |
| 79 | + camera_frame: "wrist_link" |
| 80 | + resolution: [256, 256] |
| 81 | + camera_color_image_topic: "wrist_camera/color/image_rect_raw" |
| 82 | + camera_color_info_topic: "wrist_camera/color/camera_info" |
| 83 | + |
| 84 | +sensor_configs: |
| 85 | + - sensor_type: "force_torque" |
| 86 | + shape: [6,] |
| 87 | + name: "ft_sensor" |
| 88 | + data_topic: "external_wrench" |
| 89 | +``` |
| 90 | +
|
| 91 | +See the [example config files](https://github.com/utiasDSL/crisp_gym/tree/main/crisp_gym/config) or [here](https://github.com/utiasDSL/crisp_py/tree/main/crisp_py/config), and [how to define your own configs](getting_started_config.md) for more details. |
| 92 | +
|
| 93 | +## Data Collection directly in LeRobot Format, no rosbags |
| 94 | +
|
| 95 | +CRISP collects data directly in [LeRobot](https://github.com/huggingface/lerobot) format at a single fixed frequency, rather than saving [ROS bags](https://docs.ros.org/en/rolling/Tutorials/Beginner-CLI-Tools/Recording-And-Playing-Back-Data/Recording-And-Playing-Back-Data.html) for post-processing. |
| 96 | +
|
| 97 | +The LeRobot format stores episodes as [HuggingFace datasets](https://huggingface.co/docs/datasets/), making it easy to share, version, and load data for training. Each episode contains synchronized observations (images, joint states) and actions at a consistent frequency. |
| 98 | +
|
| 99 | +**Pros:** |
| 100 | +
|
| 101 | +- **Minimizes the gap between teleoperation and policy deployment**: The data you collect is immediately ready for training without conversion steps. What you record is exactly what your policy will see. |
| 102 | +- **Consistent timing**: A single frequency ensures synchronized observations and actions, avoiding timestamp alignment issues common with bag files. |
| 103 | +- **Simpler pipeline**: No need to manage bag files, replay them, and transform to training formats. |
| 104 | +- **Easy sharing**: Datasets can be pushed directly to [HuggingFace Hub](https://huggingface.co/datasets) for collaboration. |
| 105 | +
|
| 106 | +**Cons:** |
| 107 | +
|
| 108 | +- **Less data captured**: You only save what's needed at the target frequency, potentially losing high-frequency sensor data that might be useful for debugging or alternative analysis. |
| 109 | +- **Less flexibility**: Post-hoc resampling or different observation combinations require re-collection. |
| 110 | +
|
| 111 | +The recording is handled by the [RecordingManager](https://github.com/utiasDSL/crisp_gym/tree/main/crisp_gym/record) and here is an example script showing how the recording works [record_with_leader_follower](https://github.com/utiasDSL/crisp_gym/blob/main/crisp_gym/scripts/record_lerobot_format_leader_follower.py) |
| 112 | +More details on recording can be found in the [getting started with the gym](getting_started_gym.md) documentation. |
0 commit comments