42 #include "geometry_msgs/WrenchStamped.h" 43 #include "diagnostic_msgs/DiagnosticArray.h" 45 #include <std_msgs/Bool.h> 49 #include <boost/program_options.hpp> 51 namespace po = boost::program_options;
55 int main(
int argc,
char **argv)
63 po::options_description desc(
"Options");
65 (
"help",
"display help")
66 (
"rate", po::value<float>(&pub_rate_hz)->default_value(500.0),
"set publish rate (in hertz)")
67 (
"wrench",
"publish older Wrench message type instead of WrenchStamped")
68 (
"address", po::value<string>(&address),
"IP address of NetFT box")
71 po::positional_options_description p;
75 po::store(po::command_line_parser(argc, argv).
options(desc).positional(p).run(), vm);
85 if (!vm.count(
"address"))
88 cerr <<
"Please specify address of NetFT" << endl;
92 bool publish_wrench =
false;
93 if (vm.count(
"wrench"))
95 publish_wrench =
true;
96 ROS_WARN(
"Publishing NetFT data as geometry_msgs::Wrench is deprecated");
100 std_msgs::Bool is_ready;
101 ready_pub = nh.
advertise<std_msgs::Bool>(
"netft_ready", 1);
102 std::shared_ptr<netft_rdt_driver::NetFTRDTDriver> netft;
106 is_ready.data =
true;
109 catch(std::runtime_error)
111 is_ready.data =
false;
118 pub = nh.
advertise<geometry_msgs::Wrench>(
"netft_data", 100);
122 pub = nh.
advertise<geometry_msgs::WrenchStamped>(
"netft_data", 100);
125 geometry_msgs::WrenchStamped
data;
129 diagnostic_msgs::DiagnosticArray diag_array;
130 diag_array.status.reserve(1);
136 if (netft->waitForNewData())
138 netft->getData(data);
151 if ( (current_time - last_diag_pub_time) > diag_pub_duration )
153 diag_array.status.clear();
154 netft->diagnostics(diag_status);
155 diag_array.status.push_back(diag_status);
159 last_diag_pub_time = current_time;
void publish(const boost::shared_ptr< M > &message) const
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
int main(int argc, char **argv)
ROSCPP_DECL void spinOnce()