Sending robot commands

From MobileRobots Research and Academic Customer Support

(Redirected from Sending a robot command)
Jump to: navigation, search

Software controls the robot by sending command packets to the robot, which are interpreted and executed by the robot's embedded firmware. All MobileRobots platform use the same protocol (though each robot supports different subsets of the protocol depending on its capabilities, options and configuration).

Commands are sent via the RS-232 serial connection in byte sequences called packets. A packet consists of a constant header, a length, a command identifier (command number), an argument type identifier, argument data, and finally a checksum used by the firmware to verify that the data was not corrupted during transit.

Most commands take arguments in one of the following forms:

  • One positive 16-bit (2-byte) integer (LSB)
  • A length-prefixed string (length value is one unsigned byte)
  • Two 8-bit bytes

The sign of an integer is determined by the argument type byte; if negative, the absolute value is given as the argument value. (A few commands take other argument forms, such as multiple integers, one or more 32-bit (4-byte) integers, etc.)

A table of commands is included in your robot's operations manual, along with more discussion of the packet format including argument types and the checksum.

Aria provides a high level API to the robot and integrated devices, and normally you do not need to worry about how Aria sends commands to the robot. It does, however, make public the methods in ArRobot used to send commands, which you can use to perform operations that may not be covered by the Aria API: ArRobot::com(), ArRobot::comInt(), ArRobot::com2Bytes(), ArRobot::comStr(), and others. The most commonly used command numbers are given symbolic names in the ArCommands enumeration, which you can use instead of integer literals as the first method argument for clarity. ArRobot also provides access to its packet classes (ArBasePacket, ArRobotPacket, etc) and its ArRobotPacketSender, which you can use to send any packet with any kind of data payload.

Aria's demo example also provides a mode in which you can type and send any robot command that takes no arguments, an integer argument, or 2 byte arguments. Enter this mode by pressing the 'd' key after demo successfully connects to the robot. Then type the command number, optionally followed by a space and one integer (2-byte) argument (positive or negative), or two 1-byte arguments.

Some ARNL and ArNetworking servers may provide a similar trap door to this basic command level, via the "Microcontroller Command" command in the Custom Command toolbar item.

Personal tools