ComponentHandlerQueue

From MARIEWiki

Jump to: navigation, search

Contents

Build an Application Adapter (AA) from the template

In #util/trunk/template, there's a template that help to build your own ComponentHandlerQueue application adapter (AA). That type of AA is asynchronous and event-based. When a port is stimulate by an input, an event request is produce to respond to that input.

This tutorial explain how to modify the template provide to build your own ComponentHandlerQueue application adapter. The template is very basic and builds two type of request. The first one is a quit request that allow to safely close the AA. The second is a request to an input port that suggest a way to process the input.

For this tutorial, it is assumed that the root of the project marie is in directory DIR_MARIE and that the desired AA is to be build in DIR_AA. Moreover, the desired name of your AA is assumed to be MyAA.

Step 1 - Copy the template to your working directory

   $ cp -fr DIR_MARIE/trunk/util/template/YourComponentHandlerQueue DIR_AA
   $ cd DIR_AA
   $ mv YourComponentHandlerQueue MyAA
   $ cd MyAA
   $ ls
   aaYourComponentName.cpp  YourComponentNameComponentHandler.cpp  YourComponentNameVisitorConfig.cpp
   SConscript             YourComponentNameComponentHandler.h    YourComponentNameVisitorConfig.h

Step 2 - Change the name of the files

At the end of the step, the directory should list :

   aaMyAA.cpp  SConscript  MyAAComponentHandler.cpp  MyAAComponentHandler.h  MyAAVisitorConfig.cpp  MyAAVisitorConfig.h

Step 3 - Modify the source code

In each source files and the SConscript file, search and replace the following :

  • YourComponentName by MyAA;
  • YOUR_COMPONENT_NAME by MY_AA;
  • "MarieDataType" by the proper data type (i.e.: DataOdometry, DataLaser, etc);
  • "m_marieDataType" by a proper variable name (i.e.: m_odometry, m_laser, etc.);
  • "marieDataType" by a proper variable name (i.e.: odometry, laser, etc.);
  • "InputName" by a better expression related to your project (i.e.: OdometryInput, LaserInput, etc.);
  • "inputName" by a better expression related to your project (i.e.: odometryInput, laserInput, etc.);
  • "m_inputName" by a better variable name related to your project (i.e.: m_odometryInput, m_laserInput, etc.);
  • "m_outputNamePort" by a better variable name related to your project (i.e.: m_odometryOutputPort, m_laserOutputPort, etc.);
  • "outputname" by a better variable name related to your project (i.e.: odometryOutputPort, laserOutputPort, etc.).

Finaly, look a the comments in the code. There is a proposed way of dealing with the inputs received by the port. It may vary for your own purpose so its commented by default.

Step 4 - Compile the adapter

There SConscript file need to be added in a scons SConsctruct build tree. In a tree similar to the one of MARIE, look for SConscript file the parent directory of the AA and add MyAA/SConcript to the variable subdirs.

Example :

  # ls ../
  MyAA  OtherAA  SConscript
  # cat ../SConscript
  subdirs=['MyAA/SConscript', 'OtherAA/SConscript']
  
SConscript(subdirs)

When the SConscript is properly included in a build tree compile with the instruction :

  scons -u

Step 5 - Delete .svn directory

Step 1 also copy the hidden directory .svn of the template. Use the following command to delete it.

  # rm -fr .svn

Personal tools