36 #include <nav_msgs/Path.h> 38 #include <move_base_msgs/MoveBaseAction.h> 40 #include <gtest/gtest.h> 56 move_base_ = std::make_shared<ActionClient>(
"/move_base");
59 ROS_ERROR(
"Failed to connect move_base action");
66 geometry_msgs::TransformStamped trans;
68 trans.header.frame_id =
"odom";
69 trans.child_frame_id =
"base_link";
70 trans.transform.translation.x = x;
71 trans.transform.translation.y = y;
72 trans.transform.rotation.w = 1.0;
82 move_base_msgs::MoveBaseGoal goal;
83 goal.target_pose.header.frame_id =
"map";
85 goal.target_pose.pose.orientation.w = 1;
86 goal.target_pose.pose.position.x = 1.4;
87 goal.target_pose.pose.position.y = 0.6;
88 move_base_->sendGoal(goal);
91 void cbPath(
const nav_msgs::Path::ConstPtr& msg)
100 for (
double x = -10;
x < 13;
x += 2.0)
102 for (
double y = -10;
y < 13;
y += 2.0)
107 for (
int i = 0; i < 100; ++i)
115 ASSERT_TRUE(static_cast<bool>(
path_));
120 int main(
int argc,
char** argv)
122 testing::InitGoogleTest(&argc, argv);
123 ros::init(argc, argv,
"test_navigate_boundary");
125 return RUN_ALL_TESTS();
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
nav_msgs::Path::ConstPtr path_
void publishTransform(const double x, const double y)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
TFSIMD_FORCE_INLINE const tfScalar & y() const
TFSIMD_FORCE_INLINE const tfScalar & x() const
int main(int argc, char **argv)
ActionClientPtr move_base_
ros::Subscriber sub_path_
void cbPath(const nav_msgs::Path::ConstPtr &msg)
TEST_F(NavigateBoundary, StartPositionScan)
tf2_ros::TransformBroadcaster tfb_
ROSCPP_DECL void spinOnce()
std::shared_ptr< ActionClient > ActionClientPtr