Skip to content

firestep command line

firepick1 (localhost) edited this page Sep 5, 2015 · 10 revisions

Overview

The FireStep command line client provides higher level FireStep commands and manages the serial connection with FireStep.
The firestep command line client is currently supported on:

  • Linux (tested on Linux 3.14.0)
HELP	: firestep command line client v0.0205
HELP	:
HELP	: EXAMPLES
HELP	:   Launch interactive console with prompt
HELP	:     firestep -p
HELP	:     firestep --prompt
HELP	:   Reset FireStep, ignore all commands and return -EAGAIN
HELP	:     firestep -r
HELP	:     firestep --reset
HELP	:   Specify serial device (default is /dev/ttyACM0)
HELP	:     firestep -d /dev/ttyACM0 
HELP	:     firestep -device /dev/ttyACM0 
HELP	:   Process single JSON command 
HELP	:     firestep -e '{"hom":""}'
HELP	:     firestep --expr '{"hom":""}'
HELP	:   Process one command per line from JSON file
HELP	:     firestep < test/multiline.json
HELP	:   Show concise version, ignore all commands and return -EAGAIN
HELP	:     firestep -v
HELP	:     firestep --version
HELP	:   Enable logging at given message threshold to firestep.log
HELP	:     firestep --logerror
HELP	:     firestep --logwarn
HELP	:     firestep --loginfo
HELP	:     firestep --logdebug
HELP	:     firestep --logtrace
HELP	:   Show this help text
HELP	:     firestep -h
HELP	:     firestep --help
HELP	: 
HELP	: DESCRIPTION
HELP	:   Establish serial connection to FireStep and provide
HELP	:   extended Firestep commands via command line interface.
HELP	:   Commands can be executed individually, from a file, 
HELP	:   or from an optionally prompted interactive session.
HELP	: 
HELP	: SEE ALSO
HELP	:   https://github.com/firepick1/FireStep/wiki/firestep-command-line

Example: auto-calibrate home

The [standard home auto-calibration sequence] (https://github.com/firepick1/FireStep/wiki/Z-Bowl%20Error#calibration-home-angle-auto-calibration-haac) takes six FireStep JSON commands. You can send them all using a single firestep command line:

firestep --loginfo < scripts/cal-fpd-home.json

This example also illustrates how you can set up multi-line FireStep JSON command files and execute them using firestep.

Logging

Logging is disabled by default. You can enable logging to any of 5 message thresholds:

  • --logerror only show errors
  • --logwarn only show errors and warnings
  • --loginfo only show errors, warnings and generally useful information
  • --logdebug show all messages except trace messages
  • --logtrace show all messages

When logging is enabled, the output is sent to firestep.log. See firestep-example.log

Interactive Session

You can launch a logged, prompted interactive session with FireStep that acts much like the Arduino serial console:

firestep -p --loginfo

You will see something like this:

STATUS	: firestep command line client v0.0205
CMD	: _

Just enter a JSON command and press ENTER:

STATUS	: firestep command line client v0.0205
CMD	: {"hom":""}
{"s":0,"r":{"hom":{"1":-10231,"2":-10231,"3":-10231,"4":0}},"t":2.973}

Resetting the Arduino

The Arduino resets on DTR low (i.e., hang up on close or hup). To support scripting, firestep does not reset the Arduino unless you tell it do so:

firestep --loginfo -r

Scripting

You can also use the firestep command line for scripting with the -e parameter, which sends a single command:

firestep -e '{"hom":""}'

Note that, for bash, you must single-quote the JSON command to escape the JSON double-quotes.

Building firestep

The firestep client is provided is source form and you will need to build it to run on your machine. To build the firestep command line client on Linux (Debian):

  1. git clone https://github.com/firepick1/FireStep.git
  2. cd FireStep

Perform a complete build by invoking CMAKE to set up your makefiles:

  • ./build clean all

Perform an incremental build on existing files:

  • make

Install firestep:

  • sudo make install
Clone this wiki locally