5 #include <gtest/gtest.h> 30 info_msg.reset(
new sensor_msgs::CameraInfo);
31 info_msg->header.frame_id =
"depth_frame";
32 info_msg->header.seq = 100;
35 info_msg->distortion_model =
"plumb_bob";
36 info_msg->D.resize(5);
49 info_msg->P[10] = 1.0;
54 depth_msg.reset(
new sensor_msgs::Image);
55 depth_msg->header.frame_id =
"depth_frame";
56 depth_msg->header.seq = 100;
57 depth_msg->header.stamp.fromSec(10.0);
60 depth_msg->is_bigendian =
false;
61 depth_msg->step = depth_msg->width *
sizeof(T);
63 if (
typeid(T) ==
typeid(uint16_t)) {
66 else if (
typeid(T) ==
typeid(float)) {
70 depth_msg->data.resize(depth_msg->width * depth_msg->height *
sizeof(T));
71 T* depth_row =
reinterpret_cast<T*
>(&depth_msg->data[0]);
72 for (
size_t i = 0; i < depth_msg->width * depth_msg->height; ++i) {
80 setDefaultDepthMsg<uint16_t>(1);
83 setDefaultDepthMsg<float>(1);
89 setDefaultDepthMsg<uint16_t>(1);
94 int main(
int argc,
char **argv)
96 testing::InitGoogleTest(&argc, argv);
97 return RUN_ALL_TESTS();
sensor_msgs::CameraInfoPtr info_msg
void setDepthImgStepCol(const int step)
setDepthImgStepCol
int main(int argc, char **argv)
void detectCliff(const sensor_msgs::ImageConstPtr &depth_msg, const sensor_msgs::CameraInfoConstPtr &info_msg)
detectCliff detects descending stairs based on the information in a depth image
TEST_F(CliffDetectorTest, encodingSupport)
void setDepthImgStepRow(const int step)
setDepthImgStepRow
void setSensorMountHeight(const float height)
setSensorMountHeight sets the height of sensor mount (in meters) from ground
void setBlockSize(const int size)
setBlockSize sets size of square block (subimage) used in cliff detector
const std::string TYPE_32FC1
void setDefaultDepthMsg(T value)
const std::string TYPE_16UC1
cliff_detector::CliffDetector detector
sensor_msgs::ImagePtr depth_msg
The CliffDetector class detect cliff based on depth image.
void setSensorTiltAngle(const float angle)
setSensorTiltAngle sets the sensor tilt angle (in degrees)
void setRangeLimits(const float rmin, const float rmax)
setRangeLimits sets the minimum and maximum range of depth value from RGBD sensor.