-
-
Notifications
You must be signed in to change notification settings - Fork 512
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
Support for commands in parallel #85
Conversation
This is a simple wrapper around std::list to make it thread safe. The wrapper only implements a small subset of the features of std::list.
This adds some completion and errors/warnings for vim with the YouCompleteMe plugin.
ag (the-silver-searcher) did not ignore the directories specified in gitignore presumably because they were wrong.
This allows to change the timeout time of an existing (running) timeout.
This is a big refactor of the MavlinkCommands class in order to support multiple commands in parallel. It won't do multiple commands with the same command ID at the same time in order to prevent conflicts/races with acks that can't be assigned uniquely.
@@ -0,0 +1,206 @@ | |||
# This file is NOT licensed under the GPLv3, which is the license for the rest | |||
# of YouCompleteMe. |
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.
See YouCompleteMe
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?
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.
Exactly - what!!
The text says "This file is NOT licensed under the GPLv3, which is the license for the rest of YouCompleteMe."
That looks like a placeholder to me.
And it should be obvious I am not actually reviewing this - I just wanted to see what the code looked like :-)
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 can remove it and say it is licensed as BSD 3-clause like the rest of the repo.
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.
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.
Actually this file says it is public domain, so I'm not sure what I should do.
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 thought this was our file. If YouComleteMe is an actual real name of a product called YouCompleteMe then we have to leave that alone - it isn't ours to modify.
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.
Yep this file was copied from the YouCompleteMe project, we should leave as is
@@ -101,6 +102,7 @@ class LogDetailed | |||
std::cout << "|Debug] "; | |||
break; | |||
case LogLevel::Info: | |||
std::cout << ANSI_COLOR_BLUE; |
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.
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.
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 like this, I just have a few comments
@@ -101,6 +102,7 @@ class LogDetailed | |||
std::cout << "|Debug] "; | |||
break; | |||
case LogLevel::Info: | |||
std::cout << ANSI_COLOR_BLUE; |
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.
core/locked_list.h
Outdated
class iterator: public std::list<T>::iterator | ||
{ | ||
public: | ||
iterator(typename std::list<T>::iterator c, std::mutex &mutex) : |
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 know we are using single char variables elsewhere but we should move away from this, can we name this variable something more descriptive, please?
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.
Ok 173ac1a.
FAILED | ||
} _state = State::NONE; | ||
std::mutex _state_mutex {}; | ||
static constexpr double DEFAULT_TIMEOUT_NORMAL_S = 0.5; |
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.
We need to find a way to get the default timeouts into the documentation (if they aren't already there), this is important behavior that should be visible to external developers
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.
@julianoes @mrpollo Arguably some timeouts should actually be part of the settable public API - and if so they could then be documented in the same way as everything else (?).
@julianoes Are all timeouts named consistently so we can find them? (i.e. can I have a list)
I've added mavlink/MAVSDK-docs#30 for tracking
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.
Ok, I agree. Let's check this later.
core/mavlink_commands.h
Outdated
|
||
struct Work { | ||
int retries_to_do = 3; | ||
double timeout_s = 0.5; | ||
int num_sent = 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.
can we use a more descriptive name here? is num_set
the number of times a command has been set after retries? I tried following the code and got a bit confused
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.
It is num_sent
, not num_set
but I've changed it to num_command_sent
in a746eab.
core/timeout_handler.cpp
Outdated
} | ||
} | ||
|
||
void TimeoutHandler::update(double new_duration_s, const void *cookie) |
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 about updated_duration_s
instead of new_duration_s
?
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.
Sure, thanks. See ea4cdb8.
This is a big refactor of the MavlinkCommands class in order to support
multiple commands in parallel. It won't do multiple commands with the
same command ID at the same time in order to prevent conflicts/races
with acks that can't be assigned uniquely.