362 lines
12 KiB
Markdown
362 lines
12 KiB
Markdown
|
|
# Lấy pose hiện tại
|
|
```bash
|
|
curl -k -X GET https://localhost:7002/api/navigation/pose/current2d
|
|
```
|
|
# Di chuyển đến vị trí (1.0, 2.0) với yaw = 0
|
|
```bash
|
|
# Move to goal
|
|
curl -k -X POST https://localhost:7002/api/navigation/move_to \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"x": 1.0, "y": 2.0, "yaw": 0.0, "frame_id": "map"}'
|
|
```
|
|
|
|
# Di chuyển đến vị trí với order (navigation_move_to_order)
|
|
#
|
|
# ⚠️ LƯU Ý QUAN TRỌNG:
|
|
# - order_handle phải là một pointer hợp lệ đến Order object được tạo bởi navigation system.
|
|
# - KHÔNG thể sử dụng số ngẫu nhiên hoặc giá trị test (như 0x12345678) - phải là pointer thực sự từ C++ code.
|
|
# - Nếu sử dụng order_handle không hợp lệ, server có thể crash hoặc trả về lỗi SSL.
|
|
# - order_handle có thể là số decimal hoặc hex string (0x...)
|
|
# - Giá trị phải > 0x1000 để được coi là pointer hợp lệ
|
|
# - Để có order_handle hợp lệ, bạn cần tạo Order object từ navigation system trước
|
|
```bash
|
|
curl -k -X POST https://localhost:7002/api/navigation/move_to_order \
|
|
-H "Content-Type: application/json" \
|
|
-d '{
|
|
"order_handle": "0x12345678",
|
|
"x": 1.0,
|
|
"y": 2.0,
|
|
"z": 0.0,
|
|
"qx": 0.0,
|
|
"qy": 0.0,
|
|
"qz": 0.0,
|
|
"qw": 1.0,
|
|
"frame_id": "map",
|
|
"xy_tolerance": 0.1,
|
|
"yaw_tolerance": 0.1
|
|
}'
|
|
```
|
|
|
|
# Lưu ý: JSON phải được format đúng. Nếu gặp lỗi, có thể sử dụng format một dòng:
|
|
# ⚠️ LƯU Ý: order_handle "0x12345678" trong ví dụ này chỉ là placeholder - bạn PHẢI thay bằng order_handle thực sự từ navigation system!
|
|
```bash
|
|
# Ví dụ với order_handle thực (thay 0x12345678 bằng giá trị thực):
|
|
curl -k -X POST https://localhost:7002/api/navigation/move_to_order -H "Content-Type: application/json" -d '{"order_handle":"0x12345678","x":1.0,"y":2.0,"z":0.0,"qx":0.0,"qy":0.0,"qz":0.0,"qw":1.0,"frame_id":"map","xy_tolerance":0.1,"yaw_tolerance":0.1}'
|
|
|
|
curl -k -X POST https://localhost:7002/api/navigation/move_to -H "Content-Type: application/json" -d '{"x": 1.0, "y": 2.0, "yaw": 0.0, "frame_id": "map"}'
|
|
```
|
|
|
|
# Hoặc sử dụng yaw thay vì quaternion:
|
|
```bash
|
|
curl -k -X POST https://localhost:7002/api/navigation/move_to_order \
|
|
-H "Content-Type: application/json" \
|
|
-d '{
|
|
"order_handle": 305419896,
|
|
"x": 1.0,
|
|
"y": 2.0,
|
|
"yaw": 0.0,
|
|
"frame_id": "map",
|
|
"xy_tolerance": 0.1,
|
|
"yaw_tolerance": 0.1
|
|
}'
|
|
```
|
|
|
|
# Cấu trúc OrderHandle trong C#:
|
|
# - OrderHandle: Wrapper class cho IntPtr, đại diện cho pointer đến Order object
|
|
# - OrderData: C# class chứa dữ liệu Order (headerId, orderId, nodes, edges, etc.)
|
|
#
|
|
# Hiện tại, order_data chưa được hỗ trợ (cần C API function để tạo OrderHandle từ OrderData).
|
|
# Vui lòng sử dụng order_handle (IntPtr) từ navigation system.
|
|
|
|
# Di chuyển thẳng theo hướng hiện tại (distance mét). Bắt buộc có trường "distance".
|
|
```bash
|
|
# Đi thẳng 2.0 mét
|
|
curl -k -X POST https://localhost:7002/api/navigation/move_straight_to \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"distance": 1.0}'
|
|
```
|
|
|
|
# Ví dụ khác:
|
|
```bash
|
|
# Đi thẳng 1.5 mét
|
|
curl -k -X POST https://localhost:7002/api/navigation/move_straight_to \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"distance": 1.5}'
|
|
|
|
|
|
curl -k -X POST https://localhost:7002/api/navigation/move_straight_to -H "Content-Type: application/json" -d '{"distance": 2.0}'
|
|
```
|
|
|
|
# Xoay đến yaw = 1.57 (90 độ)
|
|
```bash
|
|
curl -k -X POST https://localhost:7002/api/navigation/rotate_to \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"yaw": 3.14}'
|
|
```
|
|
# Tạm dừng
|
|
```bash
|
|
curl -k -X POST https://localhost:7002/api/navigation/pause
|
|
```
|
|
# Tiếp tục
|
|
```bash
|
|
curl -k -X POST https://localhost:7002/api/navigation/resume
|
|
```
|
|
# Hủy goal
|
|
```bash
|
|
curl -k -X POST https://localhost:7002/api/navigation/pause
|
|
```
|
|
# Lấy feedback
|
|
```bash
|
|
curl -k -X GET https://localhost:7002/api/navigation/feedback
|
|
```
|
|
```bash
|
|
curl -k -X POST https://localhost:7002/api/navigation/twist/linear \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"x": 0.5, "y": 0.0, "z": 0.0}'
|
|
```
|
|
```bash
|
|
curl -k -X POST https://localhost:7002/api/navigation/move_to_order_data \
|
|
-H "Content-Type: application/json" \
|
|
-d '{
|
|
"order": {
|
|
"orderId": "order_001",
|
|
"orderUpdateId": 1,
|
|
"nodes": [{"nodeId": "node1", "sequenceId": 1, "released": true, "nodePosition": {"x": 0.0, "y": 0.0, "mapId": "map"}}],
|
|
"edges": [{"edgeId": "edge1", "sequenceId": 2, "startNodeId": "node1", "endNodeId": "node2", "released": true}]
|
|
},
|
|
"x": 13.05,
|
|
"y": 3.41,
|
|
"z": 0.0,
|
|
"yaw": 1.57
|
|
}'
|
|
```
|
|
|
|
```bash
|
|
curl -k -X POST https://localhost:7002/api/navigation/move_to_order_data \
|
|
-H "Content-Type: application/json" \
|
|
-d '{
|
|
"x": 7.0,
|
|
"y": 2.0,
|
|
"yaw": 1.57,
|
|
"frame_id": "map",
|
|
"xy_tolerance": 0.3,
|
|
"yaw_tolerance": 50,
|
|
"order": {
|
|
"headerId": 1,
|
|
"timestamp": "2026-02-28T16:01:25.308Z",
|
|
"version": "0.0.1",
|
|
"manufacturer": "phenikaaX",
|
|
"serialNumber": "T800Fake",
|
|
"orderId": "c92ec33e-ec04-4521-8255-af8ae46b7f31",
|
|
"orderUpdateId": 1,
|
|
"zoneSetId": "maze",
|
|
"nodes": [
|
|
{
|
|
"nodeId": "86312653-08b2-4556-bb84-674805905bed",
|
|
"sequenceId": 0,
|
|
"nodeDescription": "Node0",
|
|
"released": true,
|
|
"nodePosition": {
|
|
"x": 2.5,
|
|
"y": 1.0,
|
|
"theta": 0.0,
|
|
"allowedDeviationXY": 0,
|
|
"allowedDeviationTheta": 0,
|
|
"mapId": "448039b7-23d2-4a70-a2d2-08dd61dadd33",
|
|
"mapDescription": ""
|
|
},
|
|
"actions": []
|
|
},
|
|
{
|
|
"nodeId": "3726205f-0140-454d-21a8-08de5340bfbf",
|
|
"sequenceId": 1,
|
|
"nodeDescription": "Node1",
|
|
"released": true,
|
|
"nodePosition": {
|
|
"x": 6.0,
|
|
"y": 1.0,
|
|
"theta": 0.0,
|
|
"allowedDeviationXY": 0.3,
|
|
"allowedDeviationTheta": 50,
|
|
"mapId": "448039b7-23d2-4a70-a2d2-08dd61dadd33",
|
|
"mapDescription": ""
|
|
},
|
|
"actions": []
|
|
},
|
|
{
|
|
"nodeId": "1231321231231-fdfdf-fdfdsafa",
|
|
"sequenceId": 2,
|
|
"nodeDescription": "Node2",
|
|
"released": true,
|
|
"nodePosition": {
|
|
"x": 7.0,
|
|
"y": 2.0,
|
|
"theta": 1.57,
|
|
"allowedDeviationXY": 0.3,
|
|
"allowedDeviationTheta": 50,
|
|
"mapId": "448039b7-23d2-4a70-a2d2-08dd61dadd33",
|
|
"mapDescription": ""
|
|
},
|
|
"actions": []
|
|
}
|
|
],
|
|
"edges": [
|
|
{
|
|
"edgeId": "522212fa-74d5-4f00-9a00-23e092593bcc",
|
|
"sequenceId": 0,
|
|
"edgeDescription": "86312653-08b2-4556-bb84-674805905bed - 3726205f-0140-454d-21a8-08de5340bfbf",
|
|
"released": true,
|
|
"startNodeId": "86312653-08b2-4556-bb84-674805905bed",
|
|
"endNodeId": "3726205f-0140-454d-21a8-08de5340bfbf",
|
|
"maxSpeed": 0.5,
|
|
"maxHeight": 0,
|
|
"minHeight": 0,
|
|
"orientation": 0,
|
|
"orientationType": "",
|
|
"direction": "Both",
|
|
"rotationAllowed": true,
|
|
"maxRotationSpeed": 0.5,
|
|
"length": 0,
|
|
"trajectory": {
|
|
"degree": 1,
|
|
"knotVector": [0, 0, 1, 1],
|
|
"controlPoints": [
|
|
{
|
|
"x": 2.5,
|
|
"y": 1.0,
|
|
"weight": 1
|
|
},
|
|
{
|
|
"x": 6.0,
|
|
"y": 1.0,
|
|
"weight": 1
|
|
}
|
|
]
|
|
},
|
|
"actions": []
|
|
},
|
|
{
|
|
"edgeId": "13312fds-fdsfsdaaf",
|
|
"sequenceId": 1,
|
|
"edgeDescription": "3726205f-0140-454d-21a8-08de5340bfbf - 1231321231231-fdfdf-fdfdsafa",
|
|
"released": true,
|
|
"startNodeId": "3726205f-0140-454d-21a8-08de5340bfbf",
|
|
"endNodeId": "1231321231231-fdfdf-fdfdsafa",
|
|
"maxSpeed": 0.5,
|
|
"maxHeight": 0,
|
|
"minHeight": 0,
|
|
"orientation": 0,
|
|
"orientationType": "",
|
|
"direction": "Both",
|
|
"rotationAllowed": true,
|
|
"maxRotationSpeed": 0.5,
|
|
"length": 0,
|
|
"trajectory": {
|
|
"degree": 2,
|
|
"knotVector": [0, 0, 0, 1, 1, 1],
|
|
"controlPoints": [
|
|
{"x": 6.0, "y": 1.0, "weight": 1.0},
|
|
{"x": 7.0, "y": 0.5, "weight": 0.707},
|
|
{"x": 7.0, "y": 2.0, "weight": 1.0}
|
|
]
|
|
},
|
|
"actions": []
|
|
}
|
|
]
|
|
}
|
|
}'
|
|
```
|
|
|
|
```bash
|
|
curl -k -X POST https://localhost:7002/api/navigation/move_to_order_data \
|
|
-H "Content-Type: application/json" \
|
|
-d '{
|
|
"x": 2.5,
|
|
"y": 0.4,
|
|
"yaw": 0.0,
|
|
"frame_id": "map",
|
|
"xy_tolerance": 0.3,
|
|
"yaw_tolerance": 50,
|
|
"order": {
|
|
"headerId": 1,
|
|
"timestamp": "2026-02-28T16:01:25.308Z",
|
|
"version": "0.0.1",
|
|
"manufacturer": "phenikaaX",
|
|
"serialNumber": "T800Fake",
|
|
"orderId": "c92ec33e-ec04-4521-8255-af8ae46b7f31",
|
|
"orderUpdateId": 1,
|
|
"zoneSetId": "maze",
|
|
"nodes": [
|
|
{
|
|
"nodeId": "86312653-08b2-4556-bb84-674805905bed",
|
|
"sequenceId": 0,
|
|
"nodeDescription": "RobotCurrentNode",
|
|
"released": true,
|
|
"nodePosition": {
|
|
"x": 5.5,
|
|
"y": 0.4,
|
|
"theta": -0.0,
|
|
"allowedDeviationXY": 0,
|
|
"allowedDeviationTheta": 0,
|
|
"mapId": "448039b7-23d2-4a70-a2d2-08dd61dadd33",
|
|
"mapDescription": ""
|
|
},
|
|
"actions": []
|
|
},
|
|
{
|
|
"nodeId": "3726205f-0140-454d-21a8-08de5340bfbf",
|
|
"sequenceId": 1,
|
|
"nodeDescription": "Node172",
|
|
"released": true,
|
|
"nodePosition": {
|
|
"x": 2.5,
|
|
"y": 0.4,
|
|
"theta": -0.0,
|
|
"allowedDeviationXY": 0.3,
|
|
"allowedDeviationTheta": 50,
|
|
"mapId": "448039b7-23d2-4a70-a2d2-08dd61dadd33",
|
|
"mapDescription": ""
|
|
},
|
|
"actions": []
|
|
}
|
|
],
|
|
"edges": [
|
|
{
|
|
"edgeId": "522212fa-74d5-4f00-9a00-23e092593bcc",
|
|
"sequenceId": 0,
|
|
"edgeDescription": "86312653-08b2-4556-bb84-674805905bed - 3726205f-0140-454d-21a8-08de5340bfbf",
|
|
"released": true,
|
|
"startNodeId": "86312653-08b2-4556-bb84-674805905bed",
|
|
"endNodeId": "3726205f-0140-454d-21a8-08de5340bfbf",
|
|
"maxSpeed": 0.5,
|
|
"maxHeight": 0,
|
|
"minHeight": 0,
|
|
"orientation": 0,
|
|
"orientationType": "",
|
|
"direction": "Both",
|
|
"rotationAllowed": true,
|
|
"maxRotationSpeed": 0.5,
|
|
"length": 0,
|
|
"trajectory": {
|
|
"degree": 1,
|
|
"knotVector": [0, 0, 1, 1],
|
|
"controlPoints": [
|
|
{
|
|
"x": 4.5,
|
|
"y": 0.4,
|
|
"weight": 1
|
|
},
|
|
{
|
|
"x": 3.5,
|
|
"y": 0.4,
|
|
"weight": 1
|
|
}
|
|
]
|
|
},
|
|
"actions": []
|
|
}
|
|
]
|
|
}
|
|
}'
|
|
``` |