9 #include "../include/auto_dock.h" 10 #define MAX(x,y) (x>y)?y:x 16 AutoDock::AutoDock():theta_diff(100.0),vertical_theta_thresh(0.0),found_docker(false),get_middlepose(false),
17 reached_docker(false){
60 autodock_state_rate.
sleep();
79 while((
p[0]==-1||
p[2]==-1)&&search_times<60*20)
90 if(search_times>=60*20){
91 ROS_INFO(
"searched for 30 seconds for turn 3 loops,but not found docker,please recheck!");
127 forward_rate.
sleep();
136 while(
p[0]>5&&
abs(
p[2]-524)<=5){
139 forward_rate.
sleep();
145 forward_rate.
sleep();
161 cmd_pub_rate.
sleep();
177 if(msg.data ==
true){
179 ROS_INFO(
"launch autodock success, start searching docker around robot.");
185 ROS_INFO(
"xbot autodock has already launched, please check /auto_dock/state for autodock state and try later!");
192 int length = msg.ranges.size();
193 vector<float> a = msg.intensities;
202 if(a[i+j]<200)
break;
222 if(a[i+j]<200)
break;
237 if(
p[0]!=-1&&
p[2]!=-1)
239 p[1] = (
p[0]+
p[2])/2;
243 for(
int pii=0;pii<3;pii++){
244 theta[pii]=msg.angle_min+
p[pii]*msg.angle_increment;
278 int main(
int argc,
char **argv)
void publish(const boost::shared_ptr< M > &message) const
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
float vertical_theta_thresh
xbot_navi::AutodockState autodock_state_msg
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
ros::Subscriber launch_autodock_sub
int main(int argc, char **argv)
geometry_msgs::Twist cmd_vel_msg
ROSCPP_DECL void spin(Spinner &spinner)
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
void pub_autodock_state()
boost::thread * heading_docker_thread
INLINE Rall1d< T, V, S > abs(const Rall1d< T, V, S > &x)
void launch_autodockCB(const std_msgs::Bool)
INLINE Rall1d< T, V, S > tan(const Rall1d< T, V, S > &arg)
void laser_scanCB(const sensor_msgs::LaserScan)
boost::thread * search_dock_thread
boost::thread * state_pub_thread
ros::Publisher xbot_cmd_vel_pub
ros::Subscriber laser_scan_sub
ros::Publisher autodock_state_pub