Skip to content

Using ImcShell.jar

zepinto edited this page Sep 18, 2014 · 14 revisions

IMC Shell usage guide

IMC Shell is a simple program that allows you to listen and send IMC messages from a command line.

Compiling

  • For compiling you need a Java compiler version 1.7+ (JDK) and the Apache Ant build system.
  • On the directory where you checked out imcjava, run the command ant ImcShell.jar. This will create the file dist/ImcShell.jar.
  • To test the generated jar file enter the command java -jar dist/ImcShell.jar

Running

  • For running you need a Java Runtime Environment 1.7+ (JRE).
  • The file ImcShell.jar is an executable Java ARchive (jar). To run it just type java -jar path/to/ImcShell.jar.

Creating Messages

When you start the shell you are given a clean environment with no messages stored. In order to add messages to your environment (for later composing other messages or sending them to the network) you should use the command create. Examples:

In order to create a message named myState of type EstimatedState and initializing it with default values:

?> create myState EstimatedState

To create a message named pc of type PlanControl and initializing it with given values. Any field values not specified will be initialized defaults. Also note that the value of field arg is assumed to be message previously stored in the environment:

?> create pc PlanControl type=REQUEST op=START arg=m1

You can also initialize messages by specifying valid (Java Script) expressions (escaping them with `):

?> create state EstimatedState lat=`3.1458+java.lang.Math.toRadians(41)`

Using the environment

When you create messages or you receive messages from the network these will get stored in the shell's environment. In order to access the current environment you can use the commands env and print.

Clone this wiki locally