35 #include <sensor_msgs/PointCloud2.h> 38 #include <gtest/gtest.h> 45 -
TOLERANCE <= y && y <= 0.1 + TOLERANCE &&
46 -TOLERANCE <= z && z <= 0.001 +
TOLERANCE;
51 -
TOLERANCE <= y && y <= 0.1 + TOLERANCE &&
54 bool isOnCorner(
const float x,
const float y,
const float z)
57 -
TOLERANCE <= y && y <= 0.1 + TOLERANCE &&
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();
constexpr float TOLERANCE
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
bool isOnCorner(const float x, const float y, const float z)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
bool isOnBottomSurface(const float x, const float y, const float z)
int main(int argc, char **argv)
TEST(ObjToPointCloud, PointCloud)
bool isOnSideSurface(const float x, const float y, const float z)
PointCloud2ConstIterator< T > end() const
ROSCPP_DECL void spinOnce()