Laelaps  2.3.5
RoadNarrows Robotics Small Outdoor Mobile Robot Project
utRobot

Classes

class  UTThread
 

Macros

#define APP_EC_OK   0
 success exit code
 
#define APP_EC_ARGS   2
 command-line options/arguments error exit code
 
#define APP_EC_EXEC   4
 execution exit code
 
#define APP_EC_OK   0
 success exit code
 
#define APP_EC_ARGS   2
 command-line options/arguments error exit code
 
#define APP_EC_EXEC   4
 execution exit code
 
#define APP_EC_OK   0
 success exit code
 
#define APP_EC_ARGS   2
 command-line options/arguments error exit code
 
#define APP_EC_EXEC   4
 execution exit code
 
#define APP_EC_OK   0
 success exit code
 
#define APP_EC_ARGS   2
 command-line options/arguments error exit code
 
#define APP_EC_EXEC   4
 execution exit code
 

Functions

static void mainInit (int argc, char *argv[])
 Main initialization. More...
 
int main (int argc, char *argv[])
 Main. More...
 
int getch ()
 
int kbhit ()
 

Variables

static char * Argv0
 the command
 
static OptsPgmInfo_T PgmInfo
 Program information. More...
 
static OptsInfo_T OptsInfo []
 Command line options information. More...
 
static char * Argv0
 the command
 
static double OptsHz = 2
 thread hertz rate
 
static bool_t OptsRand = false
 thread random jitter
 
static OptsPgmInfo_T PgmInfo
 Program information. More...
 
static OptsInfo_T OptsInfo []
 Command line options information.
 
UTThread operator
 
static char * Argv0
 the command
 
static char * ArgFileName
 XML file name.
 
static OptsPgmInfo_T PgmInfo
 Program information. More...
 
static OptsInfo_T OptsInfo []
 Command line options information. More...
 
static char * Argv0
 the command
 
static char * ArgFileName
 XML file name.
 
static OptsPgmInfo_T PgmInfo
 Program information. More...
 
static OptsInfo_T OptsInfo []
 Command line options information. More...
 

Detailed Description

Function Documentation

int main ( int  argc,
char *  argv[] 
)

Main.

Parameters
argcCommand-line argument count.
argvCommand-line argument list.
Returns
Returns 0 on succes, non-zero on failure.

Definition at line 138 of file utRobot.cxx.

References APP_EC_EXEC, APP_EC_OK, laelaps::LaeRobot::connect(), laelaps::LaeRobot::disconnect(), laelaps::LaeRobot::getLaelapsDesc(), laelaps::LaeRobot::isConnected(), laelaps::LaeXmlCfg::loadFile(), mainInit(), and laelaps::LaeDesc::markAsDescribed().

Referenced by mainInit().

139 {
140  const char* const CfgFile = "/prj/pkg/Laelaps/share/etc/laelaps/laelaps.conf";
141 
142  LaeRobot *pRobot;
143  LaeXmlCfg xml;
144  uint_t sec;
145  int rc;
146 
147  mainInit(argc, argv);
148 
149  printf("Creating robot.\n");
150  pRobot = new LaeRobot;
151  printf("Created.\n");
152 
153  sec = 1;
154  printf(" sleeping %u seconds ...", sec);
155  sleep(sec);
156  printf("\n");
157 
158  LaeDesc &desc = pRobot->getLaelapsDesc();
159 
160  printf("Parsing robot description.\n");
161  if( (rc = xml.loadFile(desc, CfgFile)) == LAE_OK )
162  {
163  rc = desc.markAsDescribed();
164  }
165 
166  if( rc != LAE_OK )
167  {
168  printf("Failed to load/parse description.\n");
169  return APP_EC_EXEC;
170  }
171 
172  printf("Connecting robot.\n");
173  if( (rc = pRobot->connect()) == LAE_OK )
174  {
175  printf("Connected\n");
176  }
177  else
178  {
179  printf("Failed to connect.\n");
180  }
181 
182  sec = 5;
183  printf(" sleeping %u seconds ...", sec);
184  sleep(sec);
185  printf("\n");
186 
187  if( pRobot->isConnected() )
188  {
189  printf("Disconnecting robot.\n");
190  if( (rc = pRobot->disconnect()) == LAE_OK )
191  {
192  printf("Disconnected\n");
193  }
194  else
195  {
196  printf("Failed to disconnect.\n");
197  }
198  }
199 
200  printf("Deleting robot.\n");
201  delete pRobot;
202  printf("Deleted.\n");
203 
204  sec = 1;
205  printf(" sleeping %u seconds ...", sec);
206  sleep(sec);
207  printf("\n");
208 
209  return APP_EC_OK;
210 }
static void mainInit(int argc, char *argv[])
Main initialization.
Definition: utRobot.cxx:121
Laelaps robotic mobile platform full description class.
Definition: laeDesc.h:451
int connect()
Connect to <b><i>Laelaps</i></b>.
Definition: laeRobot.cxx:193
virtual int loadFile(const std::string &strXmlFileName=LaeEtcCfg)
Load XML file into DOM.
LaeDesc & getLaelapsDesc()
Get the <b><i>Laelaps</i></b> product description.
Definition: laeRobot.cxx:746
#define APP_EC_OK
success exit code
Definition: utRobot.cxx:80
int disconnect()
Disconnect from <b><i>Laelaps</i></b>.
Definition: laeRobot.cxx:333
int markAsDescribed()
Mark <b><i>Laelaps</i></b> hardware as fully described.
Definition: laeDesc.cxx:672
#define APP_EC_EXEC
execution exit code
Definition: utRobot.cxx:82
bool isConnected()
Test if connected to <b><i>Laelaps</i></b> hardware.
Definition: laeRobot.cxx:726
Laelaps robotic manipulator plus accesories class.
Definition: laeRobot.h:103
LaeXmlCfg <b><i>Laelaps</i></b> XML configuration class.
Definition: laeXmlCfg.h:71
static void mainInit ( int  argc,
char *  argv[] 
)
static

Main initialization.

Parameters
argcCommand-line argument count.
argvCommand-line argument list.
Exits:
Program terminates on conversion error.

Definition at line 121 of file utRobot.cxx.

References Argv0, OptsInfo, PgmInfo, and PkgInfo.

Referenced by main().

122 {
123  // name of this process
124  Argv0 = basename(argv[0]);
125 
126  // parse input options
127  argv = OptsGet(Argv0, &PkgInfo, &PgmInfo, OptsInfo, true, &argc, argv);
128 }
static char * Argv0
the command
Definition: utRobot.cxx:84
static OptsInfo_T OptsInfo[]
Command line options information.
Definition: utRobot.cxx:107
static const PkgInfo_T PkgInfo
Definition: version.h:45
static OptsPgmInfo_T PgmInfo
Program information.
Definition: utRobot.cxx:89

Variable Documentation

OptsInfo_T OptsInfo[]
static
Initial value:
=
{
{NULL, }
}

Command line options information.

Definition at line 107 of file utRobot.cxx.

Referenced by mainInit().

OptsInfo_T OptsInfo[]
static
Initial value:
=
{
{NULL, }
}

Command line options information.

Definition at line 109 of file utXmlTunes.cxx.

Referenced by mainInit().

OptsInfo_T OptsInfo[]
static
Initial value:
=
{
{NULL, }
}

Command line options information.

Definition at line 109 of file utXmlCfg.cxx.

Referenced by mainInit().

OptsPgmInfo_T PgmInfo
static
Initial value:
=
{
"<FILE>",
"Unit test liblaelaps LaeRobot class.",
"The %P command unit tests the liblaelap LaeRobot class basic operation.",
NULL
}

Program information.

Definition at line 89 of file utRobot.cxx.

Referenced by mainInit().

OptsPgmInfo_T PgmInfo
static
Initial value:
=
{
"<FILE>",
"Unit test liblaelaps LaeDesc and LaeXmlCfg classes.",
"The %P command unit tests the liblaelap LaeDesc and "
" LaeXmlCfg class operation.",
NULL
}

Program information.

Definition at line 90 of file utXmlCfg.cxx.

Referenced by mainInit().

OptsPgmInfo_T PgmInfo
static
Initial value:
=
{
"<FILE>",
"Unit test liblaelaps LaeTune and LaeXmlTune classes.",
"The %P command unit tests the liblaelap LaeTune and LaeXmlTune class "
"operation.",
NULL
}

Program information.

Definition at line 90 of file utXmlTunes.cxx.

Referenced by mainInit().

OptsPgmInfo_T PgmInfo
static
Initial value:
=
{
NULL,
"Unit test liblaelaps LaeThread base class.",
"The %P command unit tests the liblaelap LaeThread base class operation.",
NULL
}

Program information.

Definition at line 93 of file utThread.cxx.

Referenced by mainInit().