RemoteButtonEvent Demo

From Tekkotsu Wiki

Jump to: navigation, search

The RemoteButtonEvent demo shows how to subscribe to button events on another robot. It is an example of inter-robot communication within the Tekkotsu event framework using a Remote Listener. See the discussion of State Machines and Remote Events for more on this subject.

Robot type: Any platform with networking capability

Where to find the demo: Root Control > Framework Demos > Interaction Demos > RemoteButtonEvent

Source code: Tekkotsu/Behaviors/Demos/Interaction/RemoteButtonEvent.h.fsm

Running the Demo

You will need a second robot or computer running the Tekkotsu framework. You must know this robot's IP address. (To find the IP address on a Linux-based robot, type /sbin/ifconfig.) Start Tekkotsu on this ``remote robot``. Then run the demo on the local robot.

When the demo starts up it will ask for the IP address of the remote robot. You can enter this using the ControllerGUI by typing this in the message window:

!msg xxx.yyy,zzz,www

You can also enter the IP address by typing the msg command to the Tekkotsu console, omitting the exclamation point.

Once the local robot has connected to the remote robot, you can press a button on the remote robot and the local robot will print a message and play a ping sound. If you're using a computer to simulate the remote robot, you can simulate a button press event by typing this command in the remote robot's ControllerGUI message window:

!post buttonEGID 1 A

You can also type the command on the remote robot's console, omitting the exclamation point.

Notes

  • Tekkotsu must be running on the remote robot before you start the demo. Otherwise there is a high probability that the demo will crash. This is the result of a known deficiency in the wireless code which is on the list of things that need fixing.