REST API Usage example§

This page will display some examples on how to use the REST API within SENSR.

How to add a new algo node§

Setting up a new algo node will require a couple of steps:

Let's go through the steps one by one with some concrete examples:

  1. $ curl -X PUT 'http://localhost:9080/settings/node?node-uri=localhost'
  2. $ curl -X POST --header "Content-Type: application/json" --data '{ "ip": "localhost", "name": "test node", "bin": "", "rosbag_path": "", "username": "seoulrobotics", "preset": "indoor", "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 }}' 'http://localhost:9080/settings/node?node-uri=localhost'
  3. $ curl -X POST 'http://localhost:9080/commands/apply-change

How to delete an algo node§

Deleting an algo node will require a couple of steps:

Let's go through the steps one by one with some concrete examples:

  1. $ curl -X DELETE 'http://localhost:9080/settings/node?node-uri=localhost'
  2. $ curl -X POST 'http://localhost:9080/commands/apply-change

How to modify an algo node§

Modify an algo node will require a couple of steps:

Let's go through the steps one by one with some concrete examples:

  1. $ curl -X POST --header "Content-Type: application/json" --data '{ "ip": "localhost", "name": "test node", "bin": "", "rosbag_path": "", "username": "seoulrobotics", "preset": "indoor", "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 }}' 'http://localhost:9080/settings/node?node-uri=localhost'
  2. $ curl -X POST 'http://localhost:9080/commands/apply-change

How to add a new sensor§

Setting up a new sensor into a specific algo node will require a couple of steps:

Let's go through the steps one by one with some concrete examples:

  1. $ curl -X GET 'http://localhost:9080/settings/sensor?&config-id=sensor_setting.lidar&node-uri=localhost'
  2. Add a json table into the array which get form step1.
  3. $ curl -X POST --header "Content-Type: application/json" --data '[{ "name": "PointCloud", "topic": "/lidar0/velodyne_points", "sensor": -1, "stack_capacity": 0, "arguments": {}, "base_to_origin": { "tx": -0.08009183406829834, "ty": 3.970568895339966 }, "sensor_to_base": { "tz": 2.1583497524261476, "qw": 0.4881981611251831, "qx": -0.09654974192380905, "qy": -0.03580116853117943, "qz": 0.8666365742683411 }, "detection_radius": 1000000.0 }, { "name": "PointCloud2", "topic": "/lidar1/velodyne_points", "sensor": -1, "stack_capacity": 0, "arguments": {}, "base_to_origin": { "tx": 0.0, "ty": 0.0 }, "sensor_to_base": { "tz": 2.240278720855713, "qw": 0.6932316422462463, "qx": 0.1253870725631714, "qy": -0.14446713030338288, "qz": -0.6948649287223816 }, "detection_radius": 1000000.0 }, { "name": "!!!!!!NEW SENSOR!!!!", "topic": "/lidar2/velodyne_points", "sensor": -1, "stack_capacity": 0, "arguments": {}, "base_to_origin": { "tx": -3.3166956901550295, "ty": 13.601731300354004 }, "sensor_to_base": { "tz": 1.4132980108261109, "qw": 0.9715206623077393, "qx": -0.009856298565864563, "qy": -0.008277729153633118, "qz": -0.2366049587726593 }, "detection_radius": 1000000.0 }]' 'http://localhost:9080/settings/sensor?&config-id=sensor_setting.lidar&node-uri=localhost'
  4. $ curl -X POST 'http://localhost:9080/commands/apply-change

How to modify/delete a new sensor§

Modifying a sensor in a specific algo node will require a couple of steps:

This is almost same as How to add a new senor.

How to add a new zone§

Setting up a new zone will require a couple of steps:

Let's go through the steps one by one with some concrete examples:

  1. $ curl -X GET 'http://localhost:9080/settings/algorithm?&config-id=common.region_of_interest&node-type=algo&node-uri=common'
  2. Add a json table into the array which get form step1.
  3. $ curl -X POST --header "Content-Type: application/json" --data '[{ "id": 1001, "name": "My Event", "zone_type": 1, "min_z": 0.0, "max_z": 2.5, "vertices": [ [ 9.72825431824, 18.6199989319 ], [ 6.43825340271, 7.98000144958 ], [ -1.05174732208, 18.5499992371 ] ] }, { "id": 1002, "name": "Ignore zone", "zone_type": 2, "min_z": 0.0, "max_z": 2.5, "vertices": [ [ 10.4982538223, 0.419999837875 ], [ -9.80174541473, -0.769999742508 ], [ -7.21174716949, 17.4300003052 ], [ 12.8082551956, 5.25000095367 ] ] }, { "id": 1003, "name": "Ignore zone", "zone_type": 2, "min_z": 0.0, "max_z": 5.0, "vertices": [ [ 10.4982538223, 0.419999837875 ], [ -9.80174541473, -0.769999742508 ], [ -7.21174716949, 17.4300003052 ] ] }]' 'http://localhost:9080/settings/algorithm?config-id=common.region_of_interest&node-type=algo&node-uri=common'
  4. $ curl -X POST 'http://localhost:9080/commands/apply-change

How to modify/delete zone§

Modifying/Deleting a zone in the common node will require a couple of steps:

This is almost same as How to add a new zone.