|
From: <jl...@us...> - 2008-08-13 02:00:30
|
Revision: 2989
http://personalrobots.svn.sourceforge.net/personalrobots/?rev=2989&view=rev
Author: jleibs
Date: 2008-08-13 02:00:36 +0000 (Wed, 13 Aug 2008)
Log Message:
-----------
Changed hokuyo self test over to use new DiagnosticStatus version in robot_srvs.
Modified Paths:
--------------
pkg/trunk/drivers/laser/hokuyourg_player/hokuyourg_player.cc
pkg/trunk/drivers/laser/hokuyourg_player/manifest.xml
pkg/trunk/hardware_test/sensors/hokuyo_tester/CMakeLists.txt
pkg/trunk/hardware_test/sensors/hokuyo_tester/manifest.xml
pkg/trunk/hardware_test/sensors/hokuyo_tester/src/hokuyo_tester/hokuyo_tester.cpp
pkg/trunk/hardware_test/sensors/hokuyo_tester/src/hokuyo_tester/hokuyo_tester.h
pkg/trunk/hardware_test/sensors/hokuyo_tester/src/standalone/standalone.cpp
pkg/trunk/robot_msgs/msg/DiagnosticStatus.msg
Modified: pkg/trunk/drivers/laser/hokuyourg_player/hokuyourg_player.cc
===================================================================
--- pkg/trunk/drivers/laser/hokuyourg_player/hokuyourg_player.cc 2008-08-13 01:49:54 UTC (rev 2988)
+++ pkg/trunk/drivers/laser/hokuyourg_player/hokuyourg_player.cc 2008-08-13 02:00:36 UTC (rev 2989)
@@ -75,15 +75,22 @@
<hr>
+@section services
+
+
+
@section parameters ROS parameters
Reads the following parameters from the parameter server
-- @b "~min_ang" : @b [double] the angle of the first range measurement in degrees (Default: -90.0)
-- @b "~max_ang" : @b [double] the angle of the last range measurement in degrees (Default: 90.0)
-- @b "~cluster" : @b [int] the number of adjascent range measurements to cluster into a single reading (Default: 1)
-- @b "~skip" : @b [int] the number of scans to skip between each measured scan (Default: 1)
-- @b "~port" : @b [string] the port where the hokuyo device can be found (Default: "/dev/ttyACM0")
+- @b "~min_ang" : @b [double] the angle of the first range measurement in degrees (Default: -90.0)
+- @b "~max_ang" : @b [double] the angle of the last range measurement in degrees (Default: 90.0)
+- @b "~cluster" : @b [int] the number of adjascent range measurements to cluster into a single reading (Default: 1)
+- @b "~skip" : @b [int] the number of scans to skip between each measured scan (Default: 1)
+- @b "~port" : @b [string] the port where the hokuyo device can be found (Default: "/dev/ttyACM0")
+- @b "~autostart : @b [bool] whether the node should automatically start the hokuyo (Default: true)
+- @b "~calibrate_time : @b [bool] whether the node should calibrate the hokuyo's time offset (Default: true)
+- @b "~frame_id : @b [string] the frame in which laser scans will be returned (Default: "FRAMEID_LASER")
**/
@@ -92,20 +99,19 @@
#include <iostream>
#include <sstream>
#include <iomanip>
+#include <pthread.h>
-//#include <libstandalone_drivers/urg_laser.h>
-#include "urg_laser.h"
+#include "ros/node.h"
+#include "rosthread/mutex.h"
+#include "ros/time.h"
-#include <ros/node.h>
-#include <std_msgs/LaserScan.h>
-#include <std_srvs/SelfTest.h>
-#include "ros/time.h"
+#include "std_msgs/LaserScan.h"
+#include "robot_srvs/SelfTest.h"
+
#include "namelookup/nameLookupClient.hh"
-#include "rosthread/mutex.h"
+#include "urg_laser.h"
-#include <pthread.h>
-
using namespace std;
class HokuyoNode: public ros::node
@@ -138,6 +144,8 @@
string frameid;
+ string id;
+
HokuyoNode() : ros::node("urglaser"), running(false), count(0), lookup_client(*this)
{
advertise<std_msgs::LaserScan>("scan");
@@ -175,7 +183,8 @@
{
urg.open(port.c_str());
- printf("Connected to URG with ID: %s\n", urg.get_ID().c_str());
+ string id = urg.get_ID();
+ printf("Connected to URG with ID: %s\n", id.c_str());
urg.laser_on();
@@ -299,214 +308,289 @@
stop();
return true;
- };
+ }
- bool SelfTest(std_srvs::SelfTest::request &req,
- std_srvs::SelfTest::response &res)
+
+ bool SelfTest(robot_srvs::SelfTest::request &req,
+ robot_srvs::SelfTest::response &res)
{
testing_mutex.lock();
printf("Entering self test. Other operation suspended\n");
- std::ostringstream oss;
-
- if (num_subscribers("scan") != 0)
- oss << "(WARNING: There were active subscribers. Running of self test interrupted operations.)" << std::endl;
-
- int passed = 0;
- int total = 0;
-
// Stop for good measure.
try
{
urg.close();
} catch (URG::exception& e) {
- oss << "(WARNING: Exception thrown while trying to close: " << e.what() << ")" << std::endl;
}
- // Actually conduct tests
+ std::vector<robot_msgs::DiagnosticStatus> status_vec;
+ std::vector<void (HokuyoNode::*)(robot_msgs::DiagnosticStatus&)> test_fncs;
- //Test: Connect
- total++;
- oss << "Test " << total << ": Opening connection" << std::endl;
- try {
- urg.open(port.c_str());
- passed++;
- oss << " [PASSED]";
- } catch (URG::exception& e) {
- oss << " [FAILED]" << std::endl << " " << e.what();
- }
- oss << std::endl;
+ test_fncs.push_back( &HokuyoNode::InterruptionTest );
+ test_fncs.push_back( &HokuyoNode::ConnectTest );
+ test_fncs.push_back( &HokuyoNode::IDTest );
+ test_fncs.push_back( &HokuyoNode::StatusTest );
+ test_fncs.push_back( &HokuyoNode::LaserTest );
+ test_fncs.push_back( &HokuyoNode::PolledDataTest );
+ test_fncs.push_back( &HokuyoNode::StreamedDataTest );
+ test_fncs.push_back( &HokuyoNode::StreamedIntensityDataTest );
+ test_fncs.push_back( &HokuyoNode::LaserOffTest );
+ test_fncs.push_back( &HokuyoNode::DisconnectTest );
+ test_fncs.push_back( &HokuyoNode::ResumeTest );
- //Test: Get ID
- total++;
- oss << "Test " << total << ": Getting ID" << std::endl;
- try {
- res.id = urg.get_ID();
- passed++;
- oss << " [PASSED]" << std::endl << " ID is: " << res.id;
+ for (std::vector<void (HokuyoNode::*)(robot_msgs::DiagnosticStatus&)>::iterator test_fncs_iter = test_fncs.begin();
+ test_fncs_iter != test_fncs.end();
+ test_fncs_iter++)
+ {
+ robot_msgs::DiagnosticStatus status;
- if (res.id == std::string("H0000000"))
+ status.name = "None";
+ status.level = 2;
+ status.message = "No message was set";
+
+ try {
+
+ (*this.*(*test_fncs_iter))(status);
+
+ } catch (URG::exception& e)
{
- oss << std::endl << " (WARNING: ID 0 is indication of failure.)";
+ status.level = 2;
+ status.message = std::string("Caught exception: ") + e.what();
}
- } catch (URG::exception& e) {
- oss << " [FAILED]" << std::endl << " " << e.what();
+
+ status_vec.push_back(status);
}
- oss << std::endl;
- //Test: Get status
- total++;
- oss << "Test " << total << ": Getting Status" << std::endl;
- try {
- std::string stat = urg.get_status();
- if (stat != std::string("Sensor works well."))
+ res.id = id;
+
+ res.passed = true;
+ for (std::vector<robot_msgs::DiagnosticStatus>::iterator status_iter = status_vec.begin();
+ status_iter != status_vec.end();
+ status_iter++)
+ {
+ if (status_iter->level >= 2)
{
- oss << " [FAILED]" << std::endl << " Status: " << stat;
- } else {
- passed++;
- oss << " [PASSED]";
+ res.passed = false;
}
- } catch (URG::exception& e) {
- oss << " [FAILED]" << std::endl << " " << e.what();
}
- oss << std::endl;
- //Test: Laser on
- total++;
- oss << "Test " << total << ": Turning on laser" << std::endl;
- try {
- urg.laser_on();
- passed++;
- oss << " [PASSED]";
- } catch (URG::exception& e) {
- oss << " [FAILED]" << std::endl << " " << e.what();
+ res.set_status_vec(status_vec);
+
+ printf("Self test completed\n");
+
+ testing_mutex.unlock();
+ return true;
+ }
+
+ void InterruptionTest(robot_msgs::DiagnosticStatus& status)
+ {
+ status.name = "Interruption Test";
+
+ if (num_subscribers("scan") == 0)
+ {
+ status.level = 0;
+ status.message = "No operation interrupted.";
}
- oss << std::endl;
+ else
+ {
+ status.level = 1;
+ status.message = "There were active subscribers. Running of self test interrupted operations.";
+ }
+ }
-
+ void ConnectTest(robot_msgs::DiagnosticStatus& status)
+ {
+ status.name = "Connection Test";
+
+ urg.open(port.c_str());
+
+ status.level = 0;
+ status.message = "Connected successfully.";
+ }
+
+ void IDTest(robot_msgs::DiagnosticStatus& status)
+ {
+ status.name = "ID Test";
+
+ id = urg.get_ID();
+
+ if (id == std::string("H0000000"))
+ {
+ status.level = 1;
+ status.message = id + std::string(" is indication of failure.");
+ }
+ else
+ {
+ status.level = 0;
+ status.message = id;
+ }
+ }
+
+ void StatusTest(robot_msgs::DiagnosticStatus& status)
+ {
+ status.name = "ID Test";
+
+ std::string stat = urg.get_status();
+
+ if (stat != std::string("Sensor works well."))
+ {
+ status.level = 2;
+ } else {
+ status.level = 0;
+ }
+
+ status.message = stat;
+ }
+
+ void LaserTest(robot_msgs::DiagnosticStatus& status)
+ {
+ status.name = "Laser Test";
+
+ urg.laser_on();
+
+ status.level = 0;
+ status.message = "Laser turned on successfully.";
+ }
+
+ void PolledDataTest(robot_msgs::DiagnosticStatus& status)
+ {
+ status.name = "Polled Data Test";
+
URG::laser_scan_t scan;
- //Test: Polled Data
- total++;
- oss << "Test " << total << ": Polled data" << std::endl;
- try {
- int res = urg.poll_scan(&scan, min_ang, max_ang, cluster, 1000);
- if (res != 0)
+ int res = urg.poll_scan(&scan, min_ang, max_ang, cluster, 1000);
+
+ if (res != 0)
+ {
+ status.level = 2;
+ ostringstream oss;
+ oss << "Hokuyo error code: " << res << ". Consult manual for meaning.";
+ status.message = oss.str();
+
+ } else {
+ status.level = 0;
+ status.message = "Polled Hokuyo for data successfully.";
+ }
+ }
+
+ void StreamedDataTest(robot_msgs::DiagnosticStatus& status)
+ {
+ status.name = "Streamed Data Test";
+
+ URG::laser_scan_t scan;
+
+ int res = urg.request_scans(false, min_ang, max_ang, cluster, skip, 99, 1000);
+
+ if (res != 0)
+ {
+ status.level = 2;
+ ostringstream oss;
+ oss << "Hokuyo error code: " << res << ". Consult manual for meaning.";
+ status.message = oss.str();
+
+ } else {
+
+ for (int i = 0; i < 99; i++)
{
- oss << " [FAILED]" << std::endl << " Hokuyo error code: " << res << ". Consult manual for meaning.";
- } else {
- passed++;
- oss << " [PASSED]";
+ urg.service_scan(&scan, 1000);
}
- } catch (URG::exception& e) {
- oss << " [FAILED]" << std::endl << " " << e.what();
+
+ status.level = 0;
+ status.message = "Streamed data from Hokuyo successfully.";
+
}
- oss << std::endl;
+ }
- //Test: Streamed data with no intensity
- total++;
- oss << "Test " << total << ": Streamed data" << std::endl;
- try {
- int res = urg.request_scans(false, min_ang, max_ang, cluster, skip, 99, 1000);
- if (res != 0)
+ void StreamedIntensityDataTest(robot_msgs::DiagnosticStatus& status)
+ {
+ status.name = "Streamed Intensity Data Test";
+
+ URG::laser_scan_t scan;
+
+ int res = urg.request_scans(false, min_ang, max_ang, cluster, skip, 99, 1000);
+
+ if (res != 0)
+ {
+ status.level = 2;
+ ostringstream oss;
+ oss << "Hokuyo error code: " << res << ". Consult manual for meaning.";
+ status.message = oss.str();
+
+ } else {
+
+ int corrupted_data = 0;
+
+ for (int i = 0; i < 99; i++)
{
- oss << " [FAILED]" << std::endl << " Hokuyo error code: " << res << ". Consult manual for meaning.";
- } else {
-
- for (int i = 0; i < 99; i++)
- {
+ try {
urg.service_scan(&scan, 1000);
+ } catch (URG::corrupted_data_exception &e) {
+ corrupted_data++;
}
- passed++;
- oss << " [PASSED]]";
}
- } catch (URG::exception& e) {
- oss << " [FAILED]" << std::endl << " " << e.what();
- }
- oss << std::endl;
-
- //Test: Streamed data with intensity
- total++;
- oss << "Test " << total << ": Streamed intensity data" << std::endl;
- try {
- int res = urg.request_scans(true, min_ang, max_ang, cluster, skip, 99, 1000);
- if (res != 0)
+ if (corrupted_data == 1)
{
- oss << " [FAILED]" << std::endl << " Hokuyo error code: " << res << ". Consult manual for meaning.";
- } else {
- int passable = 1;
- for (int i = 0; i < 99; i++)
- {
- try {
- urg.service_scan(&scan, 1000);
- } catch (URG::corrupted_data_exception &e) {
- passable = 0;
- }
- }
- if (passable)
- {
- passed++;
- oss << " [PASSED]";
- }
+ status.level = 1;
+ status.message = "Single corrupted message. This is acceptable and unavoidable";
+ } else if (corrupted_data > 1)
+ {
+ status.level = 2;
+ ostringstream oss;
+ oss << corrupted_data << " corrupted messages.";
+ status.message = oss.str();
+ } else
+ {
+ status.level = 0;
+ status.message = "Stramed data with intensity from Hokuyo successfully.";
}
- } catch (URG::exception& e) {
- oss << " [FAILED]" << std::endl << " " << e.what();
}
- oss << std::endl;
+ }
- //Test: Laser off
- total++;
- oss << "Test " << total << ":Turning off laser" << std::endl;
- try {
- urg.laser_off();
- passed++;
- oss << " [PASSED]";
- } catch (URG::exception& e) {
- oss << " [FAILED]" << std::endl << " " << e.what();
- }
- oss << std::endl;
+ void LaserOffTest(robot_msgs::DiagnosticStatus& status)
+ {
+ status.name = "Laser Off Test";
- //Test: Disconnect
- total++;
- oss << "Test " << total << ": Disconnecting" << std::endl;
- try {
- urg.close();
- passed++;
- oss << " [PASSED]";
- } catch (URG::exception& e) {
- oss << " [FAILED]" << std::endl << " " << e.what();
- }
- oss << std::endl;
+ urg.laser_off();
- if (total == passed)
- res.passed = true;
- else
- res.passed = false;
+ status.level = 0;
+ status.message = "Laser turned off successfully.";
+ }
- oss << passed << "/" << total << " tests passed";
+ void DisconnectTest(robot_msgs::DiagnosticStatus& status)
+ {
+ status.name = "Disconnect Test";
- printf("Self test completed\n");
+ urg.close();
+ status.level = 0;
+ status.message = "Disconnected successfully.";
+ }
+
+ void ResumeTest(robot_msgs::DiagnosticStatus& status)
+ {
+ status.name = "Resume Test";
+
if (running)
{
- printf("Trying to restart urg\n");
- try {
- urg.open(port.c_str());
- urg.laser_on();
- int status = urg.request_scans(true, min_ang, max_ang, cluster, skip);
- if (status != 0)
- oss << "WARNING: Requesting scans from URG Failed when trying to resume operation" << std::endl;
- } catch (URG::exception &e) {
- oss << "WARNING: Exception caught when resuming operation! Driver is most likely in a bad state." << std::endl;
+ urg.open(port.c_str());
+ urg.laser_on();
+
+ int res = urg.request_scans(true, min_ang, max_ang, cluster, skip);
+
+ if (res != 0)
+ {
+ status.level = 2;
+ status.message = "Failed to resume previous mode of operation.";
+ return;
}
- }
+ }
- res.info = oss.str();
+ status.level = 0;
+ status.message = "Previous operation resumed successfully.";
+ }
- testing_mutex.unlock();
- return true;
- }
};
int
Modified: pkg/trunk/drivers/laser/hokuyourg_player/manifest.xml
===================================================================
--- pkg/trunk/drivers/laser/hokuyourg_player/manifest.xml 2008-08-13 01:49:54 UTC (rev 2988)
+++ pkg/trunk/drivers/laser/hokuyourg_player/manifest.xml 2008-08-13 02:00:36 UTC (rev 2989)
@@ -4,7 +4,7 @@
<license>BSD</license>
<depend package="roscpp" />
<depend package="std_msgs" />
- <depend package="std_srvs" />
+ <depend package="robot_srvs" />
<depend package="urg_driver" />
<depend package="namelookup" />
<depend package="rosthread" />
Modified: pkg/trunk/hardware_test/sensors/hokuyo_tester/CMakeLists.txt
===================================================================
--- pkg/trunk/hardware_test/sensors/hokuyo_tester/CMakeLists.txt 2008-08-13 01:49:54 UTC (rev 2988)
+++ pkg/trunk/hardware_test/sensors/hokuyo_tester/CMakeLists.txt 2008-08-13 02:00:36 UTC (rev 2989)
@@ -16,8 +16,8 @@
rospack_add_library(hokuyotester src/hokuyo_tester/hokuyo_tester.cpp
src/hokuyo_tester/gen_hokuyo_tester.cpp)
-rospack_add_executable(gui src/gui/gui.cpp)
rospack_add_executable(test_hokuyo src/standalone/standalone.cpp)
+rospack_add_executable(gui src/gui/gui.cpp)
target_link_libraries(gui hokuyotester ${wxWidgets_LIBRARIES})
Modified: pkg/trunk/hardware_test/sensors/hokuyo_tester/manifest.xml
===================================================================
--- pkg/trunk/hardware_test/sensors/hokuyo_tester/manifest.xml 2008-08-13 01:49:54 UTC (rev 2988)
+++ pkg/trunk/hardware_test/sensors/hokuyo_tester/manifest.xml 2008-08-13 02:00:36 UTC (rev 2989)
@@ -1,12 +1,11 @@
<package>
-<description brief="Tool for connecting to a Hokuyo">
+<description brief="Tool for running the Hokuyo self test.">
</description>
<author>Jeremy Leibs</author>
<license>BSD</license>
<url>http://pr.willowgarage.com</url>
<depend package="roscpp"/>
-<depend package="urg_driver"/>
<depend package="std_msgs"/>
-<depend package="std_srvs"/>
+<depend package="robot_srvs"/>
</package>
Modified: pkg/trunk/hardware_test/sensors/hokuyo_tester/src/hokuyo_tester/hokuyo_tester.cpp
===================================================================
--- pkg/trunk/hardware_test/sensors/hokuyo_tester/src/hokuyo_tester/hokuyo_tester.cpp 2008-08-13 01:49:54 UTC (rev 2988)
+++ pkg/trunk/hardware_test/sensors/hokuyo_tester/src/hokuyo_tester/hokuyo_tester.cpp 2008-08-13 02:00:36 UTC (rev 2989)
@@ -32,17 +32,17 @@
* POSSIBILITY OF SUCH DAMAGE.
*********************************************************************/
-#include "hokuyo_tester.h"
-#include "urg_laser.h"
-#include <wx/dcclient.h>
#include <math.h>
+#include <time.h>
+#include <fstream>
+#include <iomanip>
+
#include <wx/app.h>
-
+#include <wx/dcclient.h>
#include <wx/msgdlg.h>
#include <wx/textdlg.h>
-#include <time.h>
-#include <fstream>
+#include "hokuyo_tester.h"
DECLARE_EVENT_TYPE(wxSELF_TEST_DONE,-1)
DEFINE_EVENT_TYPE(wxSELF_TEST_DONE)
@@ -101,15 +101,50 @@
void* TestThread::Entry()
{
+ wxMutexGuiEnter();
wxLogMessage(_T("Conducting self test...\n"));
+ wxMutexGuiLeave();
if (ros::service::call("urglaser/self_test", parent->req, parent->res))
{
- wxLogMessage(_T("Self test completed\n") + wxString::FromAscii(parent->res.info.c_str()));
+ wxLogMessage(_T("Self test completed"));
+
+ wxString info = _T("");
+
+ if (parent->res.passed)
+ info += _T("Test passed\n");
+ else
+ info += _T("Test failed\n");
+
+ for (size_t i = 0; i < parent->res.get_status_size(); i++)
+ {
+ wxString level;
+ if (parent->res.status[i].level == 0)
+ level = _T("[OK]");
+ else if (parent->res.status[i].level == 1)
+ level = _T("[WARNING]");
+ else
+ level = _T("[ERROR]");
+
+ wxString number;
+ number << i + 1;
+
+ info += number
+ + _T(") ")
+ + wxString::FromAscii(parent->res.status[i].name.c_str()) + _T("\n")
+ + _T(" ") + level + _T(" ")
+ + wxString::FromAscii(parent->res.status[i].message.c_str()) + _T("\n");
+ }
+
+ wxMutexGuiEnter();
+ wxLogMessage(info);
+ wxMutexGuiLeave();
}
else
{
+ wxMutexGuiEnter();
wxLogMessage(_T("Could not find hokuyo selftest service. Ros node must not be running."));
+ wxMutexGuiLeave();
parent->testButton->Enable();
return NULL;
}
@@ -174,19 +209,37 @@
if (res.passed)
{
out << "Self test: PASSED" << std::endl;
- out << "Info:" << std::endl << res.info;
- out << std::endl << std::endl;
+ }
+ else
+ {
+ out << "Self test: FAILED" << std::endl;
+ }
+
+ out << "Info:" << std::endl;
+ for (size_t i = 0; i < res.get_status_size(); i++)
+ {
+ out << std::setw(2) << i + 1 << ") " << res.status[i].name << std::endl;
+
+ if (res.status[i].level == 0)
+ out << " [OK]: ";
+ else if (res.status[i].level == 1)
+ out << " [WARNING]: ";
+ else
+ out << " [ERROR]: ";
+
+ out << res.status[i].message << std::endl << std::endl;
+ }
+
+ out << std::endl << std::endl;
+
+ if (res.passed)
+ {
if (answer == wxYES)
out << "Data inspection: PASSED" << std::endl;
else
out << "Data inspection: FAILED" << std::endl;
}
- else
- {
- out << "Self test: FAILED" << std::endl;
- out << "Info:" << std::endl << res.info;
- }
testButton->Enable();
}
Modified: pkg/trunk/hardware_test/sensors/hokuyo_tester/src/hokuyo_tester/hokuyo_tester.h
===================================================================
--- pkg/trunk/hardware_test/sensors/hokuyo_tester/src/hokuyo_tester/hokuyo_tester.h 2008-08-13 01:49:54 UTC (rev 2988)
+++ pkg/trunk/hardware_test/sensors/hokuyo_tester/src/hokuyo_tester/hokuyo_tester.h 2008-08-13 02:00:36 UTC (rev 2989)
@@ -35,15 +35,16 @@
#ifndef HOKUYO_TESTER_H
#define HOKUYO_TESTER_H
-#include "gen_hokuyo_tester.h"
#include <wx/log.h>
#include <wx/thread.h>
#include <wx/glcanvas.h>
#include "ros/node.h"
#include "std_msgs/LaserScan.h"
-#include "std_srvs/SelfTest.h"
+#include "robot_srvs/SelfTest.h"
+#include "gen_hokuyo_tester.h"
+
class HokuyoTester;
class TestThread: public wxThread
@@ -78,8 +79,8 @@
int last_x;
int last_y;
- std_srvs::SelfTest::request req;
- std_srvs::SelfTest::response res;
+ robot_srvs::SelfTest::request req;
+ robot_srvs::SelfTest::response res;
protected:
Modified: pkg/trunk/hardware_test/sensors/hokuyo_tester/src/standalone/standalone.cpp
===================================================================
--- pkg/trunk/hardware_test/sensors/hokuyo_tester/src/standalone/standalone.cpp 2008-08-13 01:49:54 UTC (rev 2988)
+++ pkg/trunk/hardware_test/sensors/hokuyo_tester/src/standalone/standalone.cpp 2008-08-13 02:00:36 UTC (rev 2989)
@@ -33,7 +33,7 @@
*********************************************************************/
#include "ros/node.h"
-#include "std_srvs/SelfTest.h"
+#include "robot_srvs/SelfTest.h"
#include <string>
@@ -46,8 +46,8 @@
bool doTest(std::string name)
{
- std_srvs::SelfTest::request req;
- std_srvs::SelfTest::response res;
+ robot_srvs::SelfTest::request req;
+ robot_srvs::SelfTest::response res;
if (ros::service::call(name + "/self_test", req, res))
{
printf("Self test completed:\n");
@@ -55,8 +55,19 @@
printf("Test passed!\n");
else
printf("Test failed!\n");
- printf("Status code: %d\n", res.status_code);
- printf("Info:\n%s\n", res.info.c_str());
+
+ for (size_t i = 0; i < res.get_status_size(); i++)
+ {
+ printf("%2d) %s\n", i + 1, res.status[i].name.c_str());
+ if (res.status[i].level == 0)
+ printf(" [OK]: ");
+ else if (res.status[i].level == 1)
+ printf(" [WARNING]: ");
+ else
+ printf(" [ERROR]: ");
+
+ printf("%s\n\n", res.status[i].message.c_str());
+ }
return true;
}
else
Modified: pkg/trunk/robot_msgs/msg/DiagnosticStatus.msg
===================================================================
--- pkg/trunk/robot_msgs/msg/DiagnosticStatus.msg 2008-08-13 01:49:54 UTC (rev 2988)
+++ pkg/trunk/robot_msgs/msg/DiagnosticStatus.msg 2008-08-13 02:00:36 UTC (rev 2989)
@@ -1,4 +1,4 @@
-byte level #(OK, WARN, ERROR)
+byte level #(OK=0, WARN=1, ERROR=2)
string name # a description of the test/component reporting
-string status_message # a description of the status
+string message # a description of the status
DiagnosticValue[] values # an array of values associated with the status
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|