-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
opticflow module #1062
opticflow module #1062
Conversation
<define name="USE_ARDRONE_VIDEO" /> | ||
<raw> | ||
|
||
include $(PAPARAZZI_HOME)/sw/ext/ardrone2_vision/Makefile.paths |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be PAPARAZZI_SRC not PAPARAZZI_HOME
how about this... anyone wants to make the code look better? |
@@ -36,13 +36,13 @@ inline void resize_uyuv(struct img_struct *input, struct img_struct *output, int | |||
*dest++ = *source++; // U | |||
*dest++ = *source++; // Y | |||
// now skip 3 pixels | |||
if (pixelskip) { source += (pixelskip + 1) * 2; } | |||
source += (pixelskip + 1) * 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to keep my version, otherwise it doesn't work with downsample=1 (which makes a copy of the image)
…rking with downsample=1 (copy)
Thanks. Just one thing missing: in |
@@ -0,0 +1,51 @@ | |||
/* | |||
* Copyright (C) 2008-2009 Antoine Drouin <[email protected]> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please correctly put your name in here?
There are also some other potential issues, like calling |
to get the scale when computing velocity from flow
<periodic fun="opticflow_module_run()" freq="60" start="opticflow_module_start()" stop="opticflow_module_stop()" autorun="TRUE"/> | ||
<makefile target="ap"> | ||
<define name="ARDRONE_VIDEO_PORT" value="2002" /> | ||
<define name="USE_ARDRONE_VIDEO" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this supposed to be good for, seems unused to me...
Tried to cleanup some more stuff and added a subscriber for AGL (to use for scale in velocity computation)... Accessing the state interface from a thread is probably not a good idea, you can be lucky and it works, but there is no guarantee that you don't try to read it while it is currently updated... |
AP_MODE_MODULE is not the best, but good enough I guess until we can generate modes |
@flixr thank for the updates. This multithread design initially used UDP to send data from one program to the next: https://github.com/tudelft/ardrone2_vision/blob/master/modules/ObstacleAvoidSkySegmentation/sky_seg_avoid_gst.c#L82 I don't know at which point in time this got lost... |
static void agl_cb(uint8_t sender_id __attribute__((unused)), const float *distance) | ||
{ | ||
if (distance > 0) { | ||
estimator_agl = *distance; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this particular case, the data is read only and the copy is atomic, so it will be thread safe.
But testing the pointer is not correct ;)
if (*distance > 0) {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching this!
And yes, this one is thread safe, otherwise I wouldn't have added it ;-)
And sending telemetry messages via DOWNLINK_SEND_x or pprz_msg_send_x is also not thread safe... |
I would prefer to make it 100% safe again: define 1 struct that goes from (this was the setup from the start, but after 3 people worked on it, it Any better idea than UDP transfer? (this also makes it possible to run a -Christophe On Thu, Jan 29, 2015 at 1:03 PM, Felix Ruess [email protected]
|
At least use a unix domain socket instead of a udp socket... |
@dewagter see my opticflow_socket branch with a dummy example on how you could use unix domain sockets to pass results from the thread, specifically flixr@dfa33e4 |
Add cv_opticflow.xml module. Used to for hover stabilization on an ARDrone2. Also adds AP_MODE_MODULE to make it easier to add extra "external" control loops.
todo