ethz-asl / rotors_simulator

RotorS is a UAV gazebo simulator
1.26k stars 765 forks source link

waypoint_publisher_file doesn't publish #285

Open asiron opened 8 years ago

asiron commented 8 years ago

I found a possible bug, that happens in waypoint_publisher_file. https://github.com/ethz-asl/rotors_simulator/blob/master/rotors_gazebo/src/waypoint_publisher_file.cpp It doesn't publish any message, unless a statement is executed after:

...
wp_pub.publish(msg);
return 0;

for example:

...
wp_pub.publish(msg);
ROS_INFO("Closing..."):
return 0;

Let me know if you can replicate it and I can make a pull request.

ffurrer commented 8 years ago

I have never experienced this, @burrimi @helenol @fmina anyone?

@Asiron can you post the waypoint file you're using and the command, such that we can possibly replicate this?

cheers

helenol commented 8 years ago

Had recent problems with publishing in one-off nodes too actually, you should just add a ros::spin() or a ros::spinOnce() (or twice...) after.

On Mon, Feb 29, 2016 at 1:03 PM, Fadri Furrer notifications@github.com wrote:

I have never experienced this, @burrimi https://github.com/burrimi @helenol https://github.com/helenol @fmina https://github.com/fmina anyone?

@Asiron https://github.com/Asiron can you post the waypoint file you're using and the command, such that we can possibly replicate this?

cheers

— Reply to this email directly or view it on GitHub https://github.com/ethz-asl/rotors_simulator/issues/285#issuecomment-190184596 .

asiron commented 8 years ago

@ffurrer Below you will find the file we used in our lab.

10.0 1.0 -1.0 10.0 0.0
12.0 1.0 -2.0 9.0 0.0
10.0 2.0 -1.0 9.0 0.0
10.0 3.0 -2.0 10.0 0.0
10.0 4.0 -1.0 10.0 3.0
8.0  5.0 -1.0 9.0  2.0
15.0  7.0 -1.0 20.0 1.0
15.0  9.0  3.0 20.0 2.0
15.0  10.0 -5.0 25.0 0.0
15.0  10.0 5.0 20.0 0.0
10.0  11.0 7.0 10.0 0.0
10.0  12.0 5.0 12.0 0.0
10.0  14.0 6.0 10.0 0.0
10.0  16.0 -2.0 10.0 0.0
10.0  17.0 -4.0 10.0 0.0

@helenol Yea, I think that might be the issue. Altough, ROS_INFO is enough, it could be the case, that sometimes it wouldn't publish it neither. I think the program returns, before the other thread publishes the message.

Musab0 commented 8 years ago

I have also experienced the same issue, and the suggested fix worked.

lawenyuan commented 6 years ago

you can add following code after publish message: ‘’‘ ros::Duration(10).sleep(); ‘’‘