void BackgroundStateContext::setBackgroundImage (BackgroundImage backgroundImage)
{
  LOG4CPP_INFO_S ((*mainCat)) << "BackgroundStateContext::setBackgroundImage"
                              << " background=" << backgroundImageToString (backgroundImage).toLatin1().data();

  BackgroundState backgroundState= BACKGROUND_STATE_NONE;
  
  switch (backgroundImage) {
    case BACKGROUND_IMAGE_FILTERED:
      backgroundState = BACKGROUND_STATE_CURVE;
      break;

    case BACKGROUND_IMAGE_NONE:
      backgroundState = BACKGROUND_STATE_NONE;
      break;

     case BACKGROUND_IMAGE_ORIGINAL:
      backgroundState = BACKGROUND_STATE_ORIGINAL;
      break;
  }

  // It is safe to transition to the new state immediately since no BackgroundState classes are on the stack
  requestStateTransition (backgroundState);
  completeRequestedStateTransitionIfExists ();
}
void BackgroundStateContext::close()
{
  LOG4CPP_INFO_S ((*mainCat)) << "BackgroundStateContext::close";

  // It is safe to transition to the new state immediately since no BackgroundState classes are on the stack
  requestStateTransition (BACKGROUND_STATE_UNLOADED);
  completeRequestedStateTransitionIfExists ();
}
Beispiel #3
0
void stopCB(const robot_base_msgs::SoftwareStopConstPtr& message){
	//Need to flip as message is true when should stop
	if(message->stop)
	{
		got_free = false;
	}
	else
	{
		aero_srr_msgs::AeroState req;
		req.state = aero_srr_msgs::AeroState::SEARCH;
		requestStateTransition(req);
	}
	ROS_WARN("Dummy Starrtup Node Got Software Stop [%s]: %s",(message->stop)?"Stop":"Go", message->message.c_str());
}
BackgroundStateContext::BackgroundStateContext(MainWindow &mainWindow) :
  m_mainWindow (mainWindow)
{
  LOG4CPP_INFO_S ((*mainCat)) << "BackgroundStateContext::BackgroundStateContext";

  // These states follow the same order as the BackgroundState enumeration
  m_states.insert (BACKGROUND_STATE_CURVE   , new BackgroundStateCurve    (*this, mainWindow.scene()));
  m_states.insert (BACKGROUND_STATE_NONE    , new BackgroundStateNone     (*this, mainWindow.scene()));
  m_states.insert (BACKGROUND_STATE_ORIGINAL, new BackgroundStateOriginal (*this, mainWindow.scene()));
  m_states.insert (BACKGROUND_STATE_UNLOADED, new BackgroundStateUnloaded (*this, mainWindow.scene()));
  ENGAUGE_ASSERT (m_states.size () == NUM_BACKGROUND_STATES);

  m_currentState = NUM_BACKGROUND_STATES; // Value that forces a transition right away
  requestStateTransition (BACKGROUND_STATE_UNLOADED);
  completeRequestedStateTransitionIfExists();
}