#include <ArKeyHandler.h>
This class is for handling input from the keyboard, you just addKeyHandler the keys you want to deal with.
You should also register the keyhandler with Aria::setKeyHandler, and before you create a key handler you should see if one is already there with Aria::getKeyHandler.
You can attach a key handler to a robot with ArRobot::attachKeyHandler which will put a task into the robots list of tasks so that it'll get checked every cycle or you can just call checkKeys yourself (like in its own thread or in the main thread). You should only attach a key handler to one robot, even if you're using multiple robots.
actionGroupExample.cpp, actsColorFollowingExample.cpp, demo.cpp, dpptuExample.cpp, gotoActionExample.cpp, gripperExample.cpp, gyroExample.cpp, lineFinderExample.cpp, sonyPTZDemo.cpp, triangleDriveToActionExample.cpp, vcc4CameraExample.cpp, and wander.cpp.
Definition at line 56 of file ArKeyHandler.h.
Public Types | |
enum | KEY { UP = 256, DOWN, LEFT, RIGHT, ESCAPE, SPACE, TAB, ENTER, BACKSPACE, _StartFKeys, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, _EndFKeys, PAGEUP, PAGEDOWN, HOME, END, INSERT, DEL } |
These are enums for the non-ascii keys. More... | |
Public Member Functions | |
bool | addKeyHandler (int keyToHandle, ArFunctor *functor) |
This adds a keyhandler, when the keyToHandle is hit, functor will fire. | |
ArKeyHandler (bool blocking=false, bool addAriaExitCB=true) | |
void | checkKeys (void) |
intnernal, use addKeyHandler, Checks for keys and handles them | |
int | getKey (void) |
bool | remKeyHandler (ArFunctor *functor) |
This removes a key handler, by key. | |
bool | remKeyHandler (int keyToHandler) |
This removes a key handler, by key. | |
void | restore (void) |
void | takeKeys (bool blocking=false) |
~ArKeyHandler () | |
Protected Attributes | |
ArFunctorC< ArKeyHandler > | myAriaExitCB |
bool | myBlocking |
std::map< int, ArFunctor * > | myMap |
termios | myOriginalTermios |
bool | myRestored |
|
These are enums for the non-ascii keys.
Definition at line 68 of file ArKeyHandler.h. |
|
This object will take over key capture when constructed, and release key capture when destroyed. Definition at line 45 of file ArKeyHandler.cpp. |
|
Destructor. Reseases control of the keyboard and restores state before this key handler was created. Definition at line 54 of file ArKeyHandler.cpp. |
|
This adds a keyhandler, when the keyToHandle is hit, functor will fire.
Definition at line 113 of file ArKeyHandler.cpp. |
|
internal, use addKeyHandler instead... Gets a key from the stdin if ones available, -1 if there aren't any available Definition at line 203 of file ArKeyHandler.cpp. |
|
This removes a key handler, by key.
Definition at line 154 of file ArKeyHandler.cpp. |
|
This removes a key handler, by key.
Definition at line 134 of file ArKeyHandler.cpp. |
|
Sets stdin back to its original settings, if its been restored it won't read anymore. For internal or special use, since it's called in the destructor.
Definition at line 93 of file ArKeyHandler.cpp. |
|
Takes the key control over. For internal or special use, since it's called in the constructor. Definition at line 59 of file ArKeyHandler.cpp. |