35 #include <sensor_msgs/PointCloud2.h>
38 #include <gtest/gtest.h>
54 bool isOnCorner(
const float x,
const float y,
const float z)
61 TEST(ObjToPointCloud, PointCloud)
64 sensor_msgs::PointCloud2::ConstPtr cloud;
66 const boost::function<void(
const sensor_msgs::PointCloud2::ConstPtr&)> cb =
67 [&cloud](
const sensor_msgs::PointCloud2::ConstPtr& msg) ->
void
74 for (
int i = 0; i < 30 &&
ros::ok(); ++i)
81 ASSERT_TRUE(
static_cast<bool>(cloud));
83 cloud->width * cloud->height,
84 std::lround((0.5 * 0.1 + 0.1 * 0.2) / (0.05 * 0.05)),
88 iter_x != iter_x.
end();
89 ++iter_x, ++iter_y, ++iter_z)
95 << *iter_x <<
", " << *iter_y <<
", " << *iter_z <<
" is not on the expected surface";
99 int main(
int argc,
char** argv)
101 testing::InitGoogleTest(&argc, argv);
102 ros::init(argc, argv,
"test_obj_to_pointcloud");
104 return RUN_ALL_TESTS();