LibrePilot Forum
Users => Vehicles - MultiRotors => Topic started 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.
- 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
-
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.
-
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
-
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.
-
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
-
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.
-
Yes, got it work. Thank you ;)
-
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?
-
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 ^^
-
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
-
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
-
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
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
-
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..
-
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 ?
-
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.
-
Again : Do you select the serial port (because you enabled VCP) to be used in GCS to connect the CC3D ?
-
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?
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.
-
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.
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.
-
Thank you:)
I fully understand now;)
-
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. :)
-
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.
-
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.