void Experiment::stopAndMoveToStart(void) { double rand_ang, rand_orientation, start_x, start_y; double x = odom_msg_.pose.pose.position.x, y = odom_msg_.pose.pose.position.y; ROS_INFO("X: %f, Y: %f, B0: %f, B1: %f, B2: %f, B3: %f", x, y, bounds_[0], bounds_[1], bounds_[2], bounds_[3]); std_msgs::Float64 timeDiff; timeDiff.data = ros::Time::now().toSec() - last_time_; lc_pub_.publish(timeDiff); path_final_pub_.publish(path_msg_); mode_ = MODE_RETURN; ROS_INFO("Completed rep: %d, returning to start location", cnt_rep_); actions_->Stop(); //lc_->UpdateSteps(cnt_timesteps_); cnt_timesteps_ = 0; // Calculate next position rand_ang = 2.0 * M_PI * (rand() / ((double)RAND_MAX + 1)); rand_orientation = 2.0 * M_PI * (rand() / ((double)RAND_MAX + 1)); ROS_INFO("Rand_Ang: %f, Rand orient: %f", rand_ang, rand_orientation); start_x = goalx_ + start_radius_ * cos(rand_ang); start_y = goaly_ + start_radius_ * sin(rand_ang); // Send the next start position and wait for move_stopped flag geometry_msgs::Pose start_msg; start_msg.position.x = start_x; start_msg.position.y = start_y; start_msg.orientation = tf::createQuaternionMsgFromYaw(rand_orientation); move_pub_.publish(start_msg); }