Skip to main content
Version: 3.2.1

API Examples

This section provides some examples on using SENSR REST API.

Add a new algo node

  1. Request to create a new algo node in SENSR. You will get the uid as response.
    In this example, we are going to add an algo node with IP address 192.168.0.100.
 $ curl -X PUT 'http://localhost:9080/[SENSR version]/settings/node'    
--data '{
"ip": "192.168.0.100",
"name": "Algo_1",
"rosbag_path": "",
"preset": "outdoor",
"enable_gpu": false,
"disabled":false
}'
  1. Request save configs
$ curl -X POST 'http://localhost:9080/[SENSR version]/commands/apply-change'

Delete an algo node

  1. Request deletion of the node.
$ curl -X DELETE 'http://localhost:9080/[SENSR version]/settings/node?node-uri=algo_0000'
  1. Request save configs
$ curl -X POST 'http://localhost:9080/[SENSR version]/commands/apply-change'

Modify an algo node

  1. Request to update the algo node config. Here we use the uid we got earlier when we created it. Here we are updating the algo node's preset. Note that changing the preset will overwrite existing changes to the configuration.
$ curl -X POST 'http://localhost:9080/[SENSR version]/settings/node' 
--data '{
"ip": "192.168.0.100",
"name": "Algo_1",
"rosbag_path": "",
"preset": "outdoor",
"enable_gpu": false,
"disabled":false
}'
  1. Request save configs
$ curl -X POST 'http://localhost:9080/[SENSR version]/commands/apply-change'
  1. Request reload to restart the algo node with the new changes
$ curl -X POST 'http://localhost:9080/[SENSR version]/commands/reload'

Open a project

  1. Request to open a specific project already created in the repertory /opt/seoulrobotics/projects/. In this example the project name is my-project.
$ curl -X POST 'http://localhost:9080/[SENSR version]/commands/project?name=my-project'

Add a new sensor

  1. Request to create a new sensor in SENSR. You will get an uid of the newly added sensor in response. Note that this might fail if certain conditions are not met, such as if there is already a sensor with the same topic in the algo node.
$ curl -X PUT 'http://localhost:9080/[SENSR version]/settings/sensor-ext?node-uri=algo_0000&sensor-type=lidar'
--data '{
"name": "PointCloud",
"topic": "/velodyne_points",
"sensor": "ROS Message",
"stack_capacity": 0,
"detection_radius": 1000.0,
"horizontal_angle_range": [-180.0, 180.0],
"use_lidar_timestamp" : false,
"use_intensity_filtering" : false,
"use_corrected_pose":false,
"save_corrected_pose":false,
"minimum_intensity": 0.0,
"retro_reflective_intensity": 200.0,
"connected_to_edge_node": false,
"edge_uid":"",
"base_to_origin": {
"tx": 0.0,
"ty": 0.0
},
"sensor_to_base": {
"tz": 0.0,
"qw": 1.0,
"qx": 0.0,
"qy": 0.0,
"qz": 0.0
},
"pose_correction": {
"tx": 0.0,
"ty": 0.0,
"tz": 0.0,
"qw": 0.0,
"qx": 0.0,
"qy": 0.0,
"qz": 0.0
},
"disabled": false,
"arguments": {}
}'
  1. Request save configs
$ curl -X POST 'http://localhost:9080/[SENSR version]/commands/apply-change'

Delete a sensor

  1. Request deletion of the sensor.
$ curl -X DELETE 'http://localhost:9080/[SENSR version]/settings/sensor-ext?sensor-id=lidar_0000'
  1. Request save configs
$ curl -X POST 'http://localhost:9080/[SENSR version]/commands/apply-change'

Modify a sensor

  1. Get current sensor config with a specific uid (e.g. lidar_0000)
$ curl -X GET 'http://localhost:9080/[SENSR version]/settings/sensor-ext?sensor-id=lidar_0000'
  1. Modify json with your desired data
  2. Request to update the sensor config
$ curl -X POST 'http://localhost:9080/[SENSR version]/settings/sensor-ext' 
--data '{
"uid": "lidar_0000",
"name": "PointCloud",
"topic": "/velodyne_points",
"sensor": "ROS Message",
"stack_capacity": 0,
"detection_radius": 1000.0,
"horizontal_angle_range": [-180.0, 180.0],
"use_lidar_timestamp" : false,
"use_intensity_filtering" : false,
"use_corrected_pose":false,
"save_corrected_pose":false,
"minimum_intensity": 0.0,
"retro_reflective_intensity": 200.0,
"connected_to_edge_node": false,
"edge_uid":"",
"base_to_origin": {
"tx": 0.0,
"ty": 0.0
},
"sensor_to_base": {
"tz": 0.0,
"qw": 1.0,
"qx": 0.0,
"qy": 0.0,
"qz": 0.0
},
"pose_correction": {
"tx": 0.0,
"ty": 0.0,
"tz": 0.0,
"qw": 0.0,
"qx": 0.0,
"qy": 0.0,
"qz": 0.0,
},
"disabled": false,
"arguments": {}
}'
  1. Request save configs
$ curl -X POST 'http://localhost:9080/[SENSR version]/commands/apply-change'

Add a new zone

  1. Request to create a new zone in SENSR. You will get an id of the newly added zone in response. Note that the "id"-field must not overlap with an existing zone.
 curl -X PUT 'http://localhost:9080/[SENSR version]/settings/zone' 
--data '{
"id": 1001,
"name": "zone-1001",
"zone_type": "Event",
"speed_limit": 27.77,
"loitering_threshold": 0,
"min_z": 0.0,
"max_z": 2.5,
"vertices": [
[
-4.04,
5.27
],
[
-3.68,
3.32
],
[
-5.65,
3.02
],
[
-5.96,
4.85
]
]
}'
  1. Request save configs
$ curl -X POST 'http://localhost:9080/[SENSR version]/commands/apply-change'

Delete a zone

  1. Request deletion of the zone and save configs.
$ curl -X DELETE 'http://localhost:9080/[SENSR version]/settings/zone?zone-id=1001'
  1. Request save configs
$ curl -X POST 'http://localhost:9080/[SENSR version]/commands/apply-change'

Modify zone

  1. Get current zone config with a specific sensor-id (e.g. 1001)
$ curl -X GET 'http://localhost:9080/[SENSR version]/settings/zone?zone-id=1001'
  1. Modify json with your desired data
  2. Request to update the sensor config
$ curl -X POST 'http://localhost:9080/[SENSR version]/settings/zone' 
--data '{
"id": 1001,
"name": "zone-1001",
"zone_type": "Event",
"speed_limit": 27.77,
"loitering_threshold": 0,
"min_z": 0.0,
"max_z": 2.5,
"vertices": [
[
8.95,
-21.91
],
[
-13.30,
-25.27
],
[
-12.95,
-4.06
],
[
16.37,
5.74
],
[
9.58,
-21.35
]
]
}'
  1. Request save configs
$ curl -X POST 'http://localhost:9080/[SENSR version]/commands/apply-change'
Logo
If you need access, please contact