Go to the documentation of this file.00001 #include "mrta/log.h"
00002 #include "mrta/robot_monitor.h"
00003 #include "mrta/robot.h"
00004 #include "mrta/system.h"
00005 #include "rqt_mrta/config/architecture/topic.h"
00006 #include "utilities/message_subscriber_registry.h"
00007
00008 namespace mrta
00009 {
00010 RobotMonitor::RobotMonitor(System* system,
00011 utilities::MessageSubscriberRegistry* registry,
00012 Monitor::Config* config, int state)
00013 : Monitor(system, registry, config), state_(state)
00014 {
00015 QList<Robot*> robots(system->getRobots());
00016 for (size_t index(0); index < robots.count(); index++)
00017 {
00018 add(robots[index]);
00019 }
00020 connect(system, SIGNAL(added(const QString&)), this, SLOT(add(const QString&)));
00021 }
00022
00023 RobotMonitor::~RobotMonitor()
00024 {
00025 ROS_INFO_STREAM("[~RobotMonitor]");
00026 }
00027
00028 void RobotMonitor::update(const QString &id)
00029 {
00030 Monitor::update(id, state_);
00031 }
00032
00033 void RobotMonitor::add(const QString& id) { add(getSystem()->getRobot(id)); }
00034
00035 void RobotMonitor::add(Robot* robot)
00036 {
00037 if (robot)
00038 {
00039 addStateMonitor(robot->getId(), robot->getStateMonitor());
00040 }
00041 }
00042 }