-
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
[module][refactor] replace traffic_info subsystem with module #1638
Conversation
A detailed description in the module would be great! There are some more things to fix:
|
Also we should be really sure we actually want to use UTM for traffic_info instead of the more common LLA... |
Ah yes, I see that now as well. I will wait till the final decision is made on the utm. I am for lla. Then we don't have to worry about zone extending when in a different zone. I am also fo lla in communications as you have one term less (zone). |
I'm fine with storing the state of other aircraft in lla, but then we also need to provide convenient way to use it with several options:
The painful to implement option 3 is probably the best since you only compute what you need, and even handle local or global coordinates. |
Thanks for the feedback. Sounds like I will try to use state as an example for the new and improved traffic. I will also take a look at the multi modules to upgrade them to use true global coordinates. I think with this I can also implement a follow nav block for rotorcraft. I am working on a paper now so would prefer not to change it right now so I will get back to this in about 2 weeks. |
after a found break I have found some time to update the traffic. I still have to update the modules with the new protocol but here is a initial preview of what the new traffic info module looks like. I hope this is more in the right direction. |
@kirkscheper it seems you're not pointing to the correct pprzlink version |
Yea, I know, I am waiting for it to be pulled to master. Currently pointing Any comments on the changes? I added an acinfo_lla message, alternatively I I am testing it all right now actually, as soon as I get the thumbs up from
|
The overall changes are looking fine. You can probably already make the request for ACINFO_LLA in pprzlink. |
@@ -381,8 +380,8 @@ let send_aircraft_msg = fun ac -> | |||
else | |||
let deg7_of_rad = fun f -> PprzLink.Int32 (Int32.of_float (Geometry_2d.rad2deg (f *. 1e7))) in | |||
let ac_info_lla = ["ac_id", PprzLink.String ac; | |||
"lat", deg7_of_rad a.pos.posn_lat; | |||
"lon", deg7_of_rad a.pos.posn_long; | |||
"lla_lat", deg7_of_rad a.pos.posn_lat; |
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 keep lat
and lon
like we have it in the other messages...
f13ca52
to
631242f
Compare
All cleaned up and ready to go. This does need paparazzi/pprzlink#14 to work fully (weird that all the tests were passed...). |
Only the configurations in conf_tests.xml are run on every commit. Testing of all confs is only run once per day and not shown in the PR checks... |
ah, cool. Where can I find the output of the test_all_confs? |
They are sent to paparazzi-builds@nongnu.org and listed on semaphore: https://semaphoreci.com/paparazziuav/paparazzi (the ones that say "Scheduler rebuilt x" are the ones which compiled all confs) |
/** Get vehicle course (float). | ||
* @param[in] aircraft id of aircraft info to get | ||
*/ | ||
static inline float *acInfoGetCourse(uint8_t ac_id) |
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 think it would be nicer/better if all get functions returning a scalar actually return a scalar instead of a pointer (like in the state interface).
For the future: it makes reviewing much easier if you make separate commits for logical changes and especially separate commits for only formatting changes... |
ti_acs_idx = 2; | ||
} | ||
|
||
int parse_acinfo_dl(void) |
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.
seems like it would make more sense to return a bool here?
I like the new traffic info, looks well done/structured and nicely commented 👍 Some general higher level questions and remarks:
@gautierhattenberger regarding the last point: at a glance it looks like this could be problematic (since the ENU position from traffic info is compared to the output of |
|
||
/************************ Get functions ****************************/ | ||
|
||
extern void acInfoCalcPositionUtm_i(uint8_t ac_id); |
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.
how do all these functions handle the case where the info for the requested ac_id is not present?
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.
For the set functions, I totally forgot about that. I will update that.
For the get functions, from the current use cases, the position of the other aircraft is used to get a delta which is used to do something so I could return the position of the ownship when the requested ac_id isn't initialised. Velocity is usually used to extrapolate the other ac position with the itow difference so there I would just return zeros. With the current implementation you are likely to get really strange values if the ac isn't initialised yet. Any other ideas?
Now I write this it may also be interesting to have helper functions that just return the relative position of the other vehicle (so do the subtraction for you) cause it is almost always the goal. I was really hoping to be done with this :(
Regarding the TCAS stuff, it looks like it only uses relative positions so the ENU vs UTM shouldn't be an issue. For making it work with rotorcraft that needs a little work as it currently uses v_ctl_altitude_setpoint to set the desired alt. I will leave that for another PR. |
Unfortunately that is not true. ENU and UTM coordinate systems don't align perfectly if you are not in the center of a UTM zone. In UTM north always points north and in ENU north is only exactly north at the origin. So if you are further away from the origin the axis don't align... |
yes yes, this problem I know very well, I have already mentioned before that the conversions in state.c are not correct. you first have to go to lla then to enu. The last time I mentioned this someone mentioned that it was done so as to not have the computation penalty on limited platforms and that the issue would be fixed when the navigation firmware is unified. I really really don't like the hack in state... |
Oh gosh, I also forgot about ellipsoid to hsml conversions in the frame calculations face palm. |
7bb08a3
to
c125a05
Compare
I think I got most of the comments. ps. if you didn't like what I did in the UTM PR you probably won't like what I did here either. I have a geoid_height variable to convert from ellipsoid to hsml and vise-versa. My plan was that when more accurate methods are developed they could be included in the function which sets the geoid_height variable (traffic_info.c). |
} | ||
// Bound alt | ||
tcas_alt_setpoint = Max(GROUND_ALT + SECURITY_HEIGHT, tcas_alt_setpoint); |
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.
wonder if we shouldn't rather use ground_alt + SECURITY_HEIGHT
so it takes the geo init changes into account...
I'm not really sure that the current conversions are really matching. Here, when traffic info UTM position is stored in UTM format, and when ENU is requested, it is computed from UTM->LLA->ENU, which means that it is not compatible for fixed-wing ENU (which are still "local utm / fake enu"). Actually the conversion is not even done since LLA->ENU needs a ned_origin, while only utm_origin is provided in the case of FW. |
c125a05
to
8c5be3f
Compare
5bcfd50
to
55cbeeb
Compare
It looks okay now, I think it is almost ready to merge. |
It's still not clear to me in which cases this would now work and in which cases it would be wrong. |
It will take same time to analyze and test all of them, but in general, since external positions are received in global coordinates, and that transformation to local ones is done the same (eventually bad) way than state interface and based on the same reference, it should already work in most cases (if not all). |
OK... |
With the most recent commit, this is what I think. When it should work but not tested: When it doesn't work: Is this almost done now? What's missing? |
For points when it doesn't work:
I think we are ready to merge. @flixr any objections ? |
Splitting #1629. This pull request converts traffic info from subsystem to module and updates the functions that use traffic_info.
Is there any documentation that I should add for this?