Skip to content

Latest commit

 

History

History
51 lines (39 loc) · 2.61 KB

README.md

File metadata and controls

51 lines (39 loc) · 2.61 KB

Task Specification Tree (TST) example

This example demonstrates how to store and receive TST data. It uses the JSON API in order to create a new Node in the Robot Scene Graph (RSG). Currently the TST is stored as a single Attribute in that Node. As Attributes can be updated the update command is used to represent a TST update as well. The exact commands can be found in the respective example script.

Installation

This example requires the SHERPA World Model and Python3 with the ZMQ package to be installed.

Ubuntu 12.04 and 14.04:

	sudo apt-get install python3 python3-setuptools python3-dev
	sudo easy_install3 pip
	pip3 install cffi pyzmq	

Usage

(Remark: You can run also run it with python 2.7 be replacing python3 with python.)

  1. Start the SHERPA World Model (in this example with ROS, though it could be also started without ROS)
	rosscore &	
	./run_sherpa_world_model.sh
	start_all()
  1. In a seperate terminal start the python script that crates a TST node and updates its attributes.
	python3 examples/tst/rsg_json_test_publisher.py 
  1. In a third terminal start the subsciber that receives subsequent updates.
	python3 examples/tst/rsg_json_test_subscriber.py

The output should look like the following:

b'{"@worldmodeltype": "RSGUpdate","node": {"@graphtype": "Node","attributes": [{"key": "name","value": "Task Specification Tree Update"},{"key": "tst:ennodeupdate","value": {"key": "tst:ennodeupdate","value": {"metamodel": "sherpa_msgs","model": "","payload": {"approved": 1,"exec_info": {"can_be_aborted": 1,"can_be_paused": 1},"exec_status": {"aborted": 0,"active": 1,"executing": 1,"finished": 0,"paused": 0,"succeeded": 0,"waiting": 0},"tree_id": "uav0-1","unique_node_id": 2},"type": "update-execution-tst-node"}}}],"id": "ff483c43-4a36-4197-be49-de829cdd66c8"},"operation": "UPDATE_ATTRIBUTES"}'
b'{"@worldmodeltype": "RSGUpdate","node": {"@graphtype": "Node","attributes": [{"key": "name","value": "Task Specification Tree Update"},{"key": "tst:ennodeupdate","value": {"key": "tst:ennodeupdate","value": {"metamodel": "sherpa_msgs","model": "","payload": {"approved": 1,"exec_info": {"can_be_aborted": 1,"can_be_paused": 1},"exec_status": {"aborted": 0,"active": 1,"executing": 1,"finished": 0,"paused": 0,"succeeded": 1,"waiting": 0},"tree_id": "uav0-1","unique_node_id": 2},"type": "update-execution-tst-node"}}}],"id": "ff483c43-4a36-4197-be49-de829cdd66c8"},"operation": "UPDATE_ATTRIBUTES"}'