ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

px4flow velocity calcuation

asked 2017-07-27 01:12:35 -0500

b-sriram gravatar image


I have a px4flow smart camera sensor, and use the px4flow_node to read the sensor output.

The topic /px4flow/optflow has a message type:

Header header

float32 ground_distance  # distance to ground in meters
int16   flow_x           # x-component of optical flow in pixels
int16   flow_y           # y-component of optical flow in pixels
float32 velocity_x       # x-component of scaled optical flow in m/s
float32 velocity_y       # y-component of scaled optical flow in m/s
uint8   quality          # quality of optical flow estimate

But when I see the output I only have values for flow_x and flow_y. I am only using it for a 2D robot so assuming I always know the ground distance, can someone please tell me how to calculate the x and y velocities using the flow_x and flow_y values?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2020-06-09 15:59:01 -0500

ashwinvk94 gravatar image

updated 2020-06-11 06:15:21 -0500

gvdhoorn gravatar image

real point P (X,Y,Z), image plane projection p (x,y,z), focal-length f, distance-to-scene Z X = xZ / f Y = yZ / f

Divide X and Y by the flow integration time(time between frames for which optical flow was calculated) to get velocity. Based on:

edit flag offensive delete link more



Please use permalinks in the future.

gvdhoorn gravatar image gvdhoorn  ( 2020-06-10 01:18:27 -0500 )edit

What I added to your answer was already a permalink and took you directly to the file and lines in question. Why did you change it?

gvdhoorn gravatar image gvdhoorn  ( 2020-06-11 06:14:20 -0500 )edit

Question Tools

1 follower


Asked: 2017-07-27 01:12:35 -0500

Seen: 850 times

Last updated: Jun 11 '20