32 #include <nav_msgs/OccupancyGrid.h> 33 #include <nav_msgs/Path.h> 34 #include <planner_cspace_msgs/PlannerStatus.h> 35 #include <sensor_msgs/PointCloud.h> 37 #include <gtest/gtest.h> 79 void showMap(
const nav_msgs::OccupancyGrid::ConstPtr& msg)
81 std::cerr << std::hex;
82 for (
size_t y = 0;
y < msg->info.height; ++
y)
84 for (
size_t x = 0;
x < msg->info.width; ++
x)
86 std::cerr << (msg->data[
x +
y * msg->info.width] / 11);
88 std::cerr << std::endl;
90 std::cerr << std::dec;
92 std::streamsize ss = std::cerr.precision();
93 std::cerr <<
"path:" << std::endl
94 << std::setprecision(3);
95 for (
const auto& p :
path_->poses)
96 std::cerr << p.pose.position.x <<
", " << p.pose.position.y <<
", " << std::endl;
98 std::cerr << std::setprecision(ss);
112 void cbDistance(
const sensor_msgs::PointCloud::ConstPtr& msg)
117 void cbStatus(
const planner_cspace_msgs::PlannerStatus::ConstPtr& msg)
119 if (msg->error == planner_cspace_msgs::PlannerStatus::GOING_WELL &&
120 msg->status == planner_cspace_msgs::PlannerStatus::DOING)
123 void cbPath(
const nav_msgs::Path::ConstPtr& msg)
125 if (msg->poses.size() > 0)
176 for (
auto data : data_set)
181 if (::testing::Test::HasFailure())
203 for (
auto data : data_set)
208 if (::testing::Test::HasFailure())
224 if (std::abs(y - 0.5) < 0.05)
226 const float dist_from_goal = std::abs(x - 1.0);
227 ASSERT_NEAR(dist_from_goal, d, 0.15);
232 int main(
int argc,
char** argv)
234 testing::InitGoogleTest(&argc, argv);
235 ros::init(argc, argv,
"test_debug_outputs");
237 return RUN_ALL_TESTS();
nav_msgs::Path::ConstPtr path_
ros::Subscriber sub_remembered_
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
void cbPath(const nav_msgs::Path::ConstPtr &msg)
nav_msgs::OccupancyGrid::ConstPtr map_remembered_
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
void cbHysteresis(const nav_msgs::OccupancyGrid::ConstPtr &msg)
void cbStatus(const planner_cspace_msgs::PlannerStatus::ConstPtr &msg)
void cbDistance(const sensor_msgs::PointCloud::ConstPtr &msg)
TFSIMD_FORCE_INLINE const tfScalar & y() const
TEST_F(DebugOutputsTest, Hysteresis)
ros::Subscriber sub_status_
TFSIMD_FORCE_INLINE const tfScalar & x() const
nav_msgs::OccupancyGrid::ConstPtr map_hysteresis_
sensor_msgs::PointCloud::ConstPtr map_distance_
void showMap(const nav_msgs::OccupancyGrid::ConstPtr &msg)
void cbRemembered(const nav_msgs::OccupancyGrid::ConstPtr &msg)
ros::Subscriber sub_distance_
int main(int argc, char **argv)
ROSCPP_DECL void spinOnce()
ros::Subscriber sub_path_
ros::Subscriber sub_hysteresis_