2 #include "std_msgs/Float32.h" 3 #include "geometry_msgs/Twist.h" 7 int main(
int argc,
char **argv) {
9 std::string pheeno_name;
17 std::string pheeno_number = cml_parser(
"-n");
18 pheeno_name =
"/pheeno_" + pheeno_number;
22 ROS_ERROR(
"Need to provide Pheeno number!");
27 ros::init(argc, argv,
"obstacle_avoidance_node");
37 double current_duration;
38 double turn_direction = pheeno.
randomTurn(0.07);
41 geometry_msgs::Twist cmd_vel_msg;
48 if (current_duration <= 2.0) {
50 cmd_vel_msg.linear.x = linear;
51 cmd_vel_msg.angular.z = angular;
53 }
else if (current_duration < 5.0) {
55 cmd_vel_msg.linear.x = linear;
56 cmd_vel_msg.angular.z = angular;
void publish(geometry_msgs::Twist velocity)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
int main(int argc, char **argv)
void avoidObstaclesAngular(double &angular, double &random_turn_value, float angular_velocity=1.2, double range_to_avoid=20.0)
double randomTurn(float angular=0.06)
ROSCPP_DECL void spinOnce()
void avoidObstaclesLinear(double &linear, double &angular, float angular_velocity=1.2, float linear_velocity=0.08, double range_to_avoid=20.0)