app_manager_plugin.py
Go to the documentation of this file.
1 class AppManagerPlugin(object):
2 
3  """Base class for app_manager plugin
4 
5  This is a base class for app_manager plugin.
6  app_manager plugin have two class methods;
7  app_manager_start_plugin and app_manager_stop_plugin.
8  app_manager_start_plugin runs before app starts,
9  and app_manager_stop_plugin runs after app stops.
10 
11  app_manager plugin is defined in yaml format as below;
12  - name: app_recorder/rosbag_recorder_plugin # plugin name
13  launch: app_recorder/rosbag_recorder.launch # plugin launch name
14  module: app_recorder.rosbag_recorder_plugin.RosbagRecorderPlugin
15  # plugin module name
16 
17  Also, app_manager plugin yaml file is exported in package.xml as below;
18  <export>
19  <app_manager plugin="${prefix}/app_recorder_plugin.yaml" />
20  </export>
21 
22  In app file, you can add plugin to your app as below;
23  - plugins
24  - name: mail_notifier_plugin # name to identify this plugin
25  type: app_notifier/mail_notifier_plugin # plugin type
26  launch_args: # arguments for plugin launch file
27  - foo: bar
28  plugin_args: # arguments for plugin function arguments
29  - hoge: fuga
30 
31  Both class methods have 3 arguments;
32  App definition, app context and app plugin arguments.
33  App definition is the definition of app.
34  App context is the shared information about app (app context)
35  between plugins, such as app results and plugin results.
36  App plugin arguments are the arguments for the module defined in app file
37  and written as below;
38  """
39 
40  def __init__(self):
41  pass
42 
43  @classmethod
44  def app_manager_start_plugin(cls, app, ctx, plugin_args):
45  """Start plugin for app_manager
46 
47  Args:
48  app (app_manager.AppDefinition): app definition
49  ctx (dict): app context shared between plugins
50  plugin_args (dict): arguments for plugin defined in app file
51  """
52 
53  return ctx
54 
55  @classmethod
56  def app_manager_stop_plugin(cls, app, ctx, plugin_args):
57  """Stop plugin for app_manager
58 
59  Args:
60  app (app_manager.AppDefinition): app definition
61  ctx (dict): app context shared between plugins
62  plugin_args (dict): arguments for plugin defined in app file
63  """
64 
65  return ctx
def app_manager_start_plugin(cls, app, ctx, plugin_args)
def app_manager_stop_plugin(cls, app, ctx, plugin_args)


app_manager
Author(s): Jeremy Leibs, Ken Conley, Yuki Furuta
autogenerated on Fri Mar 5 2021 03:07:47