Difference between revisions of "Go straight controller.cpp"

From IridiaWiki
Jump to navigationJump to search
 
 
Line 1: Line 1:
  +
<pre>
 
#include "go_straight_controller.h"
 
#include "go_straight_controller.h"
 
#include "ci_logger.h"
 
#include "ci_logger.h"
Line 43: Line 44:
 
return CCIController::RETURN_OK;
 
return CCIController::RETURN_OK;
 
}
 
}
  +
</pre>

Latest revision as of 19:02, 21 April 2006

#include "go_straight_controller.h"
#include "ci_logger.h"

CGoStraightController::CGoStraightController( void )
   : CCIController( )
{
}

CGoStraightController::~CGoStraightController( void )
{
}

CCIController::ReturnVal CGoStraightController::Init( void ) 
{
   CCILogger::SetLogPrefix( "SGT" );
   CCILogger::LogMsg( "Initialising GoStraight Controller\n" );

   // Call base class init function which does a bunch of sbot initialisation
   CCIController::Init( );

   return CCIController::RETURN_OK;
}

CCIController::ReturnVal CGoStraightController::ControlStep( void )
{
   static int iFirstTimeRound = 0;

   if ( iFirstTimeRound == 0 )
   {
      iFirstTimeRound = 1;
      CCILogger::LogMsg( "Setting track speeds (2, 2)" );
      m_pcCISBot->SetSpeed( 2, 2 );
   }

   return CCIController::RETURN_CONTINUE;
}


CCIController::ReturnVal CGoStraightController::Stop( void )
{
   CCILogger::LogMsg( "Stopping GoStraight Controller\n" );
   m_pcCISBot->SetSpeed( 0, 0 );
   return CCIController::RETURN_OK;
}