Ask Your Question

ar_track_alvar publication rate too small

asked 2018-03-26 10:02:53 -0600

zzzzzq gravatar image

updated 2018-03-28 21:22:14 -0600

Hello! These days I'm trying to use ar_track_alvar to track ar tags but the publication of ar_track_poses is too slow.

I use Ubuntu 16.04 and ros kinetic. My CPU is Intel I7 with 8G memory. When I use ar_track_alvar, it onlypublish /ar_pose_markers at poorly 0.2hz.

I also found that the problem is the rate at which the callback function is called. That function is called merely once every 5 secs. But I can't find anything wrong. I also checked the while(ros::ok()) loop, it tooks 5 secs per loop. However, every step in that loop is very quick. It shouldn't take that long to run each loop. I also checked that the expected rate per loop is 8 hz but actual rate is 0.2 hz. I did this by checking rate.expectedCycleTime() and rate.cycleTime().

Here is the code and the while loop is at line 326.

I have also tested it on Ubuntu 14.04 and ros indigo, the publication rate is 1hz. However my friend can use it with a publication rate of 8 hz on Ubuntu 14.04 and indigo. That's very odd.


edit retag flag offensive close merge delete


I would check the publication of your image topic and the CPU usage of the ar_track_alvar node to get a sense for whether the slowness is combing from the input, CPU usage or something else within the code.

ahendrix gravatar imageahendrix ( 2018-03-26 11:22:32 -0600 )edit

Also of interest, how big are the images that you're trying to process?

ahendrix gravatar imageahendrix ( 2018-03-26 11:22:53 -0600 )edit

The image is raw image from the camera. I use ASUS xtion and the image topic is /camera/rgb/image_raw

zzzzzq gravatar imagezzzzzq ( 2018-03-26 20:31:35 -0600 )edit

I checked the CPU usage, it seems that the usage of ar_track_alvar node is always around 2%, regardless of whether I turn off other CPU consuming process or not. What's more, how can I check the image size? I use the rgb image from kinect and I assume it is 640*480

zzzzzq gravatar imagezzzzzq ( 2018-03-26 21:59:34 -0600 )edit

Well, that seems to rule out the CPU as a bottleneck. Have you tried checking the rate of the image topic? Try rostopic hz

ahendrix gravatar imageahendrix ( 2018-03-27 22:55:23 -0600 )edit

Why did you delete your previous edit?

gvdhoorn gravatar imagegvdhoorn ( 2018-03-28 11:54:41 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2018-03-31 07:51:19 -0600

zzzzzq gravatar image

I have fixed that error. The problem is the code, there is a ros::Duration(5.0) in my code. But when I checked the original code it is right. Maybe I changed the code carelessly.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2018-03-26 10:02:53 -0600

Seen: 83 times

Last updated: Mar 31 '18