omen71

  • *
  • 6
UAVtalk with raspberry pi 3 - Transfer Rate Data of gyros
« on: April 02, 2017, 07:01:48 pm »
Hi librepilot forum,
I am working on a implementation of a LQR control algorithm for a quadcopter  on a raspberry pi 3 (python script), and i am using uavtalk protocol  and at the moment is working pretty fine; i want to know how can i change the rate of getting angle information (Roll, Pitch, Yaw). in this moment the rate transmition is of 7.7 Hz (  this is what i am getting: Rate: 7.7 Hz   RPY: -0.128027 0.442761 167.142838 ), but i need it faster; so, my question is how can i change that rate, for example to get 100Hz or more? is that posible?  (sorry for my bad english) :) :).

f5soh

  • *****
  • 3767
    • LibrePilot
Re: UAVtalk with raspberry pi 3 - Transfer Rate Data of gyros
« Reply #1 on: April 02, 2017, 07:46:03 pm »
You should use python scripts from current "next" branch :
https://bitbucket.org/librepilot/librepilot/src/524cba9279de11909c407392d239e40efd19d02f/python/examples/example.py?at=next

Search for "metadata.telemetryUpdatePeriod.value" inside the Python script or calling the script linked above with 'g' option will perform 'fast' updates.

Code: [Select]
. Rate: 573.9 Hz   RPY: 1.806945 -1.071952 35.777245 
  Rate: 573.9 Hz   RPY: 1.806574 -1.072041 35.776863 
. Rate: 573.9 Hz   RPY: 1.806574 -1.072041 35.776863 
  Rate: 573.9 Hz   RPY: 1.806684 -1.071899 35.776791 
. Rate: 573.9 Hz   RPY: 1.807000 -1.072035 35.776974 
  Rate: 573.9 Hz   RPY: 1.807177 -1.072139 35.776852 
. Rate: 573.9 Hz   RPY: 1.807177 -1.072139 35.776852 
  Rate: 573.9 Hz   RPY: 1.807606 -1.071944 35.776489 
. Rate: 573.9 Hz   RPY: 1.807914 -1.071627 35.776363 
  Rate: 573.9 Hz   RPY: 1.807914 -1.071627 35.776363 
. Rate: 573.9 Hz   RPY: 1.808044 -1.071301 35.776543 
  Rate: 573.9 Hz   RPY: 1.808405 -1.070637 35.777149 
. Rate: 573.9 Hz   RPY: 1.809851 -1.070818 35.777119

omen71

  • *
  • 6
Re: UAVtalk with raspberry pi 3 - Transfer Rate Data of gyros
« Reply #2 on: April 02, 2017, 09:26:39 pm »
You should use python scripts from current "next" branch :
https://bitbucket.org/librepilot/librepilot/src/524cba9279de11909c407392d239e40efd19d02f/python/examples/example.py?at=next

Search for "metadata.telemetryUpdatePeriod.value" inside the Python script or calling the script linked above with 'g' option will perform 'fast' updates.

Code: [Select]
. Rate: 573.9 Hz   RPY: 1.806945 -1.071952 35.777245 
  Rate: 573.9 Hz   RPY: 1.806574 -1.072041 35.776863 
. Rate: 573.9 Hz   RPY: 1.806574 -1.072041 35.776863 
  Rate: 573.9 Hz   RPY: 1.806684 -1.071899 35.776791 
. Rate: 573.9 Hz   RPY: 1.807000 -1.072035 35.776974 
  Rate: 573.9 Hz   RPY: 1.807177 -1.072139 35.776852 
. Rate: 573.9 Hz   RPY: 1.807177 -1.072139 35.776852 
  Rate: 573.9 Hz   RPY: 1.807606 -1.071944 35.776489 
. Rate: 573.9 Hz   RPY: 1.807914 -1.071627 35.776363 
  Rate: 573.9 Hz   RPY: 1.807914 -1.071627 35.776363 
. Rate: 573.9 Hz   RPY: 1.808044 -1.071301 35.776543 
  Rate: 573.9 Hz   RPY: 1.808405 -1.070637 35.777149 
. Rate: 573.9 Hz   RPY: 1.809851 -1.070818 35.777119

Thanks a lot friend, i will try that, i have other question after i run the code on the RPI when i try to connect the cc3d to the pc (on GCS librepilot ), I note that cc3d is in log state, i was looking how can a bring back to normal state and nothing works for me, do you know how can i bring it back (the cc3d) to the normality.

f5soh

  • *****
  • 3767
    • LibrePilot
Re: UAVtalk with raspberry pi 3 - Transfer Rate Data of gyros
« Reply #3 on: April 02, 2017, 10:00:02 pm »
You just need to disconnect the "USB:CopterControl" automatically connected when you plug the CC3D (this is the HID device) and connect the "Serial:COM#" same as you use with python script because you setup the VCP port as telemetry.

Automatic connection can be disabled inside the Tools > Options > General window.