|
From: <tf...@us...> - 2009-08-08 04:39:30
|
Revision: 21132
http://personalrobots.svn.sourceforge.net/personalrobots/?rev=21132&view=rev
Author: tfoote
Date: 2009-08-08 04:39:22 +0000 (Sat, 08 Aug 2009)
Log Message:
-----------
fixing through diagnostic_updater
Modified Paths:
--------------
pkg/trunk/stacks/common_msgs/diagnostic_msgs/msg/KeyValue.msg
pkg/trunk/stacks/hardware_test/diagnostic_updater/include/diagnostic_updater/DiagnosticStatusWrapper.h
pkg/trunk/stacks/hardware_test/diagnostic_updater/include/diagnostic_updater/update_functions.h
pkg/trunk/stacks/hardware_test/diagnostic_updater/test/diagnostic_updater_test.cpp
pkg/trunk/stacks/mechanism/mechanism_control/src/mechanism_control.cpp
Modified: pkg/trunk/stacks/common_msgs/diagnostic_msgs/msg/KeyValue.msg
===================================================================
--- pkg/trunk/stacks/common_msgs/diagnostic_msgs/msg/KeyValue.msg 2009-08-08 04:19:29 UTC (rev 21131)
+++ pkg/trunk/stacks/common_msgs/diagnostic_msgs/msg/KeyValue.msg 2009-08-08 04:39:22 UTC (rev 21132)
@@ -1,2 +1,2 @@
-float32 value # a value to track over time
+string value # a value to track over time
string label # what to label this value when viewing
Modified: pkg/trunk/stacks/hardware_test/diagnostic_updater/include/diagnostic_updater/DiagnosticStatusWrapper.h
===================================================================
--- pkg/trunk/stacks/hardware_test/diagnostic_updater/include/diagnostic_updater/DiagnosticStatusWrapper.h 2009-08-08 04:19:29 UTC (rev 21131)
+++ pkg/trunk/stacks/hardware_test/diagnostic_updater/include/diagnostic_updater/DiagnosticStatusWrapper.h 2009-08-08 04:39:22 UTC (rev 21132)
@@ -114,22 +114,22 @@
void addsf(const std::string &key, const char *format, ...); // In practice format will always be a char *
- void addv(const std::string &key, double v)
+ /* void addv(const std::string &key, double v)
{
diagnostic_msgs::KeyValue dv;
dv.label = key;
dv.value = v;
values.push_back(dv);
- }
+ }*/
};
template<>
void DiagnosticStatusWrapper::adds<std::string>(const std::string &key, const std::string &s)
{
- diagnostic_msgs::DiagnosticString ds;
+ diagnostic_msgs::KeyValue ds;
ds.label = key;
ds.value = s;
- strings.push_back(ds);
+ values.push_back(ds);
}
// Need to place addsf after DiagnosticStatusWrapper::adds<std::string> or
Modified: pkg/trunk/stacks/hardware_test/diagnostic_updater/include/diagnostic_updater/update_functions.h
===================================================================
--- pkg/trunk/stacks/hardware_test/diagnostic_updater/include/diagnostic_updater/update_functions.h 2009-08-08 04:19:29 UTC (rev 21131)
+++ pkg/trunk/stacks/hardware_test/diagnostic_updater/include/diagnostic_updater/update_functions.h 2009-08-08 04:39:22 UTC (rev 21132)
@@ -126,17 +126,17 @@
summary.summary(0, "Desired frequency met");
}
- details.addv("Events in window", events);
- details.addv("Events since startup", count_);
- details.addv("Duration of window (s)", window);
- details.addv("Actual frequency (Hz)", freq);
+ details.addsf("Events in window", "%f", events);
+ details.addsf("Events since startup", "%f", count_);
+ details.addsf("Duration of window (s)", "%f", window);
+ details.addsf("Actual frequency (Hz)", "%f",freq);
if (*params_.min_freq_ == *params_.max_freq_)
- details.addv("Target frequency (Hz)", *params_.min_freq_);
+ details.addsf("Target frequency (Hz)", "%f",*params_.min_freq_);
if (*params_.min_freq_ > 0)
- details.addv("Minimum acceptable frequency (Hz)",
+ details.addsf("Minimum acceptable frequency (Hz)", "%f",
*params_.min_freq_ * (1 - params_.tolerance_));
if (finite(*params_.max_freq_))
- details.addv("Maximum acceptable frequency (Hz)",
+ details.addsf("Maximum acceptable frequency (Hz)", "%f",
*params_.max_freq_ * (1 + params_.tolerance_));
}
};
@@ -240,10 +240,10 @@
}
}
- details.addv("Earliest timestamp delay:", min_delta_);
- details.addv("Latest timestamp delay:", max_delta_);
- details.addv("Earliest acceptable timestamp delay:", params_.min_acceptable_);
- details.addv("Latest acceptable timestamp delay:", params_.max_acceptable_);
+ details.addsf("Earliest timestamp delay:", "%f", min_delta_);
+ details.addsf("Latest timestamp delay:", "%f", max_delta_);
+ details.addsf("Earliest acceptable timestamp delay:", "%f", params_.min_acceptable_);
+ details.addsf("Latest acceptable timestamp delay:", "%f", params_.max_acceptable_);
details.adds("Late diagnostic update count:", late_count_);
details.adds("Early diagnostic update count:", early_count_);
details.adds("Zero seen diagnostic update count:", zero_count_);
Modified: pkg/trunk/stacks/hardware_test/diagnostic_updater/test/diagnostic_updater_test.cpp
===================================================================
--- pkg/trunk/stacks/hardware_test/diagnostic_updater/test/diagnostic_updater_test.cpp 2009-08-08 04:19:29 UTC (rev 21131)
+++ pkg/trunk/stacks/hardware_test/diagnostic_updater/test/diagnostic_updater_test.cpp 2009-08-08 04:39:22 UTC (rev 21132)
@@ -62,7 +62,7 @@
void run(DiagnosticStatusWrapper &s)
{
s.summary(0, "Test is running");
- s.addv("Value", 5);
+ s.addsf("Value", "%f", 5);
s.adds("String", "Toto");
s.adds("Floating", 5.55);
s.adds("Integer", 5);
@@ -96,16 +96,16 @@
EXPECT_STREQ(message, stat.message.c_str()) << "DiagnosticStatusWrapper::summary failed to set message";
EXPECT_EQ(level, stat.level) << "DiagnosticStatusWrapper::summary failed to set level";
- stat.addv("toto", 5);
+ stat.addsf("toto", "%.1f", 5.0);
stat.adds("baba", 5);
stat.addsf("foo", "%05i", 27);
- EXPECT_EQ(5.0, stat.values[0].value) << "Bad value, adding a value with addv";
- EXPECT_STREQ("5", stat.strings[0].value.c_str()) << "Bad value, adding a string with adds";
- EXPECT_STREQ("00027", stat.strings[1].value.c_str()) << "Bad value, adding a string with addsf";
+ EXPECT_STREQ("5.0", stat.values[0].value.c_str()) << "Bad value, adding a value with addsf";
+ EXPECT_STREQ("5", stat.values[1].value.c_str()) << "Bad value, adding a string with adds";
+ EXPECT_STREQ("00027", stat.values[2].value.c_str()) << "Bad value, adding a string with addsf";
EXPECT_STREQ("toto", stat.values[0].label.c_str()) << "Bad label, adding a value with addv";
- EXPECT_STREQ("baba", stat.strings[0].label.c_str()) << "Bad label, adding a string with adds";
- EXPECT_STREQ("foo", stat.strings[1].label.c_str()) << "Bad label, adding a string with addsf";
+ EXPECT_STREQ("baba", stat.values[1].label.c_str()) << "Bad label, adding a string with adds";
+ EXPECT_STREQ("foo", stat.values[2].label.c_str()) << "Bad label, adding a string with addsf";
}
TEST(DiagnosticUpdater, testFrequencyStatus)
Modified: pkg/trunk/stacks/mechanism/mechanism_control/src/mechanism_control.cpp
===================================================================
--- pkg/trunk/stacks/mechanism/mechanism_control/src/mechanism_control.cpp 2009-08-08 04:19:29 UTC (rev 21131)
+++ pkg/trunk/stacks/mechanism/mechanism_control/src/mechanism_control.cpp 2009-08-08 04:39:22 UTC (rev 21132)
@@ -110,12 +110,12 @@
#define ADD_STRING_FMT(lab, fmt, ...) \
- s.label = (lab); \
+ v.label = (lab); \
{ char buf[1024]; \
snprintf(buf, sizeof(buf), fmt, ##__VA_ARGS__); \
- s.value = buf; \
+ v.value = buf; \
} \
- strings.push_back(s)
+ values.push_back(v)
// Must be realtime safe.
@@ -452,10 +452,8 @@
std::vector<diagnostic_msgs::DiagnosticStatus> statuses;
std::vector<diagnostic_msgs::KeyValue> values;
- std::vector<diagnostic_msgs::DiagnosticString> strings;
diagnostic_msgs::DiagnosticStatus status;
diagnostic_msgs::KeyValue v;
- diagnostic_msgs::DiagnosticString s;
status.name = "Mechanism Control";
status.level = 0;
@@ -505,7 +503,6 @@
ADD_STRING_FMT("Active controllers", "%d", active);
status.set_values_vec(values);
- status.set_strings_vec(strings);
statuses.push_back(status);
pub_diagnostics_.msg_.set_status_vec(statuses);
pub_diagnostics_.unlockAndPublish();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|