LibrePilot Forum

Users => Vehicles - MultiRotors => Topic started by: alantwm on July 29, 2017, 06:03:36 am

Title: Controlling CC3D using Raspberry Pi 3
Post by: alantwm 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.


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

Thank you very much,
Alan
Title: Re: Controlling CC3D using Raspberry Pi 3
Post by: f5soh 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.
Title: Re: Controlling CC3D using Raspberry Pi 3
Post by: sallyc 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
Title: Re: Controlling CC3D using Raspberry Pi 3
Post by: f5soh 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.
Title: Re: Controlling CC3D using Raspberry Pi 3
Post by: sallyc 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
Title: Re: Controlling CC3D using Raspberry Pi 3
Post by: f5soh 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.
Title: Re: Controlling CC3D using Raspberry Pi 3
Post by: sallyc on August 07, 2017, 07:18:20 pm
Yes, got it work. Thank you ;)
Title: Re: Controlling CC3D using Raspberry Pi 3
Post by: sallyc 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?
Title: Re: Controlling CC3D using Raspberry Pi 3
Post by: f5soh 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 ^^
Title: Re: Controlling CC3D using Raspberry Pi 3
Post by: sallyc 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
Title: Re: Controlling CC3D using Raspberry Pi 3
Post by: sallyc 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
Title: Re: Controlling CC3D using Raspberry Pi 3
Post by: f5soh 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
Title: Re: Controlling CC3D using Raspberry Pi 3
Post by: sallyc 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..
Title: Re: Controlling CC3D using Raspberry Pi 3
Post by: f5soh 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 ?
Title: Re: Controlling CC3D using Raspberry Pi 3
Post by: sallyc 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.
Title: Re: Controlling CC3D using Raspberry Pi 3
Post by: f5soh on August 26, 2017, 02:04:00 pm
Again : Do you select the serial port (because you enabled VCP) to be used in GCS to connect the CC3D ?
Title: Re: Controlling CC3D using Raspberry Pi 3
Post by: TheOtherCliff on August 26, 2017, 06:06:51 pm
There is what appears to me to be a bug in CC3D.  I can't take set up simple ComBridge to FlexiPort.  It tries to boot 3 times and then boots up with a default.  Possibly a stack size problem.  CC3D is low on RAM.  I recall that the RAM settings got tweaked to fix something and it may have broken this?

Quote
I have to erase and upgrade firmware again.

When you configure the USB connection to be something besides GCS telemetry connection it can seem that you are stuck there and cannot set it back the way it was.

With no external power or USB connected to FC (CC3D) go to Firmware page and press Rescue.  Then plug in USB.  After a few seconds you will have a couple options that can help you:
- Erase Settings will set settings back without re-flashing firmware
- Safe Boot will boot up with default settings.  Use this and set the USB connection back to GCS telemetry or make whatever other changes you want.
Title: Re: Controlling CC3D using Raspberry Pi 3
Post by: f5soh on August 27, 2017, 01:09:59 pm
Quote
There is what appears to me to be a bug in CC3D.  I can't take set up simple ComBridge to FlexiPort.

Sorry, this is not a bug.
You simply try to run Combridge that need ~1.64Kb of memory while there is 1.37Kb left.
Remove the Telemetry from MainPort and Combridge will run fine in Flexiport.
When you configure Combridge in MainPort in fact you remove the default Telemetry and all is ok.

Quote
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..
Back to topic.
After the board is configured with VCP and rebooted/reconnected to the USB port, the GCS still trying to connect to the device using HID because the option "Automatically connect a compatible USB device" option is checked. That's the default behavior.
(https://forum.librepilot.org/index.php?action=dlattach;topic=3691.0;attach=6623)

So at this point the board is connected using HID but telemetry goes to serial VCP.
GCS send requests (one Tx bar), but no response:
(https://forum.librepilot.org/index.php?action=dlattach;topic=3691.0;attach=6625)

You may need to disconnect HID using the "Disconnect" button, this take a few seconds because GCS is waiting a timeout.

And finally connect the serial device you configured with Telemetry over VCP:
- Select/Choose the FC's serial device like "Serial:/dev/ttyACM0" (linux) or "Serial:COM##" under Windows.
- Click the Connect button

Now you are retrieving the Telemetry over VCP as expected and Hardware page is fine.
(https://forum.librepilot.org/index.php?action=dlattach;topic=3691.0;attach=6627)

The "Automatically connect a compatible USB device" option can be disabled to avoid HID disconnect timeout but next time you do a Upgrade&Erase you still need to connect the board manually.
Title: Re: Controlling CC3D using Raspberry Pi 3
Post by: sallyc on August 28, 2017, 02:17:11 pm
Thank you:)
I fully understand now;)
Title: Re: Controlling CC3D using Raspberry Pi 3
Post by: sallyc on August 28, 2017, 05:34:34 pm
But there is still ERROR:root:CRC ERROR rasing, Here I am using the code from https://bitbucket.org/alessiomorale/librepilot, and the branch amorale/lp_python_porting.
I saw your other answer from https://forum.librepilot.org/index.php?topic=3287.0, then tried what you said and post my question there. :)
Title: Re: Controlling CC3D using Raspberry Pi 3
Post by: f5soh on August 28, 2017, 10:30:30 pm
I fully understand now;)

Thanks, that's why i asked for serial connection since 3 posts :)

amorale/lp_python_porting is old stuff, you should use the next branch where the last python progress is merged and 'more' tested.
Title: Re: Controlling CC3D using Raspberry Pi 3
Post by: jcg1541 on November 26, 2017, 10:40:18 am
Hi Friend, Can you share your project concepts with autonomous drone?

Good drone autonomous application concepts are sparse. Military attack or reconnaissance ,  industry hazardous inspection drone , personal photographing. And that is pretty much all.


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.