This repository contains commands and ROS nodes for executing a SFC statemachine defined in KIF using the KIF_utils package by means of the JGrafchart tool (http://www.control.lth.se/Research/tools/grafchart.html).
Requirements
------------
This package relies on a number of tools for installation.
```
java
maven
```
For execution
```
jgrafchart
java
python
bash
dot (graphviz)
```
Installation
------------
The instructions below assume the installation takes place in the home folder on a linux system. The `dev` folder below can be exchanged for a name of choice.
The first step is to clone the repository. The latest version is located in master HEAD.
The software is partially packaged as a Java maven project. It therefore needs compilation of the software into a jar package.
`cd ~/dev/grafchart_utils/utils`
`mvn package shade:shade`
There should now be an automatically generated `~/dev/grafchart_utils/utils/target` folder containing a jar file `grafchart_utils-0.0.1-SNAPSHOT.jar`.
Configuration
-------------
Before using the software some environment variables need to be set. In the `~/dev/grafchart_utils/utils/scripts/scripts` folder there is a file `setup.bash` that should be edited. It contains:
The `JGRAFCHART_UTILS_HOME` environment variable should point to the utils folder of the repository. All commands are available in the scripts folder which is added to the `PATH` environment variable.
The `JGRAFCHART_HOME` environment variable should point to the root of a JGrafChart installation.
After updating the `setup.bash` file it can be sourced in the local shell to make KIF commands available.
`source setup.bash`
Commands
--------
### sfc2dot
sfc2dot creates an input file to the graphviz dot program to perform graphical layout of the statemachine.
```
usage: sfc2dot statemachine-file
```
#### Sample usage
`sfc2dot statemachine.txt >statemachine.txt.gv` where *statemachine.txt* is the output from the the *sfclist* command in the kif_utils package.
This should be followed by the layout step
`dot -Tplain statemachine.txt.gv >statemachine.txt.gv.plain` where *statemachine.txt.gv.plain* contains the layout output from dot.
### dot2jgrafchart
dot2jgrafchart creates a xml file suitable as input to jgrafchart.