Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

ai_game_manager

Gaëtan Blond edited this page Sep 9, 2018 · 10 revisions

Description

Provides a lib to be imported from other node to make them detected by the system and to react to special events (arm for example). Contains also a node that maintain information about the state of the nodes connected through the lib.

Authors and versions

  • v0.0.0 (A17) @MadeInPierre @furmi
    • Package created
    • Node and python lib added
  • v0.0.1 (A17/P18) @Mindstan
    • Cpp lib added

Configuration

How to integrate the node in other packages

Common configuration

  • In package.xml, add this package:
<depend>ai_game_manager</depend>
  • In CMakeLists.txt:
find_package(catkin REQUIRED COMPONENTS
    ...
    ai_game_manager
)

C++ specific:

First of all, the library must be included in your code:

#include "ai_game_manager/init_service.h"

Then, you need to instantiate a StatusServices object and call the member function setReady when you're done initializing your node:

StatusServices gameStatusSrv("namespace", "node_name");
gameStatusSrv.setReady(true);

Optionally, the constructor of StatusServices can take two pointers on a function (std::function, works with lambdas):

  • A function returning void and taking as parameter const ai_game_manager::ArmRequest::ConstPtr& that will be call when an arm event is fired. For example:
StatusServices(
    "namespace",
    "node_name",
    [](const ai_game_manager::ArmRequest::ConstPtr &) {
            // Do something incredible on arm event
});
  • A function returning void and taking as parameter const ai_game_manager::GameStatus::ConstPtr& that will be call with the new status.

Communication

The library

Clients and subscribtions

Topic Name Type Function
/ai/game_manager/node_ready Service Used by the node to tell this package's node when it finished its initialization and if it succeeded.
/ai/game_manager/arm Topic (Optional) Trigger the arm event if needed in the node
/ai/game_manager/status Topic (Optional) Allow the node to be notified when the status of the game is changing (game starts/stops, etc).

The node