Пример #1
0
FGrab::FGrab(boost::shared_ptr<AL::ALBroker> broker,
             const std::string& name)
    : AL::ALModule(broker, name) {
  // Describe the module here. This will appear on the webpage
  setModuleDescription("Grab raw frames from the active camera.");

  functionName("grab_to_file", getName(), "Grab a frame and write it in a file. "
               "It is not necessary to call release() afterwards.");
  addParam("file", "The path and name of the file to be written");
  BIND_METHOD(FGrab::grab_to_file);

  functionName("grab", getName(), "Returns a buffer containing a raw YUV422 picture. "
               "This buffer is not to be freed manually. Call release() for cleanup.");
  setReturn("unsigned char[]", "Buffer containing the YUV422 video frame");
  BIND_METHOD(FGrab::grab);

  functionName("getImageSize", getName(), "Returns the size in bytes of the buffer "
               "currently on hold.");
  setReturn("char[]", "Buffer containing the YUV422 video frame");
  BIND_METHOD(FGrab::grab);
  
  // Release the buffer, necessary before calling grab again
  functionName("release", getName(), "Releases the buffer allocated by grab().");
  BIND_METHOD(FGrab::release);

  functionName("switchCamera", getName(), "Switch to the camera passed in parameter.");
  addParam("camera", "The camera code");
  BIND_METHOD(FGrab::release);
}
Пример #2
0
//______________________________________________
// constructor
//______________________________________________
mainModule::mainModule(boost::shared_ptr<AL::ALBroker> broker, const std::string& name) :
		AL::ALModule(broker, name)
{
	std::string bodyId, headId;
	setModuleDescription("This is the Kouretes Team root module ");
	functionName("Start", "mainModule", "Method to start Talws");
	BIND_METHOD(mainModule::Start);
	functionName("Stop", "mainModule", "Method to stop Talws");
	BIND_METHOD(mainModule::Stop);
	boost::shared_ptr<AL::ALMemoryProxy> memory;
	KAlBroker::Instance().SetBroker(broker);
	try
	{
		memory = KAlBroker::Instance().GetBroker()->getMemoryProxy();
	} catch (AL::ALError& e)
	{
		std::cerr << "Error in getting memory proxy" << std::endl;
		std::cout << e.what() << std::endl;
	}

	try
	{
		bodyId = std::string(memory->getData("Device/DeviceList/ChestBoard/BodyId"));
		headId = std::string(memory->getData("RobotConfig/Head/HeadId"));
		if (bodyId.size() > 15)
		{
			bodyId = bodyId.substr(16, 19);/*bodyId.size()-5, bodyId.size()-2*/ //manually because aldebarab forgot to put a \0...
		} else
		{
			try
			{
				bodyId = bodyId.substr(11, 14);
			} catch (const std::out_of_range& oor)
			{
				std::cerr << "Out of Range error: " << oor.what() <<" " <<  bodyId << '\n';
			}


		}
	} catch (AL::ALError& e)
	{
		std::cerr << "Error in getting body and/or head id`s" << std::endl;
		bodyId = "";
		headId = "";
	}

	std::cout << "KRobot - Found Head ID: '" << headId << "'" << std::endl;
	//std::cout << "KRobot - Found Body ID: '" << _toString(KRobotConfig::Instance().getConfig(KDeviceLists::Interpret::BODY_ID).size()) << "'" << std::endl;
	std::cout << "KRobot - Found Body ID: '" << bodyId << "'" << std::endl;
#ifndef KROBOT_IS_REMOTE
	Configurator::Instance().initConfigurator("/home/nao/naoqi/config/", headId, bodyId);
#else
	Configurator::Instance().initConfigurator("./config/", "", "");
#endif
	tal = new Talws();
}
Пример #3
0
    WhistelDetector(boost::shared_ptr<AL::ALBroker> broker, const std::string &name): AL::ALModule(broker, name), mWhistelCount(0) {
        setModuleDescription("Whistle Detector");

        functionName("setPaused", getName(), "pause / unpause whistel detection");
        addParam("paused", "bool for paused");
        BIND_METHOD(WhistelDetector::setPaused);
    }
Пример #4
0
ResponseToNameInterface::ResponseToNameInterface(boost::shared_ptr<AL::ALBroker> pBroker, const std::string& pName) :  AL::ALModule(pBroker, pName) {

    setModuleDescription("Interface module, reacting to events generated by the Logger module, calling child by either name or by using special phrases");

    functionName("startTask", getName(), "Function used to start/enable the task");
    addParam("todo", "Tell the module either to start or enable the task");
    BIND_METHOD(ResponseToNameInterface::startTask);

    functionName("onTactilTouched", getName(), "FrontTactilTouched callback, starts the session");
    BIND_METHOD(ResponseToNameInterface::onTactilTouched);

    functionName("callChild", getName(), "CallChild callback, plays the sound");
    BIND_METHOD(ResponseToNameInterface::callChild);

    functionName("endSession", getName(), "EndSession callback, resets the Interface");
    BIND_METHOD(ResponseToNameInterface::endSession);
}
Пример #5
0
    HandVoiceControl(AL::ALBroker::Ptr broker, const std::string& name)
        : AL::ALModule(broker, std::string("HandVoiceControl"))
        , mutex(AL::ALMutex::createALMutex())
    {
        setModuleDescription("Control hand open/close with voice commands.");

        functionName("onWordRecognized", getName(), "Handle voice command notifications.");
        BIND_METHOD(HandVoiceControl::onWordRecognized);
    }
Пример #6
0
/**
 * Constructor for NaoPre object
 * @param broker The parent broker
 * @param name The name of the module
 */
NaoPre::NaoPre(
    boost::shared_ptr<AL::ALBroker> broker,
    const std::string& name): AL::ALModule(broker, name)
{
  setModuleDescription("Preview controller to translate zmp trajectory into com trajectory");

  functionName("update", "NaoPre", "run the preview controller for one step");
  BIND_METHOD(NaoPre::update);

  functionName("reset", "NaoPre", "reset the preview controller");
  BIND_METHOD(NaoPre::reset);

  functionName("setVerbo", getName(), "set verbose level");
  addParam("verbo_d", "desired verbose level");
  BIND_METHOD(NaoPre::setVerbo);

  verbo = 1;

}
Пример #7
0
SubscribeGyro::SubscribeGyro(
  boost::shared_ptr<AL::ALBroker> broker,
  const std::string& name): AL::ALModule(broker, name),
    fCallbackMutex(AL::ALMutex::createALMutex())
{
  setModuleDescription("This module presents how to subscribe to a simple event (here RightSubscribeGyroPressed) and use a callback method.");

  //functionName("onRightSubscribeGyroPressed", getName(), "Method called when the right subscribegyro is pressed. Makes a LED animation.");
  functionName("onMoveBackward", getName(), "MoveBackward");
  //BIND_METHOD(SubscribeGyro::onRightSubscribeGyroPressed)
  BIND_METHOD(SubscribeGyro::onMoveBackward)
  functionName("onMoveForward", getName(), "MoveForward");
  BIND_METHOD(SubscribeGyro::onMoveForward)
  functionName("GyroStart", getName(), "StartMovement");
  BIND_METHOD(SubscribeGyro::GyroStart)

//std::fstream file;
file.open("/home/nao/data/gyroswingdata.txt");

}
Пример #8
0
// declare constructor
OnFaceDetection::OnFaceDetection(boost::shared_ptr<AL::ALBroker> broker, const std::string& name):
	AL::ALModule(broker, name),
	fMemoryProxy(getParentBroker()),
	fFaces(AL::ALValue()),
	fFaceCount(0),
	fCallbackMutex(AL::ALMutex::createALMutex()) {

		setModuleDescription("Module that detects faces and acts accordingly.");

		functionName("callback", getName(), "");
		BIND_METHOD(OnFaceDetection::callback);

	}
Пример #9
0
@module_name@::@module_name@(boost::shared_ptr<AL::ALBroker> broker,
                   const std::string& name)
  : AL::ALModule(broker, name)
{
  // Describe the module here. This will appear on the webpage
  setModuleDescription("This is automatically generated comment. Please input short description on your own module.");

  /**
   * Define callable methods with their descriptions:
   * This makes the method available to other cpp modules
   * and to python.
   * The name given will be the one visible from outside the module.
   * This method has no parameters or return value to describe
   * functionName(<method_name>, <class_name>, <method_description>);
   * BIND_METHOD(<method_reference>);
   */
  functionName("printHelloWorld", getName(), "Print hello to the world");
  BIND_METHOD(@module_name@::printHelloWorld);

  /**
   * addParam(<attribut_name>, <attribut_descrption>);
   * This enables to document the parameters of the method.
   * It is not compulsory to write this line.
   *
   * setReturn(<return_name>, <return_description>);
   * This enables to document the return of the method.
   * It is not compulsory to write this line.
   */
  functionName("echo", getName(), "Just echo back the argument.");
  setReturn("ALValue", "return argument");
  BIND_METHOD(@module_name@::echo);

  // If you had other methods, you could bind them here...
  /**
   * Bound methods can only take const ref arguments of basic types,
   * or AL::ALValue or return basic types or an AL::ALValue.
   */
}
Пример #10
0
/**
 * Constructor for NaoSim object
 * @param broker The parent broker
 * @param name The name of the module
 */
NaoSim::NaoSim(
    boost::shared_ptr<AL::ALBroker> broker,
    const std::string& name): AL::ALModule(broker, name),fastMotionCommands(boost::shared_ptr<AL::ALMemoryFastAccess>(new AL::ALMemoryFastAccess()))
{

    std::cout << "[NaoSim::NaoSim] initialize the simulation module" << std::endl;

  setModuleDescription("Simulate the Robot Motion by kinematics");

  functionName("reset", "NaoSim", "reset the preview controller");
  BIND_METHOD(NaoSim::reset);

  functionName("setVerbo", getName(), "set verbose level");
  addParam("verbo_d", "desired verbose level");
  BIND_METHOD(NaoSim::setVerbo);

  functionName("ControlSteps", getName(), "run the simulation");
  addParam("num", "number of steps");
  BIND_METHOD(NaoSim::ControlSteps);

  verbo = 9;

}
Пример #11
0
/**
 * Constructor for oru_walk object
 * @param broker The parent broker
 * @param name The name of the module
 */
oru_walk::oru_walk(ALPtr<ALBroker> broker, const string& name) : 
    ALModule(broker, name),
    access_sensor_values (ALPtr<ALMemoryFastAccess>(new ALMemoryFastAccess())),
    wp (broker)
{
    setModuleDescription("Orebro University: NAO walking module");


    // advertise functions
    functionName( "setStiffness" , getName(), "change stiffness of all joint");
    addParam( "value", "new stiffness value from 0.0 to 1.0");
    BIND_METHOD( oru_walk::setStiffness );

    functionName( "initPosition", getName() , "initialize robot position");
    BIND_METHOD( oru_walk::initPosition );

    functionName( "walk", getName() , "walk");
    BIND_METHOD( oru_walk::walk );

    functionName( "stopWalking", getName() , "stopWalking");
    BIND_METHOD( oru_walk::stopWalkingRemote );

    solver = NULL;
}
Пример #12
0
OnFaceDetection::OnFaceDetection(
  boost::shared_ptr<AL::ALBroker> broker,
  const std::string& name):
    AL::ALModule(broker, name),
    fMemoryProxy(getParentBroker()),
    fFaces(AL::ALValue()),
    fFacesCount(0),
    fCallbackMutex(AL::ALMutex::createALMutex())
{
  setModuleDescription("This is an autogenerated module, this descriptio needs to be updated.");

  functionName("callback", getName(), "");
  BIND_METHOD(OnFaceDetection::callback);

}
Пример #13
0
NaoIK::NaoIK(boost::shared_ptr<AL::ALBroker> broker,
                   const std::string& name)
  : AL::ALModule(broker, name), fastMotionCommands(boost::shared_ptr<AL::ALMemoryFastAccess>(new AL::ALMemoryFastAccess())),fastSensorValues(boost::shared_ptr<AL::ALMemoryFastAccess>(new AL::ALMemoryFastAccess()))
{
  // Describe the module here. This will appear on the webpage
  setModuleDescription("This module is used to solve the inverse kinematics of the whole body. All the Cartesian markers should be relative to left foot.");


  functionName("init", getName(), "initialize the module");
  BIND_METHOD(NaoIK::init);

  functionName("reset", getName(), "reset the module");
  BIND_METHOD(NaoIK::reset);

  functionName("calIK", getName(), "calculate the inverse kinematics with current joint values");
  BIND_METHOD(NaoIK::calIK);

  functionName("setVerbo", getName(), "set verbose level");
  addParam("verbo_d", "desired verbose level");
  BIND_METHOD(NaoIK::setVerbo);

 // default debug information levels
  verbo=1;
}
Пример #14
0
NaoMarkServiceDetection::NaoMarkServiceDetection(
  boost::shared_ptr<AL::ALBroker> broker,
  const std::string& name):
      AL::ALModule(broker, name),
      fMemoryProxy(getParentBroker())
{
	setModuleDescription("");
	_naoMarkDetected = false;
	_isAllowedToMove = true;
	_isThreadRuning = false;
	_isMarkFound = false;
	_markToFind = -1;

	motionProxy = new AL::ALMotionProxy(*_robotIp,9559);
	functionName("callback", getName(), "");
	BIND_METHOD(NaoMarkServiceDetection::callback)

	_pBackGroundThread = new boost::thread(threadEntry,this);
  
	//_pBackGroundThread->join();
	//boost::thread::join
}