- Posts: 1891
HontaiTec Quadcopters (HT F801, HT F803,...)
- hexfet
- Offline
Only way to know for sure is to look at the received dataDurete wrote: Just tested the emulator (very interesting thing )
I can't see any strange behaviour. According the emulator is sending the right packet always, but in real world is not right
Why is the quad behavior different when the trims are fixed at 0 compared to when they are calculated to be 0? Packet timing? Some kind of packet corruption before it leaves the radio? I can't think of anything that seems very likely (which sometimes means missing something obvious).
Please Log in or Create an account to join the conversation.
- greenfly
- Offline
hexfet wrote: Thanks for testing We could stop here if we fix the trims to zero. If y'all are up for more investigation here's what I'm thinking. I'm fine with either choice.
Summarizing:
1) Setting channel and trim data in packet to fixed values sends "20 20 20 00 00 00" to receiver and results in no drift.
2) Setting channel data based on centered sticks and fixing trim values to zero sends "20 20 20 00 00 00" to receiver and results in no drift.
3) Setting channel and trim data based on centered sticks to "20 20 20 00 00 00" results in yaw drift.
If there's a problem it seems likely to be in the trim values being sent. Not sure what I'm missing because the trims look correct, at least with my emulator build. Durete, can you build the emulator (with the driven trims) and verify that #3 is true for your build? Greenfly you might want to try the same and make sure the result is the same. The emulator will print the packet data.
Next step would be back to a receiver capture to verify the correct data at the receiver.
I'm happy with the latest builds. What are the drawbacks with going with what we've got?
Please Log in or Create an account to join the conversation.
- greenfly
- Offline
greenfly wrote: What are the drawbacks with going with what we've got?
I guess I just don't understand the implications of the data-driven trims. That's ok... I'll get it in time. Anyway, I am ready to do receiver-side captures. I left the wires sticking out of the quad so I could fly it and/or analyze it.
Can you provide a description of what you would like me to capture?
Please Log in or Create an account to join the conversation.
- Durete
- Topic Author
- Offline
- Posts: 610
@greenfly, since you have the receiver cables attached yet to your module, will be great if you can provide a receiver capture, I should fully disassembly mine to take this captures
-You need to install my previous build with driven trims (RC With Trims build)
-Try to fly your F803 and confirm you have yaw drift (I have on mine, but very minor)
-Remove props, and take some SPI captures with only throttle applied (don't touch rudder stick).
Decoding this captures we will see what's the data packet received causing the very minor yaw drift.
Please Log in or Create an account to join the conversation.
- greenfly
- Offline
Please Log in or Create an account to join the conversation.
- Durete
- Topic Author
- Offline
- Posts: 610
I can't take a look now, because I'm at job.
Probably Hexfet will take a look before me.
Please Log in or Create an account to join the conversation.
- greenfly
- Offline
4.895263 > RX_PAYLOAD 61 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 => 40 0b 00 00 4a 20 20 20 00 ff 00 0b c5 00 0a c5 91 2b 80
Because it does not look like 20 20 20 0 0 0....
Please Log in or Create an account to join the conversation.
- Durete
- Topic Author
- Offline
- Posts: 610
greenfly wrote: Is this what we are looking for?
4.895263 > RX_PAYLOAD 61 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 => 40 0b 00 00 4a 20 20 20 00 ff 00 0b c5 00 0a c5 91 2b 80
Because it does not look like 20 20 20 0 0 0....
Right!
This is the faulty packet causing yaw drift
Please Log in or Create an account to join the conversation.
- hexfet
- Offline
- Posts: 1891
Need to fix the tx power adjustment too. Probably not doing it correctly considering the xn297 emulation.
Almost there
Please Log in or Create an account to join the conversation.
- goebish
- Offline
- I Void Warranties
- Posts: 2631
Please Log in or Create an account to join the conversation.
- Durete
- Topic Author
- Offline
- Posts: 610
Now we know where is the problem and we are not walking with blind eyes
Thank you'all guys for your work, I have learn a lot at this thread
Please Log in or Create an account to join the conversation.
- greenfly
- Offline
hexfet wrote: The rounding logic is still not correct. I'll take a little time to get it right. It's working as intended for the channels, which is why they're all at 20, but in the trims if the mixer output is just barely less than zero it gets rounded the wrong way. Missed something obvious.
I was wondering if the integer math is throwing it off. Is FLOAT available? I can write a function that will work if I can store a float value.
s32 scale_channel(u8 value, s8 rangeA, s8 rangeB)
{
s32 result = 0;
float offset = (float)(value - CHAN_MIN_VALUE) / (float)CHAN_RANGE;
if (rangeA > rangeB)
result = (s32)(rangeA - (offset * (rangeA - rangeB)));
else
result = (s32)((offset * (rangeB - rangeA)) + rangeA);
return result;
}
I'm not sure how to do the calculation with just integer math.
(p.s) Sorry if I'm off by a long shot... it's been a while since I did any C... I'm a C# developer these days.
Please Log in or Create an account to join the conversation.
- greenfly
- Offline
static s8 scale_channel(u8 ch, s8 rangeA, s8 rangeB)
{
if (rangeA > rangeB)
return rangeA - ((Channels[ch] - CHAN_MIN_VALUE) * (rangeA - rangeB) / CHAN_RANGE);
else
return ((Channels[ch] - CHAN_MIN_VALUE) * (rangeB - rangeA) / CHAN_RANGE) + rangeA;
}
I can build, but not test until I get home from work.
Please Log in or Create an account to join the conversation.
- hexfet
- Offline
- Posts: 1891
I've pushed code that has a scaling function that produces the desired results. I couldn't get to working code completely by working out the math so it's a little hacky. The pushed code has the driven trims, but it's really up to y'all with the quads to say whether it's worth leaving in. Does it make the quad "better"?
The tx power issue should be fixed. I was using NRF24L01_SetPower to change the power but not initialize it so the internal variable used by that function and SetBitrate was not being initialized. I changed the init code to use both these functions.
Please Log in or Create an account to join the conversation.
- greenfly
- Offline
Do any other modules that you know utilize floats? I could not find any.
Anyway, I will build the latest code from your repo and begin testing again. Did you want me to capture the data packets again with the new build?
Please Log in or Create an account to join the conversation.
- Durete
- Topic Author
- Offline
- Posts: 610
Now is perfect, and rates seems to be a little bit improved with driven trims.
I can't test properly the power output setting, since here is night and now I'm at home, but at least when you change the power output the quadcopter doesn't loose bind, so probably is right now.
Tomorrow morning maiden flight outside with my Devo!
Hats off to you sir!
Please Log in or Create an account to join the conversation.
- Durete
- Topic Author
- Offline
- Posts: 610
www.dropbox.com/s/caejml2p1vwio7f/deviation-devo7e-RC2.zip?dl=0
Please Log in or Create an account to join the conversation.
- hexfet
- Offline
- Posts: 1891
Won't need any captures unless the drift is still there
Please Log in or Create an account to join the conversation.
- greenfly
- Offline
Great job Hexfet... thanks for all of your time and help!
Please Log in or Create an account to join the conversation.
- Durete
- Topic Author
- Offline
- Posts: 610
greenfly wrote: The latest build looks good. No drift. Smooth flying. I think we have got it.
Great job Hexfet... thanks for all of your time and help!
Did you noticed any improvement on rates over stock TX? I think they are a little bit improved, so driven trims is working in this model
I finally tested the power output setting using my own home range test (Quadcopter inside Microwave oven ) and I think is working now.
Please Log in or Create an account to join the conversation.
- Home
- Forum
- Development
- Protocol Development
- HontaiTec Quadcopters (HT F801, HT F803,...)