Ronoco-vm API - Detailed documentation
Run
Define and setup flask server and rostopic subscriber / publisher for ronoco-vm
Build a Flask instance and configure it
- test_config: path to configuration file (Default : None)
Register blueprint in app.
The class attribute "app" must contain a Flask instance
Uses rospy to subscribe to the different topics needed by the API
Common
Definition of common endpoint
GET Method
ROUTE /
This function check if the state of the robot or rviz has changed. If so, it sends a message to the websockets states channel
Check if you can communicate with MoveIT
- Use rosservice /move_group/get_loggers
- Node: /move_group
- Type: roscpp/GetLoggers
- Args:
Check if you can communicate with moveit
- Use rosservice /move_group/get_loggers
- Node: /move_group
- Type: roscpp/GetLoggers
- Args:
Check if rviz send data on topic /rviz_moveit_motion_planning_display/robot_interaction_interactive_marker_topic /update
GET Method
ROUTE /shutdown
Shutdown server with config.socketio.stop() (and shutdown send_states() daemon)
Free
Implements free endpoints to set and get the compliance (or 0 gravity robot WIP) of robot
GET/POST Method
ROUTE /free/
POST body { "compliant" : "True"/"False" }
Allows you to get or set robot compliance
- Use rosservice /set_compliant
- Node: /joint_trajectory_action_server
- Type: std_srvs/SetBool
- Args: data
CartesianPoint
Allows adding, get and delete a cartesian point in the ros parameters server from Rviz or compliant mode
This method adds a cartesian point in the ros parameters server (on the name "cartesianPoints"). This method is called when a POST request is made on point/add/simulation or point/add/real
- cartesian_point: a cartesian point eg {"position": {"x": pose.x, "y": pose.y, "z": pose.z}, "orientation": {"x": orientation.x, "y": orientation.y, "z": orientation.z, "w": orientation.w}}
This method deletes a cartesian point in the ros parameters server (on the name "cartesianPoints"). This method is called when a DELETE request is made on point/delete
- identifiant: a number
This method find a cartesian point in the ros parameters server (on the name "cartesianPoints"). This method is called when a GET request is made on point/get/number or point/get
- identifiant: a number
This method deletes all cartesian points in the ros parameters server (on the name "cartesianPoints"). This method is called when a POST request is made on point/delete
POST Method
ROUTE /point/add/actual
POST body { }
Allows you to add a Cartesian point corresponding to the current position of the robot.
The id of the position is automatically given
POST Method
ROUTE /point/add/simulation
POST body { }
Allows you to add a Cartesian point corresponding to the current position of the robot in Rviz.
The id of the position is automatically given
GET Method
ROUTE /point/get
Allows you to get all Cartesian points in the ros parameters server (on the name "cartesianPoints")
GET Method
ROUTE /point/get/
Allows you to get one Cartesian point in the ros parameters server (on the name "cartesianPoints")
- identifiant: a number
POST Method
ROUTE /point/delete/
POST body { }
Allows you to delete one Cartesian point in the ros parameters server (on the name "cartesianPoints")
- identifiant: a number
POST Method
ROUTE /point/delete
POST body { }
Allows you to delete all Cartesian points in the ros parameters server (on the name "cartesianPoints")
Control
Definition of the endpoint control to analyse and execute behaviour trees
POST Method
ROUTE /compute/
POST body : an export of nodered tree
This method is the main method of the endpoint to transform the json from nodered (or any other tool respecting the json syntax) into a behaviour tree with the py_tree package. Once built, the method call play then executes the different trees.
Every behaviour tree starts with a root block, blocks that are not connected (directly or indirectly) to a root are ignored.
Each root must be connected to strictly one block to be interpreted.
To be interpreted a flow must contain at least one behaviour tree
- {"Success" : "All behavior trees has been executed", 200} if the tree is built and executed correctly.
- {"Error": "Block (or child of this block) with id
is incorrect", 400} if it is not
Browse the list of previously constructed trees and execute them using the tick_tock method
Search in BT-json blocks with type 'root'
- bt: a json representing a behaviour tree (export of nodered)
Search in the json passed in parameter for a block with the string id passed in parameter
- identifiant: the id of the block searched for
- bt: a json representing a behaviour tree (export of nodered)
Builds the behaviour tree as a py_tree object from its root using a bfs algorithm
- json_node: a node of a tree in json format
- bt: a json representing a behaviour tree (export of nodered)
Transforms a decorator from a json to a py_tree object. In order to build the decorators it is necessary that the other blocks are already built
- node: the decorator in json format
- bt: a json representing a behaviour tree (export of nodered)
Analyses the data of a node and according to its type correctly formats the data dictionary.
Normally this function only returns the data field of the node but some special nodes escape this rule.
- node_json: the node to evaluate
Transforms all the nodes of the tree from json form to py_tree form. This function does not handle decorator blocks that need special treatment concerning their children
- bt: a json representing a behaviour tree (export of nodered)
Stop execute of current behavior tree
Recorder
Recorder class copy from Poppy project
Start the recording of a trajectory
Stop recording then save it as a json file
- trajectory_name: record's name
Find in the trajectory directory json file with a specific name the convert it in a RobotTrajectory
- trajectory_name: name of a previously recorded path
Logger
Definition of a logger for the websocket to be displayed in ronoco-ui
Send a message to the /control_log namespace via socketio's emit method The message must be a dictionary with at least one key/value
Some particular keys will be interpreted and reformatted by ronoco-ui (Debug, Success, Error, Warning, Info)
The other keys will be displayed rawly way
- msg: the message to send
Sends a message with the debug key if the verbosity level is greater than or equal to 4
- msg: a string message
Sends a message with the info key if the verbosity level is greater than or equal to 3
- msg: a string message
Sends a message with the warn key if the verbosity level is greater than or equal to 2
- msg: a string message
Sends a message with the error key if the verbosity level is greater than or equal to 1
- msg: a string message