Welcome to the Robolink Community forum!
Basic Questions about CoDrone Pro Drones...been struggling to get started
Hi - I purchased a classroom set of the CoDrone Pro drones and am trying to understand basic setup, pairing, and flying to get my 9th grade students going. We are trying to use Python to program the drones and students all downloaded both Python 3.8 and PyCharm in class earlier this week. Here are some of my problem areas:
Pairing: I've tried to use the "pair()" command and then physically label the remote control and drones together. My pairing sequence has basically been to plug in serial cable between computer and remote control (with DIP switches all in down position), install battery in drone and wait for pairing...which usually happens in several seconds. This process works fine when it's only me in the classroom. When I have several students doing this simultaneously, we have problems pairing. Our class room is roughly 25' x 40' and we had 5 drones spread out yesterday and during entire class, we were only able to successfully pair 1 of the 5 drones. Any suggestions? I figured out how to get the 4 digit unique ID for each drone, but not sure how to use it since pairing seems to occur automatically as noted above when I plug in the remote control and add battery to drone. Why does there need to also be a "pair()" statement in the Python code?
Another basic question: If I'm strictly just using the bluetooth portion of the remote control, and have the remote control serially connected to the computer, does the remote control really need AA batteries? Seems like I was able to pair, upload and execute the program on the drone several times yesterday without batteries in the remote control.
Loading the Python program: After pairing, I've been attempting to run some of the sample programs you provided in the "Flight Movements" on-line web page. After about 30s, sometimes the drone takes off and executes the programs fine. Some other remote control/drone combinations despite pairing right away never take off, though the Python program runs fully with no errors. I'm confused on the basic sequence for loading a Python program. There is a YouTube Video "Uploading Flight Controller Program" that discusses loading with left most DIP switch in up position. Is that what I should be doing? The video is focused on uploading through Arduino IDE and we're attempting to use Python, so I'm confused. Just looking for basic step-by-step sequence when uploading a program to drone through the PyCharm IDE.
There seems to be wide variation in drone performance: Though most drones run the self-calibration fine, when running one of the sample "flight movement" programs, some drones still behave erratically (even when running calibration just prior to executing program). Makes me think something is not right maybe in the program uploading process (problem with bluetooth board?).
Anyway, lots of problems just getting started....any help you can provide is much appreciated.
@bmartin_ascte Also beware of areas in the school where there may be lots of interfering network signals. It might be why some areas are having better luck than others!
@robolink_leila . Thanks! I've tried these changes you suggested and they do seem to solve the COM3 port problem. Going forward, we'll call out the COM port in our pairing statements, along with the drone ID! Definitely appreciate your quick response. Our students that have been flying already are really enjoying the coding and flying experience. This should fix the issues for those that haven't yet been able to fly consistently.
@bmartin_ascte For the pairing issues, try updating to the latest version of the CoDrone library. Go into PyCharm's package manager and select the CoDrone library. Specify the latest version (1.2.8) and install that one. For your COM port issue, I recommend opening the device manager and figuring out which port the drone is connected to. PyCharm might try and connect to other ports that the drone isn't connected to so you may need to specify that port in the pair function:
Let me know if you have any questions!
3/16 Successes and Failures...appreciate your feedback!
I've implemented your recommendations but my classes are still having mixed success in just getting pairing and program loaded consistently. Our basic sequence is:
- Develop python code in pycharm, including use of either drone.pair() or drone.pair("ID#").
- Place battery into drone and plug serial cable into computer and BLE board.
- Run python code
Sometimes, all it takes is the above to get it to takeoff. However, at least half of the time, the program comes back saying it cannot find the drone. We try an array of different things like removing/re-seating battery, unplug/re-mating serial cable at computer, pushing reset button BLE board. Occasionally one of these actions works and once it pairs and loads one time, it seems easier to pair and load again.
My classroom size is ~30ft x 15ft and I'm limiting to 5 drones/class. I'm still having to take 3 groups outside of the class to other areas of the school to isolate them. Not sure if this is necessary, but sometimes they're able to fly in other parts of the school but not in our classroom. Seems strange.
One thing we've noticed is that when the code starts running and says it's on COM3 port, it doesn't connect. The port number seems to have major influence on whether it pairs and loads the program. Sometimes I plug in a remote control and run the program and it says COM21 or COM13, or COM23....usually it pairs and flys in this case. Other times I plug in remote control and it stays on COM3....it never pairs in this case. Not sure what is causing the COM port selection. I'm just running the same python code each time. Do you know if there's a setting in PyCharm (or on my computer) that needs to change? Haven't found it so far?
In general, we are having more success than we initially were, so I think we're on the right path. If we could just figure out the COM port situation and how to get away from COM3.
Ok great, we'll try that also! Thanks for the quick responses today. This should put on the path toward getting them consistently pairing, python code loaded and executed.
Thanks Leila. I'll work through your recommendations after school today, such that we have more consistent pairing and loading experiences tomorrow. Some students were able to get their drones flying using the sequence we'd kind of figured out, but it's definitely nice to have your response on this! Regarding the paring to a specific ID, I'm getting an error message back when I enter the 4 digit ID:
Any suggestions on how to resolve? Also, if the 4 digit ID starts with a "0", I've noticed there are errors in code. For example, for ID 0013, should I just use "13" for the ID?
Hi @bmartin_ascte ,
Thanks for your questions! For Python, you will only need the BLE board. Make sure the other 4-pin cable (UART cable) is disconnected from the SmartInventor board. Only your MicroUSB needs to be connected to the BLE board. You do not need AA batteries unless you are using the remote control to fly using the joysticks. In that case, the BLE needs to be reconnected with the SmartInventor board.
The first time you pair, you will need to use
pair(drone.Nearest)with one drone and BLE board at a time. Once you have labeled the two, rerun the code again with just
pair()and verify that the device can pair with that drone. Then, turn off that drone/board pair and repeat with the next pair. We recommend doing this on your own without the students. In class, instruct students to always use
pair()without the Nearest parameter. You can also pair using the ID like this:
pair("1234")if the student knows the ID of their drone. This will prevent pairing issues and students pairing to someone else's drone and undoing all of the work you did to pair them!
As for drone performance, always check for debris in the motors, calibrate, and charge the batteries. This will affect the reliability.
Once you make these changes, let me know if this helps!