Files
OrbbecSDK_ROS2/docs/en/source/camera_devices/3_quickstarts/quickstart.md
T

127 lines
2.8 KiB
Markdown
Raw Normal View History

## ROS Package QuickStarts
2025-09-12 10:42:29 +08:00
2025-09-12 13:54:52 +08:00
### Introduction
2025-09-12 10:42:29 +08:00
This section provides a quick start to using the Orbbec ROS 2 wrapper.
You will learn how to:
* Launch a camera node.
* Visualize depth/color streams in **RViz2**.
* Interact with topics and services using **ROS 2 CLI tools**.
---
2025-09-12 13:54:52 +08:00
### Build your First Camera Application
2025-09-12 10:42:29 +08:00
#### Step 1: Source ROS 2 and Workspace
Make sure ROS 2 and your workspace environment are sourced:
```bash
source /opt/ros/$ROS_DISTRO/setup.bash
```
Source code build requirements
```bash
2025-09-12 10:42:29 +08:00
source ~/ros2_ws/install/setup.bash
```
#### Step 2: Launch the Camera Node
- On terminal 1
```bash
. ./install/setup.bash
ros2 run orbbec_camera list_devices_node #Check if the camera is connected
ros2 launch orbbec_camera gemini_330_series.launch.py # Or other launch file, see below table
```
If you have multiple cameras connected, you can specify the **serial number**:
```bash
ros2 launch orbbec_camera gemini_330_series.launch.py serial_number:=<YourCameraSN>
```
#### Step 3: Visualize in RViz2
Launch RViz2 and load the default config:
- On terminal 2
```bash
rviz2
```
* Add an **Image** display, set topic to `/camera/color/image_raw`.
* Add another **Image** display for `/camera/depth/image_raw`.
* Optionally, add a **PointCloud2** display for `/camera/depth/points`.
You should now see the color stream, depth stream, and 3D point cloud in RViz2.
---
2025-09-12 13:54:52 +08:00
### Sample Features
2025-09-12 10:42:29 +08:00
After the node is running, try some ROS 2 CLI commands:
2025-09-12 13:54:52 +08:00
#### List available topics / services/ parameters
2025-09-12 10:42:29 +08:00
```bash
ros2 topic list
ros2 service list
ros2 param list
```
2025-09-12 13:54:52 +08:00
#### Echo a topic
2025-09-12 10:42:29 +08:00
View depth camera data:
```bash
ros2 topic echo /camera/depth/camera_info
```
2025-09-12 13:54:52 +08:00
#### Call a service
2025-09-12 10:42:29 +08:00
For example, get device Information:
```bash
ros2 service call /camera/get_device_info orbbec_camera_msgs/srv/GetDeviceInfo '{}'
```
2025-09-12 13:54:52 +08:00
#### Record with rosbag2
2025-09-12 10:42:29 +08:00
```bash
ros2 bag record /camera/color/image_raw /camera/depth/image_raw
```
#### Record and play back with SDK bag
SDK bag recording uses the Orbbec SDK to record device data. It is useful when you want to restart the wrapper later with the recording as a playback device. Record when launching:
```bash
ros2 launch orbbec_camera gemini_330_series.launch.py bag_record_filename:=/tmp/orbbec_record.bag
```
You can also start or stop recording while the node is running:
```bash
ros2 service call /camera/set_bag_recording orbbec_camera_msgs/srv/SetBagRecording "{enable: true, file_path: '/tmp/orbbec_record.bag'}"
```
```bash
ros2 service call /camera/set_bag_recording orbbec_camera_msgs/srv/SetBagRecording "{enable: false, file_path: ''}"
```
Play back an SDK bag:
```bash
ros2 launch orbbec_camera gemini_330_series.launch.py bag_filename:=/tmp/orbbec_record.bag
```
Loop playback:
```bash
ros2 launch orbbec_camera gemini_330_series.launch.py bag_filename:=/tmp/orbbec_record.bag bag_loop:=true
```