pal_statistics.statistics_registry module

class pal_statistics.statistics_registry.Registration(name, registry)

Bases: object

An utility class to handle to a registered function or variable.

When goes out of scope unregisters the variable.

class pal_statistics.statistics_registry.StatisticsRegistry(topic, node: rclpy.node.Node)

Bases: object

createFullMsg()

Create and return a message after reading all registrations.

createOptimizedMsgs()

Create and return a names, values message after reading all registrations.

publish()
publishCustomStatistic(name, value)

Publish a one-time statistic.

publishCustomStatistics(msg)

Publish a one-time statistics msg.

registerFunction(name, func, registration_list=None)

Register a statistics function.

Register a function that will be called to read the value to be published when the publish() method is called.

@param registration_list: If not None, will be extended to include a Registration object for the registered function.

The function takes no arguments and returns a value convertable to float. It can also be used to register a variable using lambda.

registerFunction(‘my_function’, self.my_function) registerFunction(‘my_variable’, (lambda: variable)).

unregister(name)

Unregister a function or variable so it’s no longer read.