2 #include "std_msgs/String.h" 6 #include "rosserial/std_msgs/String.h" 9 #include <gtest/gtest.h> 19 rosserial::std_msgs::String string_msg;
20 rosserial::ros::Publisher client_pub(
"chatter", &string_msg);
21 client_nh.advertise(client_pub);
23 char s[] =
"from-rosserial-client";
30 for(
int attempt = 0; attempt < 50; attempt++) {
31 client_pub.publish(&string_msg);
55 rosserial::ros::Subscriber<rosserial::std_msgs::String> client_sub(
"chatter",
rosserial_string_cb);
56 client_nh.subscribe(client_sub);
61 std_msgs::String string_msg;
62 string_msg.data =
"to-rosserial-client";
63 for(
int attempt = 0; attempt < 50; attempt++) {
74 int main(
int argc,
char **argv){
75 ros::init(argc, argv,
"test_publish_subscribe");
77 testing::InitGoogleTest(&argc, argv);
78 return RUN_ALL_TESTS();
int rosserial_string_cb_count
static void rosserial_string_cb(const rosserial::std_msgs::String &msg)
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)
int main(int argc, char **argv)
void callback(const Msg msg)
TEST_F(SingleClientFixture, single_publish)
ROSCPP_DECL void spinOnce()