1 #include <gtest/gtest.h> 4 #include <std_msgs/Empty.h> 21 image_stamp_ = msg->header.stamp;
33 dynamic_cast<TriggeredCameraTest*>(
this));
36 for (
unsigned int i = 0; i < 30; ++i)
50 int trigger_listeners = 0;
51 for (
int i = 0; i < payload[1].
size(); ++i)
55 std::string topic = payload[1][i][0];
56 if (topic.find(
"image_trigger") != std::string::npos)
61 EXPECT_EQ(trigger_listeners, 1);
76 for (
unsigned int i = 0; i < 30; ++i)
96 EXPECT_EQ(images_received_, 3);
99 for (
unsigned int i = 0; i < 30; ++i)
104 EXPECT_EQ(images_received_, 3);
109 int main(
int argc,
char** argv)
111 ros::init(argc, argv,
"gazebo_camera_test");
112 testing::InitGoogleTest(&argc, argv);
113 return RUN_ALL_TESTS();
Subscriber subscribe(const std::string &base_topic, uint32_t queue_size, const boost::function< void(const sensor_msgs::ImageConstPtr &)> &callback, const ros::VoidPtr &tracked_object=ros::VoidPtr(), const TransportHints &transport_hints=TransportHints())
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)
ROSCPP_DECL const std::string & getName()
int main(int argc, char **argv)
image_transport::Subscriber cam_sub_
TEST_F(TriggeredCameraTest, cameraSubscribeTest)
ROSCPP_DECL bool execute(const std::string &method, const XmlRpc::XmlRpcValue &request, XmlRpc::XmlRpcValue &response, XmlRpc::XmlRpcValue &payload, bool wait_for_master)
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
void imageCallback(const sensor_msgs::ImageConstPtr &msg)
ROSCPP_DECL void spinOnce()