Articles     Forum     Examples     Download     Open Source

 

PocoCapsule/C++ DSM example: Robotic Vehicle

Copyright(c) 2006 by Pocomatic Software. All rights reserved.

This example illustrates a robotic vehicle motion control application assembled using PocoCapsule/C++ IoC and DSM from following seven components:

Note: A OMG RTC version of this example can be found in the ${POCOCAPSULE_DIR}/examples/corba/rtc directory.

These components are implemented as plain old C++ objects (POCOs) and are instantiated and wired up using the PocoCapsule/C++ IoC Container according to the setup.xml description. The assembled motion application is illustrated in the following diagram:


Source Files

main.C: This is a mini container, used by PocoCapsule/C++ to assemble/deploy this RTC application.

ServoComponent.h and ServoComponent.C: The implementation of ServoComponent.

BumperSensorComponent.h and BumperSensorComponent.C: The implementation of BumperSensorComponent.

RangeScannerComponent.h and RangeScannerComponent.C: The implementation of laser RangeScannerComponent.

VehicleController.h and VehicleControl.C: The implementation of VehicleController.

objImpls.h: provides inline implementation of the LogAndDisplay component and ports of above components.

setup.xml: This is the application context described the setup of this RTC application.

robotic-application.dtd: This is the document type definition specifying the domain-specific-modelling (DSM) schema.

robotic-application2poco.xsl: This is the DSM schema to the core schema of PocoCapsule/C++ transformation stylesheet.

Building this example

To build this example, the environment variable POCOCAPSULE_DIR should point to the PocoCapsule/C++ installed directory. Then, this example can be built by simply invoking gmake/make on linux/unix or nmake on windows.

Running this example

· Before starting the application deployment container (i.e. the main executable), make sure the LD_LIBRARY_PATH (on linux and solaris) or the PATH (on windows) environment variable is set correctly to include the ${POCOCAPSULE_DIR}/lib directory.

· start the main executable:

prompt> main 

It will display the following component instantiation and wiring operations made during the assembling:

[wire]: The ControlIn reference of the left wheel servo is injected into the LeftWheelControlOut port of the vehicle controller
[wire]: The ControlIn reference of the right wheel servo is injected into the RightWheelControlOut port of the vehicle controller
[wire]: The ControlIn reference of the laser ranger scanner is injected into the ScanCommandOut port of the vehicle controller
[wire]: The log and display is injected into the StatusOut port of the vehicle controller
[wire]: The LeftWheelDataIn sink reference of the vehicle controller is injected into the SpeedDataOut port of the left wheel servo
[wire]: The RightWheelDataIn sink reference of the vehicle controller is injected into the SpeedDataOut port of the right wheel servo
[wire]: The FrontBumperDataIn sink reference of the vehicle controller is injected into the BumperDataOut port of the front bumper sensor
[wire]: The RearBumperDataIn sink reference of the vehicle controller is injected into the BumperDataOut port of the rear bumper sensor
[wire]: The RangeScanDataIn sink reference of the vehicle controller is injected into the RangeScanDataOut port of the laser ranger scanner

Back to the root page