icub-client
Create a new Subsystem

This provides a tutorial on how to create your own subsystem for icub-client. More...

This provides a tutorial on how to create your own subsystem for icub-client.

Subsystems provide a centralised way to control the different modules available to icub-client. What follows is a description of the steps required to create a custom subsystem providing centralised access to a specific module. From here on in we will be referring to the specific module as <newSub>.

Step 1 Go to icub-client/src/libraries/icubclient/include/icubclient/subsystems, add a new file subsystem_<newSub>.h and open it for editing.

Step 2 Go to icub-client/src/libraries/icubclient/src/subsystems and add a new file subsystem_<newSub>.cpp and open it for editing.

Step 3 : Write the subsystem functions to your .h and .cpp files using subSystem_agentDector.h and subSystem_agentDector.cpp as a guideline. The principal functions that must be carried out are:

Additional functions can also be added to your subsystem to provide custom functionality.

Step 4 : Open icub-client/src/libraries/icubclient/CMakeLists.txt and to the set(${LIBRARY_TARGET_NAME}_SRC section, add :

src/subsystems/subSystem_<newSub>.cpp 

Also to the set(${LIBRARY_TARGET_NAME}_HDR section add :

include/${LIBRARY_TARGET_NAME}/subsystems/subSystem_<newSub>.h 

This will enable compilation of your subsystem.

Step 5 : Open icub-client/src/libraries/icubclient/include/icubclient/all.h for editing and add :

#include "icubclient/subsystems/subSystem_<newSub>.h"

to the section marked as subsystems.

Step 6 : Open icub-client/src/libraries/icubclient/include/icubclient/clients/icubClient.h for editing and add:

class SubSystem_<newSub>;

to the other subsystem class definitions at line 53 and

SubSystem_<newSub>* get<newSub>Client(); 

at line 109.

Step 7 : Open icub-client/src/libraries/icubclient/src/clients/icubClient.cpp for editing and add

#include "icubclient/subsystems/subSystem_<newSub>.h" 

at line 29.

Add

else if (currentSS == SUBSYSTEM_<newSub>)
    subSystems[SUBSYSTEM_<newSub>] = new SubSystem_<newSub>(fullName); 

at line 96.

Add

SubSystem_<newSub>* ICubClient::get<newSub>Client()
{
    return getSubSystem<SubSystem_<newSub>>(SUBSYSTEM_<newSub>);
} 

to the end of the file.

If you additionally want to compile python bindings for the subsytem you must also perform the following steps:

Step 8: Open icub-client/bindings/icubclient.i for editing.

Step 9: Add

#include <icubclient/subsystems/subSystem_<newSub>.h> 

to line 28 and

%include <icubclient/subsystems/subSystem_<newSub>.h> 

to line 52.

(This page can be edited at src/doc/subsystems.dox)