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

  • *****
  • 4572
    • 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

  • *****
  • 4572
    • 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.

sallyc

  • *
  • 47
Re: UAVtalk with raspberry pi 3 - Transfer Rate Data of gyros
« Reply #4 on: August 28, 2017, 04:47:56 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
Dear f5soh,
I now try to use next branch, and on the CC3D side I am using the firmware from next branch, too. Then I cannot change setting from current version 16.09 GCS anymore. Because it shows mismatch version fimware and the "save" button can not work properly in every page. I even cannot configure the vcp port to telemertry. But I still want to get a correct result like you did here from Pi...

f5soh

  • *****
  • 4572
    • LibrePilot
Re: UAVtalk with raspberry pi 3 - Transfer Rate Data of gyros
« Reply #5 on: August 28, 2017, 10:25:54 pm »
Looks normal, you cannot change settings in a board running a mismatched UAVO set.

The GCS need to match the firmware version.

sallyc

  • *
  • 47
Re: UAVtalk with raspberry pi 3 - Transfer Rate Data of gyros
« Reply #6 on: August 29, 2017, 01:50:36 pm »
Thanks for your replying. Now I understood. And this 'next' branch and 'next' firmware works fine for me now. I can set ManualControlCommand using the code.
But what I want to achieve is that I can first configure my FC by GCS, then take control from Pi using python code. So should I still use the next branch code?
« Last Edit: August 29, 2017, 01:57:15 pm by f5soh »

f5soh

  • *****
  • 4572
    • LibrePilot
Re: UAVtalk with raspberry pi 3 - Transfer Rate Data of gyros
« Reply #7 on: August 29, 2017, 01:56:52 pm »
If you want to use python, yes.

Current next build (windows): LibrePilot-16.09+r461-gd1ab06e_i686.exe
« Last Edit: August 29, 2017, 02:44:16 pm by f5soh »