-
Notifications
You must be signed in to change notification settings - Fork 33
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
MSPv2 support #28
MSPv2 support #28
Conversation
Can you rebase on the upstream master? I.e. resolve the conflicts. |
I think that did it |
Ok, merging would work now. But rebasing is still not possible: This branch cannot be rebased due to conflicts. |
Exactly what do you want to rebase onto what? |
Rebase your branch (
|
hmmm... thought I did that for this PR. I will try again... |
Rebased but not squashed. |
That's a lot of changes :-) This will take a while to review. But thanks for taking the time to make this PR for MSP2. I added some comments inline as a review. I still need to have a further look into the implementation and test it with my FC. Some general comments about the code style:
More general comments:
|
By the way, squashing the commits is not really required. If you add new commits, the timeline will get very chaotic and I will probably squash these commits anyway. You are however free to squash the commits as it makes sense to you (e.g. one commits for messages, one for communication, ...) and force push to this PR branch. |
I will let you finish going through the diffs before I start moving things. I'm fine with most of the changes suggested so far. The only one I have any real feelings on is the collapsing of multiple classes into a single file. I can do that, but I find that my life is easier when a class is defined in files of the same name, especially if I don't know a priori that the use of that class is limited to another class. This code should be MSPv1 compatible. Part of the initialization is identifying the MSP version. |
I had a further look. I think I am done with the code review for now.
I still hadn't the chance to test it with the FC. But let's first get the code in code shape and make decisions on some of the changes. |
I will reduce the chatter. It's leftover from debugging. |
Oh, there is technically a MSPv2 over MSPv1 pattern, but the library doesn't deal with that. |
There is this MSP2 over MSP1 encapsulation: https://github.com/iNavFlight/inav/wiki/MSP-V2#encapsulation-over-v1 but I don't think we need that. |
FlightController.cpp right around line 42. |
Ups. I accidentally deleted my review (over 50 comments) before submitting it. |
Ouch. All good. I'm working from the comments you put in this thread at the moment. |
So, I tried to recreate my comments. I was very brief this time and I probably forgot some. |
Most comments are actually just about the code style. I might add a clang-format file with my desired code format. However, there are some things that effect the behaviour and API of the library and that need to be resolved before merging.
|
So to address the functional concerns, I can move the stream operators, but I think the final form of the stream operators may be impacted by how we approach firmware variations in the messages. I may have broken MultiWii support, I definitely haven't done anything to validate it. The automatic generation of MSP messages is a double edged sword. It can absolutely present a fly-away condition. I did it though because by default the ROS joy_node will not send updates if the input sticks don't move. I think I can adjust that and get ROS joy to send at a fixed rate, which moves the problem out of this library. I might like to leave the method in the library, just for scientific purposes even if it doesn't get automatically enabled as part of selecting MSP control. Does that sound acceptable? The remaining outstanding question is what to do about the small handfull of messages which have different encodings between firmwares. I've been toying with the idea of making the message definitions have members matching the superset of all known fields across all firmwares. This means that the stream operators can work against a single definition, and some fields may just be unset if the particular firmware doesn't support it. The messages themselves could also have the firmware argument to the constructor removed. In order to get different packing/unpacking behavior in the messages, the encode/decode methods could be templatized with a
|
periodically sending of RC commands: different message definitions: |
I will pull out the automatic MSP methods. I think I need to comb through the code bases again and get an accurate count of the divergent messages. I did it before, but I for got the results. |
I've just about got the formatting changes done, so I started thinking about the issue of firmware variations. This may be a step too far, but what if the
|
What do you mean by:
The new |
To answer you question, yes. Everything that needs to be unique or special ends up in a class derived from |
Ok. If we want to separate the message definitions per firmware, we would need to put them in their own namespaces, e.g. However, for now, let's first merge the general MSP2 functionality to have the gross of the changes in place. |
that's a little cleaner now |
… msp::msg classes
…av -- compiles but untested
…t for classes with no unique print method.
…d a few structural issues
It's done! Finally! |
All of my changes.