Sets patterns on digital outputs and acts on digital inputs. Attach LEDs to the outputs and buttons to the digital inputs to use. (See the Pioneer LX manual and robots.mobilerobots.com for more details.) The 'mtx' Linux kernel module must be loaded, and the /dev/mtx character device must have been created (see mtxIODriver documentation). You must have read/write access to /dev/mtx.
#include "Aria.h"
#include "ArMTXIO.h"
void printBits(unsigned short c) {
int i;
for (i=0; i < 16; i++) {
if (i == 8) {
}
if (0x8000 & (c << i)) {
}
else {
}
}
}
int main(int argc, char **argv)
{
parser.loadDefaultArguments();
if(!robotConnector.connectRobot())
{
if(parser.checkHelpAndWarnUnparsed())
{
}
}
{
}
robot.
comInt(ArCommands::JOYINFO, 0);
{
}
unsigned char out = 1;
while(true)
{
unsigned char inp;
mtxIO.getDigitalInputMon1(&inp);
printBits(inp);
mtxIO.getDigitalInputMon2(&inp);
printBits(inp);
if(!mtxIO.
setDigitalOutputControl1(&out))
{
}
if(!mtxIO.
setDigitalOutputControl2(&out))
{
}
out = out << 1;
if(out == 0) out = 1;
}
out = out << 1;
if(out == 0) out = 1;
}
}
@ Terse
Use terse logging.
Definition: ArLog.h:61
bool isEnabled(void)
returns true if the device is opened and operational
Definition: ArMTXIO.h:85
bool comInt(unsigned char command, short int argument)
Sends a command to the robot with an int for argument.
Definition: ArRobot.cpp:5634
Connect to robot or simulator based on program command line parameters.
Definition: ArRobotConnector.h:80
Interface to digital and analog I/O and switched power outputs on MTX core (used in Pioneer LX and ot...
Definition: ArMTXIO.h:65
int lock(void)
Lock global (shared) mutex for all ArMTXIO instances.
Definition: ArMTXIO.h:139
static void exit(int exitCode=0)
Shutdown all Aria processes/threads, call exit callbacks, and exit the program.
Definition: Aria.cpp:367
static void log(LogLevel level, const char *str,...)
Log a message, with formatting and variable number of arguments.
Definition: ArLog.cpp:93
static void init(SigHandleMethod method=SIGHANDLE_THREAD, bool initSockets=true, bool sigHandleExitNotShutdown=true)
Initialize Aria global data struture and perform OS-specific initialization, including adding OS sign...
Definition: Aria.cpp:128
Central class for communicating with and operating the robot.
Definition: ArRobot.h:82
Parse and store program command-line arguments for use by other ARIA classes.
Definition: ArArgumentParser.h:64
static void logOptions(void)
Logs all the options for the program (Calls all the callbacks added with addLogOptionsCB())
Definition: Aria.cpp:794
int unlock(void)
Unlock global (shared) mutex for all ArMTXIO instances.
Definition: ArMTXIO.h:142
void runAsync(bool stopRunIfNotConnected, bool runNonThreadedPacketReader=false)
Starts the instance to do processing in its own new thread.
Definition: ArRobot.cpp:301
static bool parseArgs(void)
Parses the arguments for the program (calls all the callbacks added with addParseArgsCB())
Definition: Aria.cpp:759
static void sleep(unsigned int ms)
Sleep for the given number of milliseconds.
Definition: ariaUtil.cpp:151
@ Normal
Use normal logging.
Definition: ArLog.h:62