srv / fovis

ROS wrapper for fovis, a visual odometry library
23 stars 21 forks source link

Low frequency #7

Closed TSC21 closed 10 years ago

TSC21 commented 10 years ago

Hi there,

I'm trying mono_depth_odometer with a changed topic: /camera/rgb/image_rect_color instead of /camera/rgb/image_rect_mono, with an Asus Xtion Pro Live.

The thing is I have a Haswell i7 3.4Ghz computer running Ubuntu 12.04 with ROS Hydro and still getting a 2/3 hz tf published! :S when echoing the pose I also see that the command line echo log seems very slow.

Here's the tf tree: tf_tree

Is there a possible explanation to this? Supposedly this is a "fast" odometry framework, and it's revealing to be slower than the other packages I have here. I'll be using this in a MAV with and Embedded ARM, but first want it to test it in my laptop. If I get this results on my laptop I will probably get even worse in a ARM platform.

Thanks in advance!

stwirth commented 10 years ago

Did you check the rate of all incoming topics (rostopic hz ...)?

TSC21 commented 10 years ago

Here are some: rostopic hz /kinect_odometer/pose

subscribed to [/kinect_odometer/pose]
average rate: 3.232
    min: 0.301s max: 0.318s std dev: 0.00822s window: 3

rostopic hz /kinect_odometer/features

subscribed to [/kinect_odometer/features]
average rate: 2.666
    min: 0.375s max: 0.375s std dev: 0.00000s window: 2

rostopic hz /kinect_odometer/info

subscribed to [/kinect_odometer/info]
average rate: 3.256
    min: 0.307s max: 0.307s std dev: 0.00000s window: 2

rostopic hz /kinect_odometer/odometry

subscribed to [/kinect_odometer/odometry]
average rate: 3.112
        min: 0.296s max: 0.361s std dev: 0.02855s window: 4

rostopic hz /nodelet_manager/bond

subscribed to [/nodelet_manager/bond]
average rate: 8.694
    min: 0.115s max: 0.115s std dev: 0.00000s window: 2

All seem slow don't you think?

stwirth commented 10 years ago

Yes, that's the same frequency as the tf. I meant the input topics for the odometer, sorry.

TSC21 commented 10 years ago

rostopic hz /camera/rgb/image_rect_color

subscribed to [/camera/rgb/image_rect_color]
average rate: 29.848
    min: 0.031s max: 0.036s std dev: 0.00153s window: 29

rostopic hz /camera/depth_registered/sw_registered/image_rect_raw

subscribed to [/camera/depth_registered/sw_registered/image_rect_raw]
average rate: 29.353
    min: 0.030s max: 0.049s std dev: 0.00336s window: 29

rostopic hz /camera/depth_registered/image_rect

subscribed to [/camera/depth_registered/image_rect]
average rate: 30.066
    min: 0.027s max: 0.039s std dev: 0.00221s window: 29

rostopic hz /camera/rgb/camera_info

subscribed to [/camera/rgb/camera_info]
average rate: 29.891
    min: 0.030s max: 0.039s std dev: 0.00169s window: 30

rostopic hz /camera/depth_registered/sw_registered/camera_info

subscribed to [/camera/depth_registered/sw_registered/camera_info]
average rate: 29.152
    min: 0.027s max: 0.051s std dev: 0.00415s window: 29

Camera topics at 30hz. What are those topics? Can you tell me plz so I don't have to search on?

stwirth commented 10 years ago

rosnode info kinect_odometer should tell you which topics the odometer subscribes to.

TSC21 commented 10 years ago

Here they are: rostopic hz /camera/rgb/image_rect_color

subscribed to [/camera/rgb/image_rect_color]
average rate: 28.292
    min: 0.033s max: 0.062s std dev: 0.00692s window: 17

rostopic hz /camera/rgb/camera_info

subscribed to [/camera/rgb/camera_info]
average rate: 28.173
    min: 0.032s max: 0.064s std dev: 0.00751s window: 16

rostopic hz /camera/depth_registered/sw_registered/camera_info

subscribed to [/camera/depth_registered/sw_registered/camera_info]
average rate: 28.980
    min: 0.032s max: 0.067s std dev: 0.00628s window: 30

rostopic hz /tf

subscribed to [/tf]
average rate: 40.802
        min: 0.006s max: 0.049s std dev: 0.01446s window: 40

(the /tf topic off course is not necessary cause there are many tf's in the tree):

Here's the result of rosnode info kinect_odometer: rosnode info kinect_odometer

--------------------------------------------------------------------------------
Node [/kinect_odometer]
Publications: 
 * /kinect_odometer/features [sensor_msgs/Image]
 * /kinect_odometer/features/theora/parameter_descriptions [dynamic_reconfigure/ConfigDescription]
 * /kinect_odometer/features/theora/parameter_updates [dynamic_reconfigure/Config]
 * /kinect_odometer/features/compressedDepth/parameter_descriptions [dynamic_reconfigure/ConfigDescription]
 * /kinect_odometer/features/compressedDepth [sensor_msgs/CompressedImage]
 * /kinect_odometer/pose [geometry_msgs/PoseStamped]
 * /kinect_odometer/features/compressedDepth/parameter_updates [dynamic_reconfigure/Config]
 * /tf [tf2_msgs/TFMessage]
 * /kinect_odometer/features/compressed [sensor_msgs/CompressedImage]
 * /rosout [rosgraph_msgs/Log]
 * /kinect_odometer/features/compressed/parameter_updates [dynamic_reconfigure/Config]
 * /kinect_odometer/odometry [nav_msgs/Odometry]
 * /kinect_odometer/features/compressed/parameter_descriptions [dynamic_reconfigure/ConfigDescription]
 * /kinect_odometer/features/theora [theora_image_transport/Packet]
 * /kinect_odometer/info [fovis_ros/FovisInfo]

Subscriptions: 
 * /camera/depth_registered/sw_registered/camera_info [sensor_msgs/CameraInfo]
 * /tf [tf2_msgs/TFMessage]
 * /camera/depth_registered/image_rect [sensor_msgs/Image]
 * /tf_static [unknown type]
 * /camera/rgb/image_rect_color [sensor_msgs/Image]
 * /camera/rgb/camera_info [sensor_msgs/CameraInfo]

Services: 
 * /kinect_odometer/features/compressedDepth/set_parameters
 * /kinect_odometer/features/compressed/set_parameters
 * /kinect_odometer/get_loggers
 * /kinect_odometer/features/theora/set_parameters
 * /kinect_odometer/set_logger_level

contacting node http://ubuntu:43749/ ...
Pid: 10947
Connections:
 * topic: /rosout
    * to: /rosout
    * direction: outbound
    * transport: TCPROS
 * topic: /tf
    * to: /kinect_odometer
    * direction: outbound
    * transport: INTRAPROCESS
 * topic: /tf
    * to: /camera/camera_nodelet_manager
    * direction: outbound
    * transport: TCPROS
 * topic: /camera/rgb/image_rect_color
    * to: /camera/camera_nodelet_manager (http://ubuntu:49406/)
    * direction: inbound
    * transport: TCPROS
 * topic: /camera/depth_registered/image_rect
    * to: /nodelet_manager (http://ubuntu:48426/)
    * direction: inbound
    * transport: TCPROS
 * topic: /camera/rgb/camera_info
    * to: /camera/camera_nodelet_manager (http://ubuntu:49406/)
    * direction: inbound
    * transport: TCPROS
 * topic: /camera/depth_registered/sw_registered/camera_info
    * to: /camera/camera_nodelet_manager (http://ubuntu:49406/)
    * direction: inbound
    * transport: TCPROS
 * topic: /tf
    * to: /kinect_odometer (http://ubuntu:43749/)
    * direction: inbound
    * transport: INTRAPROCESS
 * topic: /tf
    * to: /camera_base_link (http://ubuntu:39220/)
    * direction: inbound
    * transport: TCPROS
 * topic: /tf
    * to: /camera_base_link1 (http://ubuntu:38166/)
    * direction: inbound
    * transport: TCPROS
 * topic: /tf
    * to: /camera_base_link2 (http://ubuntu:52097/)
    * direction: inbound
    * transport: TCPROS
 * topic: /tf
    * to: /camera_base_link3 (http://ubuntu:43945/)
    * direction: inbound
    * transport: TCPROS
stwirth commented 10 years ago

Subscriptions:

/camera/depth_registered/sw_registered/camera_info [sensor_msgs/CameraInfo] /tf [tf2_msgs/TFMessage] /camera/depth_registered/image_rect [sensor_msgs/Image] /tf_static [unknown type] /camera/rgb/image_rect_color [sensor_msgs/Image] /camera/rgb/camera_info [sensor_msgs/CameraInfo]

It seems odd that the camera_info for the depth image is in depth_registered/sw_registered while the image is in only in the depth_registered namespace. Are those two time synchronized? I've never used software registration before. Is there a /camera/depth_registered/camera_info topic?

stwirth commented 10 years ago

Also, to make sure that the lag does not come from RGB instead of mono you could run image_proc to create mono images.

TSC21 commented 10 years ago

Yes there is a /camera/depth_registered/camera_info. In the launch file it was subscribing to /camera/depth_registered/sw_registered/camera_info but already changed to /camera/depth_registered/camera_info and I get the same result.

TSC21 commented 10 years ago

Should I adapt camera_nodelet_manager of openni2_camera to get the mono (it already uses image_proc). It doesn't seem the problem is in being mono or rgb though but I can try.

TSC21 commented 10 years ago

Well I already have a mono topic (just add to activate it in the openni2.launch file). Still with the same results though:

rosnode info kinect_odometer

--------------------------------------------------------------------------------
Node [/kinect_odometer]
Publications: 
 * /kinect_odometer/features [sensor_msgs/Image]
 * /kinect_odometer/features/theora/parameter_updates [dynamic_reconfigure/Config]
 * /kinect_odometer/features/theora/parameter_descriptions [dynamic_reconfigure/ConfigDescription]
 * /kinect_odometer/features/compressedDepth/parameter_descriptions [dynamic_reconfigure/ConfigDescription]
 * /kinect_odometer/features/compressedDepth [sensor_msgs/CompressedImage]
 * /kinect_odometer/pose [geometry_msgs/PoseStamped]
 * /kinect_odometer/features/compressedDepth/parameter_updates [dynamic_reconfigure/Config]
 * /tf [tf2_msgs/TFMessage]
 * /kinect_odometer/features/compressed [sensor_msgs/CompressedImage]
 * /rosout [rosgraph_msgs/Log]
 * /kinect_odometer/features/compressed/parameter_updates [dynamic_reconfigure/Config]
 * /kinect_odometer/odometry [nav_msgs/Odometry]
 * /kinect_odometer/features/compressed/parameter_descriptions [dynamic_reconfigure/ConfigDescription]
 * /kinect_odometer/features/theora [theora_image_transport/Packet]
 * /kinect_odometer/info [fovis_ros/FovisInfo]

Subscriptions: 
 * /camera/rgb/camera_info [sensor_msgs/CameraInfo]
 * /camera/depth_registered/sw_registered/camera_info [sensor_msgs/CameraInfo]
 * /camera/depth_registered/image_rect [sensor_msgs/Image]
 * /tf [tf2_msgs/TFMessage]
 * /tf_static [unknown type]
 * /camera/rgb/image_rect_mono [sensor_msgs/Image]

Services: 
 * /kinect_odometer/features/compressedDepth/set_parameters
 * /kinect_odometer/features/compressed/set_parameters
 * /kinect_odometer/get_loggers
 * /kinect_odometer/set_logger_level
 * /kinect_odometer/features/theora/set_parameters

contacting node http://ubuntu:38341/ ...
Pid: 18043
Connections:
 * topic: /rosout
    * to: /rosout
    * direction: outbound
    * transport: TCPROS
 * topic: /tf
    * to: /kinect_odometer
    * direction: outbound
    * transport: INTRAPROCESS
 * topic: /tf
    * to: /camera/camera_nodelet_manager
    * direction: outbound
    * transport: TCPROS
 * topic: /camera/rgb/image_rect_mono
    * to: /camera/camera_nodelet_manager (http://ubuntu:47287/)
    * direction: inbound
    * transport: TCPROS
 * topic: /camera/depth_registered/image_rect
    * to: /nodelet_manager (http://ubuntu:39788/)
    * direction: inbound
    * transport: TCPROS
 * topic: /camera/rgb/camera_info
    * to: /camera/camera_nodelet_manager (http://ubuntu:47287/)
    * direction: inbound
    * transport: TCPROS
 * topic: /camera/depth_registered/sw_registered/camera_info
    * to: /camera/camera_nodelet_manager (http://ubuntu:47287/)
    * direction: inbound
    * transport: TCPROS
 * topic: /tf
    * to: /kinect_odometer (http://ubuntu:38341/)
    * direction: inbound
    * transport: INTRAPROCESS
 * topic: /tf
    * to: /camera_base_link1 (http://ubuntu:55340/)
    * direction: inbound
    * transport: TCPROS
 * topic: /tf
    * to: /camera_base_link2 (http://ubuntu:48170/)
    * direction: inbound
    * transport: TCPROS
 * topic: /tf
    * to: /camera_base_link3 (http://ubuntu:34891/)
    * direction: inbound
    * transport: TCPROS
 * topic: /tf
    * to: /camera_base_link (http://ubuntu:51625/)
    * direction: inbound
    * transport: TCPROS

Here's the rate of the pose, for example: rostopic hz /kinect_odometer/pose

subscribed to [/kinect_odometer/pose]
average rate: 2.992
    min: 0.333s max: 0.336s std dev: 0.00154s window: 3

So I supposed this doesn't have anything to do with the rgb. Any tips?

Note: same thing with /camera/depth_registered/camera_info instead of /camera/depth_registered/sw_registered/camera_info.

stwirth commented 10 years ago

How is the CPU usage? Does the odometer max out one CPU? One more thing you could try is to increase the queue_size parameter from 5 to 100 or so, this should help synchronizing the input topics. This is as far as I can help, I don't have a sensor here to try.

TSC21 commented 10 years ago

Seems that I have an high CPU usage yes. Here's the htop screen: (check the first line)

screenshot from 2014-08-01 18 25 25

TSC21 commented 10 years ago

So to try, can you tell me how to change that parameter on the code? Thanks

stwirth commented 10 years ago

It's a normal rosparam. So in the launch file add <param name="queue_size" value="100" /> inside the odom node tag. Do you get any other errors?

TSC21 commented 10 years ago

Changing the param didn't solve it. And no I don't get any errors (don't get any error at all).

stwirth commented 10 years ago

Sorry for not being able to help. @miquelmassot @plnegre have you tried the mono_depth_odometer lately?

TSC21 commented 10 years ago

No problem @stwirth! I really want to get this working cause I need a proper pose estimation to my MAV.

Right now the other options are: rgbdslam_v2 (really heavy but reliable), ccny_rgbd (fast, working and the one I'm using - not really reliable though), demo_rgbd (working with some problems that are being corrected) and fovis of course. Since fovis is told to be created to being used in MAVs I was hoping it was working.

Do you know any other that uses also depth and point clouds in VO so to test? This is part of my MSc research.

plnegre commented 10 years ago

This could be a problem of the sync callback. One option you can try is to publish an empty message of any type inside the function 'fovis_ros/src/mono_depth_odometer.cpp/imageCallback (line 55).

Then, check the frequency of this message. If you get a frequency much lower than your minimum input frequency it means that your messages are not synchronized. In that case, check your ROS time: are you using different machines? Are their clocks synchronized?

We are currently running the stereo version of fovis at 10Hz in a normal PC...

miquelmassot commented 10 years ago

I agree with @plnegre , are you running the sensor in a different machine or from a bagfile?

On 2 August 2014 08:58, Pep Lluís Negre notifications@github.com wrote:

This could be a problem of the sync callback. One option you can try is to publish an empty message of any type inside the function 'fovis_ros/src/mono_depth_odometer.cpp/imageCallback (line 55).

Then, check the frequency of this message. If you get a frequency much lower than your minimum input frequency it means that your messages are not synchronized. In that case, check your ROS time: are you using different machines? Are their clocks synchronized?

We are currently running the stereo version of fovis at 10Hz in a normal PC...

— Reply to this email directly or view it on GitHub https://github.com/srv/fovis/issues/7#issuecomment-50955974.

Miquel Massot

miquel.massot@gmail.com http://www.facebook.com/massot http://www.twitter.com/resisteix http://gplus.to/massot

TSC21 commented 10 years ago

I'm running the sensor in my laptop. I will try what @plnegre and see what I get. Then I will let you know.

TSC21 commented 10 years ago

I was looking at fovis_ros/src/mono_depth_odometer.cpp/imageCallback to understand how to add the msg to be published. If I want to add std_msgs::String msg to be published, what should be done so to have the node published that msg then (the code as it is written is not familiar to me). This is to test @plnegre option. Even if I get a problem of sync, what should I do next? I have other visual odometry algorithms where I get efficient speeds so I can't see where can be the problem in the case of fovis. Thanks in advance!

TSC21 commented 10 years ago

Anyone? Thanks in advance!

plnegre commented 10 years ago

Please, visit http://wiki.ros.org/ROS/Tutorials/WritingPublisherSubscriber%28c%2B%2B%29 for more information on how to write a publisher in ros.

If you get a low frequency i.e. a sync problem, then you should investigate the cause of this misalignment in the time between messages.

miquelmassot commented 10 years ago

Closed for inactivity. If you still have issues, reopen this topic.