Controlling CC3D using Raspberry Pi 3
« on: July 29, 2017, 06:03:36 am »
Hello Everyone,

I realize that this question has been asked before but I'm having trouble making it work.
My intention is to build an autonomous quadcopter that I can control using python scripts. My intention is to use the Raspberry Pi 3 as an interface between my computer/smartphone and the CC3D or to run the scripts on the RPi3 directly.

  • Many posts I find on this forum utilize serial connection between the RPi3 and CC3D. I'm wondering if its possible to utilize a USB-microUSB port to send the control signals to the CC3D?
  • I thought it'd be a good start to receive telemetry signals from the CC3D. I am able to see those signals when using the LibrePilot GCS, but I'd like to access these values directly so it can be used within a Python script. To this, I attempted to follow the tutorial shown in this post: https://forum.librepilot.org/index.php?topic=749.msg11840#msg11840. I git cloned the librepilot source code, and tried to run the pyuavtalk.py example using port /dev/ttyAMA0 but it doesn't work. I suspect this is because that post is not using the USB connection.

I would really appreciate a little help on making this work.

Thank you very much,
Alan
« Last Edit: July 29, 2017, 12:49:21 pm by f5soh »

f5soh

  • *****
  • 3923
    • LibrePilot
Re: Controlling CC3D using Raspberry Pi 3
« Reply #1 on: July 29, 2017, 12:48:52 pm »
Quote
tried to run the pyuavtalk.py example using port /dev/ttyAMA0 but it doesn't work. I suspect this is because that post is not using the USB connection.

Answer is some posts after, in the same thread:
https://forum.librepilot.org/index.php?topic=749.msg12347#msg12347

In example.py file you will be able to find something driving a servo with ActuatorCommand, the same should be done for ManualControlCommand.

sallyc

  • *
  • 27
Re: Controlling CC3D using Raspberry Pi 3
« Reply #2 on: August 04, 2017, 07:38:47 pm »
I am doing the exactly the same thing, and I didn't have /dev/ttyACM0 port on my Pi 2. So still waiting forever.

Can you tell me if you have any progress? Thank you

f5soh

  • *****
  • 3923
    • LibrePilot
Re: Controlling CC3D using Raspberry Pi 3
« Reply #3 on: August 04, 2017, 11:12:22 pm »
Maybe use the right serial name, search using 'dmesg' for some /dev/ttyXXX added after you connect the device previously configured for telemetry over VCP.

Can be ttyACM0, ttyUSB0, ttyAMA0... depend the Linux system you are running.

sallyc

  • *
  • 27
Re: Controlling CC3D using Raspberry Pi 3
« Reply #4 on: August 05, 2017, 03:39:28 pm »
I think CC3D does not have VCP port, i can only see main port, flexi port, input and output port from my board. So i only configured my main port to telemetry and connect it to pi. Does this work?

Thank you

f5soh

  • *****
  • 3923
    • LibrePilot
Re: Controlling CC3D using Raspberry Pi 3
« Reply #5 on: August 05, 2017, 07:48:11 pm »
VCP mean Virtual Com Port, this provides a serial port over USB connection. (If VCP is configured with Telemetry)
Talking with UavTalk telemetry using Flexi or Main port will work the same.

sallyc

  • *
  • 27
Re: Controlling CC3D using Raspberry Pi 3
« Reply #6 on: August 07, 2017, 07:18:20 pm »
Yes, got it work. Thank you ;)

sallyc

  • *
  • 27
Re: Controlling CC3D using Raspberry Pi 3
« Reply #7 on: August 11, 2017, 09:03:54 pm »
And another question,  in this example code, I can receive the object data. can I somehow set the object data and send back to CC3D?

f5soh

  • *****
  • 3923
    • LibrePilot
Re: Controlling CC3D using Raspberry Pi 3
« Reply #8 on: August 12, 2017, 12:21:40 am »
Quote
In example.py file you will be able to find something driving a servo with ActuatorCommand, the same should be done for ManualControlCommand.

The answer is in first reply ^^

sallyc

  • *
  • 27
Re: Controlling CC3D using Raspberry Pi 3
« Reply #9 on: August 25, 2017, 03:43:56 pm »
Maybe use the right serial name, search using 'dmesg' for some /dev/ttyXXX added after you connect the device previously configured for telemetry over VCP.

Can be ttyACM0, ttyUSB0, ttyAMA0... depend the Linux system you are running.
well. i can get telemetry data from vc usb port. But from the main port. i cannot find my device using dmesg command...
Any hint for me?

Thanks
Sally

sallyc

  • *
  • 27
Re: Controlling CC3D using Raspberry Pi 3
« Reply #10 on: August 25, 2017, 04:29:12 pm »
Quote
In example.py file you will be able to find something driving a servo with ActuatorCommand, the same should be done for ManualControlCommand.

The answer is in first reply ^^
yep~
thank you that i can set the data to manualcontrolmannd via this code. but everytime i read or set the uav object from cc3d on pi side, it always cause one problem when i connect my cc3d back to gcs. it's that no RX signal, only tx signal...
so i have to upgrade and erase firmware everytime i read the data from cc3d from pi..
do you know why this happened?

Thanks
Sally

f5soh

  • *****
  • 3923
    • LibrePilot
Re: Controlling CC3D using Raspberry Pi 3
« Reply #11 on: August 25, 2017, 04:53:45 pm »
Quote
But from the main port. i cannot find my device using dmesg command...
Seems you are using the Pi3 internal uart connected to MainPort? You may known his name or search in /dev/* and boot logs

Quote
it always cause one problem when i connect my cc3d back to gcs. it's that no RX signal, only tx signal...
Did you reconnect using the serial port ? By default the GCS reconnect using Hid, you can change the auto-connect in Options

sallyc

  • *
  • 27
Re: Controlling CC3D using Raspberry Pi 3
« Reply #12 on: August 26, 2017, 01:07:05 pm »
no, I am using Pi2, and if i use main port for uart then when i run example code i am waiting forever.
So I use the VCP usb port for uart, if I connect my cc3d to pi via VCP usb port like you said before, i can receive data but with ROOT CRC ERROR. Then i connect my cc3d back to my computer via usb port, in GCS there is always no RX data so I have to earase and upgrade firmware again..
« Last Edit: August 26, 2017, 01:19:31 pm by f5soh »

f5soh

  • *****
  • 3923
    • LibrePilot
Re: Controlling CC3D using Raspberry Pi 3
« Reply #13 on: August 26, 2017, 01:19:02 pm »
Pi2 or Pi3 your issue is same. Where you connect the Mainport ?

When you connect the CC3D back to the computer, do you select the serial port to be used for connection ?

sallyc

  • *
  • 27
Re: Controlling CC3D using Raspberry Pi 3
« Reply #14 on: August 26, 2017, 01:37:04 pm »
I connect the mainport to GPIO pin. and when I connect cc3d back to GCS, it shows connect but no hardware tab. so I cannot select anything. I think this is because when I run example code on pi side it raise root error crc error.
« Last Edit: August 26, 2017, 02:04:30 pm by f5soh »