/** Prepares the given ArRobot object for connection, then begins
 * a blocking connection attempt.
 * If you wish to simply prepare the ArRobot object, but not begin
 * the connection, then use setupRobot().
 */
AREXPORT bool ArRobotConnector::connectRobot(void)
{
  if(! connectRobot(myRobot) )
    return false;


  if(myConnectAllComponents)
  {
    if(getRemoteIsSim() )
    {
      ArLog::log(ArLog::Normal, "ArRobotConnector: Connected to simulator, not connecting to additional hardware components.");
    }
    else
    {
      
      if(myBatteryConnector)
      {
        ArLog::log(ArLog::Normal, "ArRobotConnector: Connecting to MTX batteries (if neccesary)...");
        if(!myBatteryConnector->connectBatteries())
        {
          ArLog::log(ArLog::Terse, "ArRobotConnector: Error: Could not connect to robot batteries.");
          return false;
        }
      }

/*
      if(myLCDConnector)
      {
        ArLog::log(ArLog::Normal, "ArRobotConnector: Connecting to MTX LCD (if neccesary)...");
        if(!myLCDConnector->connectLCDs())
        {
          ArLog::log(ArLog::Terse, "ArRobotConnector: Error: Could not connect to robot LCD interface.");
          return false;
        }
      }
*/

assert(mySonarConnector);
      if(mySonarConnector)
      {
        ArLog::log(ArLog::Normal, "ArRobotConnector: Connecting to MTX sonar (if neccesary)...");
        if(!mySonarConnector->connectSonars())
        {
          ArLog::log(ArLog::Terse, "ArRobotConnector: Error: Could not connect to sonar(s).");
          return false;
        }
        
      } 
    }
  }

  return true;
}
Exemple #2
0
/** Prepares the given ArRobot object for connection, then begins
 * a blocking connection attempt.
 * If you wish to simply prepare the ArRobot object, but not begin
 * the connection, then use setupRobot().
 */
AREXPORT bool ArRobotConnector::connectRobot(void)
{
  if(! connectRobot(myRobot) )
    return false;

  myRobot->comInt(ArCommands::JOYINFO, 0); // make sure we start with Joystick packets disabled (Pioneer starts with them disabled, but MTX starts with them enabled, even if program doesn't request them)

  if(myConnectAllComponents)
  {
    if(getRemoteIsSim() )
    {
      ArLog::log(ArLog::Normal, "ArRobotConnector: Connected to simulator, not connecting to additional hardware components.");
    }
    else
    {
      
      if(myBatteryConnector)
      {
        ArLog::log(ArLog::Normal, "ArRobotConnector: Connecting to MTX batteries (if neccesary)...");
        if(!myBatteryConnector->connectBatteries())
        {
          ArLog::log(ArLog::Terse, "ArRobotConnector: Error: Could not connect to robot batteries.");
          return false;
        }
      }

/*
      if(myLCDConnector)
      {
        ArLog::log(ArLog::Normal, "ArRobotConnector: Connecting to MTX LCD (if neccesary)...");
        if(!myLCDConnector->connectLCDs())
        {
          ArLog::log(ArLog::Terse, "ArRobotConnector: Error: Could not connect to robot LCD interface.");
          return false;
        }
      }
*/

      if(mySonarConnector)
      {
        ArLog::log(ArLog::Normal, "ArRobotConnector: Connecting to MTX sonar (if neccesary)...");
        if(!mySonarConnector->connectSonars())
        {
          ArLog::log(ArLog::Terse, "ArRobotConnector: Error: Could not connect to sonar(s).");
          return false;
        }
        
      }
    }
  }

  return true;
}
/** Prepares the given ArRobot object for connection, then begins
 * a blocking connection attempt.
 * If you wish to simply prepare the ArRobot object, but not begin
 * the connection, then use setupRobot().
 */
AREXPORT bool ArRobotConnector::connectRobot(void)
{
  return connectRobot(myRobot);
}
RoboUART::RoboUART() : RoboInterface()
{
	tty_fd = 0;

	connectRobot();
}