Public Member Functions | Private Member Functions | Private Attributes | List of all members
self_test::TestRunner Class Reference

Class to facilitate the creation of component self-tests. More...

#include <self_test.h>

Inheritance diagram for self_test::TestRunner:
Inheritance graph
[legend]

Public Member Functions

void checkTest ()
 Check if a self-test is pending. If so, start it and wait for it to complete. More...
 
void setID (std::string id)
 Sets the ID of the part being tested. More...
 
 TestRunner (ros::NodeHandle h=ros::NodeHandle(), ros::NodeHandle ph=ros::NodeHandle("~"))
 Constructs a dispatcher. More...
 
- Public Member Functions inherited from diagnostic_updater::DiagnosticTaskVector
void add (const std::string &name, TaskFunction f)
 
void add (DiagnosticTask &task)
 
void add (const std::string name, T *c, void(T::*f)(diagnostic_updater::DiagnosticStatusWrapper &))
 
bool removeByName (const std::string name)
 

Private Member Functions

bool doTest (diagnostic_msgs::SelfTest::Request &req, diagnostic_msgs::SelfTest::Response &res)
 

Private Attributes

std::string id_
 
ros::NodeHandle node_handle_
 
ros::NodeHandle private_node_handle_
 
ros::CallbackQueue self_test_queue_
 
ros::ServiceServer service_server_
 
bool verbose
 

Additional Inherited Members

- Protected Member Functions inherited from diagnostic_updater::DiagnosticTaskVector
void addInternal (DiagnosticTaskInternal &task)
 
const std::vector< DiagnosticTaskInternal > & getTasks ()
 
- Protected Attributes inherited from diagnostic_updater::DiagnosticTaskVector
boost::mutex lock_
 

Detailed Description

Class to facilitate the creation of component self-tests.

The self_test::TestRunner class advertises the "self_test" service, and maintains a list of pretests and tests. When "self_test" is invoked, TestRunner waits for a suitable time to interrupt the node and run the tests. Results from the tests are collected and returned to the caller.

self_test::TestRunner's is a derived class from diagnostic_updater::DiagnosticTaskVector. For documentation of the add() methods you will have to refer to the base class's documentation.

Definition at line 68 of file self_test.h.

Constructor & Destructor Documentation

◆ TestRunner()

self_test::TestRunner::TestRunner ( ros::NodeHandle  h = ros::NodeHandle(),
ros::NodeHandle  ph = ros::NodeHandle("~") 
)
inline

Constructs a dispatcher.

Parameters
ownerClass that owns this dispatcher. This is used as the default class for tests that are member-functions.
hNodeHandle from which to work. (Currently unused?)

Definition at line 90 of file self_test.h.

Member Function Documentation

◆ checkTest()

void self_test::TestRunner::checkTest ( )
inline

Check if a self-test is pending. If so, start it and wait for it to complete.

Definition at line 107 of file self_test.h.

◆ doTest()

bool self_test::TestRunner::doTest ( diagnostic_msgs::SelfTest::Request &  req,
diagnostic_msgs::SelfTest::Response &  res 
)
inlineprivate

The service callback for the "self-test" service.

Definition at line 130 of file self_test.h.

◆ setID()

void self_test::TestRunner::setID ( std::string  id)
inline

Sets the ID of the part being tested.

This method is expected to be called by one of the tests during the self-test.

Parameters
id: String that identifies the piece of hardware being tested.

Definition at line 121 of file self_test.h.

Member Data Documentation

◆ id_

std::string self_test::TestRunner::id_
private

Definition at line 75 of file self_test.h.

◆ node_handle_

ros::NodeHandle self_test::TestRunner::node_handle_
private

Definition at line 73 of file self_test.h.

◆ private_node_handle_

ros::NodeHandle self_test::TestRunner::private_node_handle_
private

Definition at line 74 of file self_test.h.

◆ self_test_queue_

ros::CallbackQueue self_test::TestRunner::self_test_queue_
private

Definition at line 72 of file self_test.h.

◆ service_server_

ros::ServiceServer self_test::TestRunner::service_server_
private

Definition at line 71 of file self_test.h.

◆ verbose

bool self_test::TestRunner::verbose
private

Definition at line 77 of file self_test.h.


The documentation for this class was generated from the following file:


self_test
Author(s): Kevin Watts, Brice Rebsamen , Jeremy Leibs and Blaise Gassend
autogenerated on Mon Feb 28 2022 22:19:58