feat: add action command trigger modes

This commit is contained in:
slz
2026-09-16 11:29:47 +08:00
parent 7a5f11ae39
commit 2f4e3215ec
4 changed files with 149 additions and 13 deletions
@@ -53,16 +53,47 @@ ros2 service call /camera_01/get_action_config \
## Trigger the group
Send an immediate broadcast command. Every camera whose device key, group key, and group mask
match the request will be triggered:
The service exposes three trigger modes. Every camera whose device key, group key, and group mask
match the request will be triggered.
### Immediate trigger
Set `trigger_mode` to `0`. The delay and scheduled time fields must be zero:
```bash
ros2 service call /gige_action_command_node/send_action_command \
orbbec_camera_msgs/srv/SendActionCommand \
"{device_key: 1, group_key: 1, group_mask: 1, destination_ip: '255.255.255.255', scheduled_time: 0}"
"{device_key: 1, group_key: 1, group_mask: 1, broadcast_ip: '255.255.255.255', trigger_mode: 0, delay_ms: 0, scheduled_time: 0}"
```
`success: true` means the host dispatched the GVCP command; the protocol does not return a device
acknowledgment. A nonzero `scheduled_time` uses a GVCP/PTP timestamp, with seconds in the upper
32 bits and nanoseconds in the lower 32 bits. Scheduled triggering requires the cameras and sender
host to use synchronized time.
### Relative-delay trigger
Set `trigger_mode` to `1` and provide a positive delay in milliseconds. The node reads the host
system clock, adds the delay, and converts the result to the absolute GVCP/PTP timestamp expected by
the SDK. This example schedules the command one second in the future:
```bash
ros2 service call /gige_action_command_node/send_action_command \
orbbec_camera_msgs/srv/SendActionCommand \
"{device_key: 1, group_key: 1, group_mask: 1, broadcast_ip: '255.255.255.255', trigger_mode: 1, delay_ms: 1000, scheduled_time: 0}"
```
The host `CLOCK_REALTIME` must be synchronized to the same PTP domain as the cameras, for example
by using `phc2sys`. The launch file enables camera PTP synchronization, but it does not configure
the host PTP services. Choose a delay long enough for the command to reach the cameras before its
target time.
### Absolute PTP-time trigger
Set `trigger_mode` to `2`, leave `delay_ms` at zero, and provide a future encoded PTP timestamp. The
upper 32 bits contain seconds and the lower 32 bits contain nanoseconds:
```bash
ros2 service call /gige_action_command_node/send_action_command \
orbbec_camera_msgs/srv/SendActionCommand \
"{device_key: 1, group_key: 1, group_mask: 1, broadcast_ip: '255.255.255.255', trigger_mode: 2, delay_ms: 0, scheduled_time: <PTP_TIMESTAMP>}"
```
The response returns `encoded_scheduled_time`, the exact 64-bit value sent to the SDK. For delayed
triggering this is the timestamp calculated by the node. `success: true` means the host dispatched
the GVCP command; the protocol does not return a device acknowledgment.
@@ -21,6 +21,7 @@ def generate_launch_description():
"net_device_ip": "192.168.1.10",
"net_device_port": "8090",
"sync_mode": "group_actions",
"enable_ptp_config": "true",
"log_file_name": "camera_01.log",
}.items(),
)
@@ -33,6 +34,7 @@ def generate_launch_description():
"net_device_ip": "192.168.1.11",
"net_device_port": "8090",
"sync_mode": "group_actions",
"enable_ptp_config": "true",
"log_file_name": "camera_02.log",
}.items(),
)