QUB-ASL / bzzz

Quadcopter with ESP32 and RaspberryPi
MIT License
7 stars 1 forks source link

Process radio data in RPi #52

Closed patchedByBatman closed 1 year ago

patchedByBatman commented 1 year ago

Main Changes

  1. All of the radio data processing is now shifted to Python and will be carried out on Raspberry Pi.
  2. R-Pi sends processed data in the following format:
"S, Yaw rate in rad/s, Pitch in rad, Roll in rad, Throttle PWM in [1000, 2000], % Trim A, % Trim B, % Trim C, % Trim D, Encoded switches data"

The 'S' in the beginning is sent to indicate the start of the packet and is used to check for packet corruption at the ESP's end.

The "Encoded switches data" is an integer with encoded information about the position of radio switches A (Kill switch), B (Arm switch), C (Three-way switch), and D. The last 5-bits (rightmost 5-bits) of this correspond to the switch positions as follows:

  1. Some data checking code, such as whether the data is within the allowable range, might need to be adapted into the Python code from radio.cpp in #51 . This is done, but I am keeping it here for future reference.
  2. New addition: using threading in R-Pi receiver program and now the data is processed and sent at (roughly) 50Hz.

The status of addressing the posted issues in #48 is

Associated Issues

Note

As of now we do not know which of these fixed issue #28, but using this code along with a proper USB cable for serial data transfer instead of the physical pins fixed it. Might want to investigate in the future for the sake of making replicas.

alphaville commented 1 year ago

@gunturiCM ping us to review this after you test it

patchedByBatman commented 1 year ago

@gunturiCM ping us to review this after you test it

The testing is done. Please review the code. Might need peers to test as well.

jamie-54 commented 1 year ago

Looks good @gunturiCM, I think @alphaville has covered everything. When reviewing this it made realise we have an issue with RADIO_STICK_MIN RADIO_STICK_MAX but I made a new issue for it (#54)

patchedByBatman commented 1 year ago

The suggested changes have been done. Please have a look.

jamie-54 commented 1 year ago

Happy to merge

patchedByBatman commented 1 year ago

Merging into dev.