...
For instance, for the Scheduler component (check the functions the Scheduler must implement in ACS Workshop - Interfaces):
Code Block |
---|
language | yml |
---|
title | scheduler.yml |
---|
|
working_dir: /home/developer/workspace
prefix: acsws
module: SCHEDULER_MODULE
component_name: Scheduler
functions:
- 'void start()'
- 'void stop()'
- 'long proposalUnderExecution()' |
Example output After executing the Component Generator Tool you should see something like (click on "Expand source"):
...
As you can see, two directories were created: "idlScheduler" and "idlSchedulerpyScheduler".
Code Block |
---|
language | bash |
---|
title | idlScheduler |
---|
collapse | true |
---|
|
> tree workspace/idlScheduler/
workspace/idlScheduler/
├── bin
├── ChangeLog
├── config
│ └── CDB
│ └── schemas
├── doc
├── idl
│ └── Scheduler.idl
├── include
├── lib
│ ├── ACScomponents
│ ├── endorsed
│ ├── libSchedulerStubs.a
│ ├── libSchedulerStubs.so
│ ├── python
│ │ └── site-packages
│ │ ├── Scheduler_idl.py
│ │ ├── SCHEDULER_MODULE
│ │ │ └── __init__.py
│ │ └── SCHEDULER_MODULE__POA
│ │ └── __init__.py
│ └── Scheduler.jar
├── LOGS
├── man
│ ├── man1
│ ├── man2
│ ├── man3
│ ├── man4
│ ├── man5
│ ├── man6
│ ├── man7
│ ├── man8
│ ├── manl
│ └── mann
├── object
│ ├── SchedulerC.cpp
│ ├── SchedulerC.d
│ ├── SchedulerC.h
│ ├── SchedulerC.inl
│ ├── SchedulerC.o
│ ├── SchedulerS.cpp
│ ├── SchedulerS.d
│ ├── SchedulerS.h
│ └── SchedulerS.o
├── rtai
├── src
│ ├── acsws
│ │ └── SCHEDULER_MODULE
│ │ └── SchedulerImpl
│ │ └── SchedulerComponentHelper.java.tpl
│ ├── Makefile
│ ├── Makefile.mk
│ └── module.mk
└── test
33 directories, 21 files |
Code Block |
---|
language | bash |
---|
title | pyScheduler |
---|
collapse | true |
---|
|
> tree workspace/pyScheduler/
workspace/pyScheduler/
├── bin
├── ChangeLog
├── config
│ └── CDB
│ └── schemas
├── doc
├── idl
├── include
├── lib
│ ├── ACScomponents
│ ├── endorsed
│ └── python
│ └── site-packages
│ └── SCHEDULER_MODULEImpl
│ ├── __init__.py
│ └── SchedulerImpl.py
├── LOGS
├── man
│ ├── man1
│ ├── man2
│ ├── man3
│ ├── man4
│ ├── man5
│ ├── man6
│ ├── man7
│ ├── man8
│ ├── manl
│ └── mann
├── object
├── rtai
├── src
│ ├── Makefile
│ ├── Makefile.mk
│ ├── module.mk
│ └── SCHEDULER_MODULEImpl
│ ├── __init__.py
│ └── SchedulerImpl.py
└── test
30 directories, 8 files |
With the following source code for the IDL and implementation:
Code Block |
---|
language | cpp |
---|
title | idlScheduler/idl/Scheduler.idl |
---|
linenumbers | true |
---|
|
#ifndef _SCHEDULER_IDL_
#define _SCHEDULER_IDL_
#pragma prefix "acsws"
#include <acscomponent.idl>
module SCHEDULER_MODULE {
interface Scheduler : ACS::ACSComponent {
void start();
void stop();
long proposalUnderExecution();
};
};
#endif |
Code Block |
---|
language | py |
---|
title | pyScheduler/src/SCHEDULER_MODULEImpl/SchedulerImpl.py |
---|
linenumbers | true |
---|
|
# Client stubs and definitions, such as structs, enums, etc.
import SCHEDULER_MODULE
# Skeleton infrastructure for server implementation
import SCHEDULER_MODULE__POA
# Base component implementation
from Acspy.Servants.ACSComponent import ACSComponent
# Services provided by the container to the component
from Acspy.Servants.ContainerServices import ContainerServices
# Basic component lifecycle (initialize, execute, cleanUp and aboutToAbort methods)
from Acspy.Servants.ComponentLifecycle import ComponentLifecycle
class SchedulerImpl(SCHEDULER_MODULE__POA.Scheduler, ACSComponent, ContainerServices, ComponentLifecycle):
def __init__(self):
ACSComponent.__init__(self)
ContainerServices.__init__(self)
self._logger = self.getLogger()
def start(self):
raise NotImplementedError("This function should do something")
def stop(self):
raise NotImplementedError("This function should do something")
def proposalUnderExecution(self):
raise NotImplementedError("This function should do something")
|