-
Notifications
You must be signed in to change notification settings - Fork 62
Hardware Configuration Manager #115
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
Draft
BillThePlatypus
wants to merge
33
commits into
main
Choose a base branch
from
config_manager
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 13 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
5ab60a3
Add conif_manager stuff to mavrosflight
BillThePlatypus a9a8462
Update gitignore to ignore clion files
BillThePlatypus e0c5fcb
Add service definitions for setting and getting configurations
BillThePlatypus 938056d
Add line required by C++, but which doesn't really say anything
BillThePlatypus da785c1
Fix potential memory leak
BillThePlatypus 4e73797
Basic functionality working for config_manager
BillThePlatypus c9770ea
Rename param_write to settings_write
BillThePlatypus 9acc6ea
Receiving device and config names works
BillThePlatypus 060b39a
Add getting and setting config via strings
BillThePlatypus d8eeedd
Refactoring to clean up
BillThePlatypus bb94581
Add more verbose error messages
BillThePlatypus 177dde9
Add option to specify default
BillThePlatypus 9ef24b5
Handle responses when setting a config
BillThePlatypus d240179
Add command for requesting configuration and device info
BillThePlatypus 4396f62
Rename /settings_write to /memory_write
BillThePlatypus 74fbdf1
Attach correct mavlink libraryclear
BillThePlatypus dc772e5
Merge branch 'battery_monitor' into config_manager
BillThePlatypus d863799
Merge branch 'master' into config_manager
BillThePlatypus c6f5124
Support calling devices by number
BillThePlatypus e9e62b9
Add message / service types for config_get
BillThePlatypus 7336455
Add config_list service, to show available configurations
BillThePlatypus 0cf567f
Add ability to rerequest config info if there are errors or interuptions
BillThePlatypus 2b7d63a
Throttle warning messages
BillThePlatypus 0394360
Small changes as recommended in Dan's review
BillThePlatypus 104c68a
Fix indentation in rosflight_io.cpp
BillThePlatypus b42c68c
Update mavlink
BillThePlatypus 5eac04a
Revert accidental whitespace changes
BillThePlatypus 0929d6e
Merge branch 'master' into config_manager
BillThePlatypus f572bd6
Get simulation working with config_manager
BillThePlatypus 563b89d
Add names for devices and configuration in the sil_board
BillThePlatypus 7d55cd0
Add better responses to configuration changes
BillThePlatypus b373388
Code cleanup
BillThePlatypus 0758f94
Use mavrosflight namespace properly to clean up code
BillThePlatypus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,3 +13,5 @@ | |
| *CMakeFiles* | ||
| *catkin_generated* | ||
| *Makefile | ||
| .idea/ | ||
| cmake-build-*/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule v1.0
updated
11 files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| #include <vector> | ||
| #include <future> | ||
| #include <chrono> | ||
| #include <string> | ||
| #include <utility> | ||
|
|
||
| #include "mavlink_listener_interface.h" | ||
| #include "mavlink_comm.h" | ||
|
|
||
| namespace mavrosflight | ||
| { | ||
|
|
||
| class ConfigManager : public MavlinkListenerInterface | ||
| { | ||
| public: | ||
| typedef struct | ||
| { | ||
| bool successful; | ||
| bool reboot_required; | ||
| std::string error_message; | ||
| } config_response_t; | ||
| ConfigManager(MavlinkComm *const comm); | ||
| ~ConfigManager(); | ||
| void handle_mavlink_message(const mavlink_message_t &msg) override; | ||
| std::tuple<bool, uint8_t> get_configuration(uint8_t device); | ||
| config_response_t set_configuration(uint8_t device, uint8_t config); | ||
| void request_config_info(); | ||
|
|
||
| std::tuple<bool, uint8_t> get_device_from_str(const std::string &name) const; | ||
| std::tuple<bool, uint8_t> get_config_from_str(uint8_t device, const std::string &name) const; | ||
| bool is_valid_device(uint8_t device) const; | ||
| bool is_valid_config(uint8_t device, uint8_t config) const; | ||
| std::string get_device_name(uint8_t device) const; | ||
| std::string get_config_name(uint8_t device, uint8_t config) const; | ||
|
|
||
| static constexpr std::chrono::milliseconds timeout{500}; | ||
|
BillThePlatypus marked this conversation as resolved.
Outdated
|
||
| private: | ||
| typedef struct | ||
|
BillThePlatypus marked this conversation as resolved.
Outdated
|
||
| { | ||
| std::promise<uint8_t> promise; | ||
| uint8_t device; | ||
| } config_promise_t; | ||
| MavlinkComm *const comm_; | ||
| std::vector<config_promise_t *> promises_; | ||
|
|
||
|
|
||
| typedef struct | ||
|
BillThePlatypus marked this conversation as resolved.
Outdated
|
||
| { | ||
| std::promise<config_response_t> promise; | ||
| uint8_t device; | ||
| uint8_t config; | ||
| } config_response_promise_t; | ||
| std::vector<config_response_promise_t *> config_response_promises_; | ||
|
|
||
| typedef struct | ||
|
BillThePlatypus marked this conversation as resolved.
Outdated
|
||
| { | ||
| std::string name; | ||
| std::string internal_name; | ||
| uint8_t max_value; | ||
| std::vector<std::string> config_names; | ||
| } device_info_t; | ||
| std::vector<device_info_t> device_info_; | ||
|
|
||
| void handle_config_message(const mavlink_message_t &msg); | ||
| void handle_device_info_message(const mavlink_message_t &msg); | ||
| void handle_config_info_message(const mavlink_message_t &msg); | ||
| void handle_config_response_message(const mavlink_message_t &msg); | ||
| void send_config_get_request(uint8_t device); | ||
| void send_config_set_request(uint8_t device, uint8_t config); | ||
|
|
||
| static std::string make_internal_name(const std::string &name); | ||
| static std::vector<std::string> get_words(const std::string &internal_name); | ||
| static bool is_uint8(const std::string &str); | ||
|
|
||
| }; // class ConfigManager | ||
| } // namespace mavrosflight | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.