31 #include <geometry_msgs/Twist.h> 32 #include <sensor_msgs/PointCloud2.h> 37 #include <gtest/gtest.h> 43 const float dt = 0.02;
46 const float velocities[] =
50 for (
const float vel : velocities)
54 const boost::function<void(const geometry_msgs::Twist::ConstPtr&)> cb_cmd_vel =
55 [dt, &x, &stop](
const geometry_msgs::Twist::ConstPtr&
msg) ->
void 57 if (std::abs(
msg->linear.x) < 1e-4 && x > 0.5)
60 x += dt *
msg->linear.x;
64 for (
int i = 0; i < lround(10.0 / dt) &&
ros::ok() && !stop; ++i)
67 publishSinglePointPointcloud2(1.0 - x, 0, 0,
"base_link",
ros::Time::now());
69 publishSinglePointPointcloud2(-3.0 - x, 0, 0,
"base_link",
ros::Time::now());
70 publishWatchdogReset();
71 publishTwist(vel, 0.0);
91 int main(
int argc,
char** argv)
93 testing::InitGoogleTest(&argc, argv);
94 ros::init(argc, argv,
"test_safety_limiter");
96 return RUN_ALL_TESTS();
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
TEST_F(SafetyLimiterTest, SafetyLimitLinearSimpleSimulationWithMargin)
int main(int argc, char **argv)
ROSCPP_DECL void spinOnce()