basecamelectronics / sbgc-api-examples

A very basic SimpleBGC Serial API examples and libraries. This version is outdated and not supported. A new fully-featured version you can find in the 'sbgc32-serial-api' repository.
BSD 2-Clause "Simplified" License
81 stars 48 forks source link

Examples version for Ubuntu/Linux? #9

Open Kumaron opened 5 years ago

Kumaron commented 5 years ago

I've tried many times to implement serial control using the libraries, but always ended up with SerialException device reports readiness to read but returned no data (device disconnected?) Would you like to give examples that can run successfully in Ubuntu?

Kumaron commented 5 years ago

I'm using ROS in Ubuntu to try to implement the serial control.

elihunter173 commented 5 years ago

What my team ended up doing was using unix file descriptors, which we configured as serial ports. It was then trivial to implement read and write using the corresponding read and write procedures. For getting the number of bytes, we used ioctl with FIONREAD along with select to prevent a race condition. That ended up allowing us to have a fully functioning com object for the parser. We are still ironing out some difficulties, but from what we can tell our core com object works perfectly.

I'm sorry for more or less just doing a link dump right now. Sadly right now our codebase isn't in a state where it is ready to be open sourced. However, once it is (probably within the next month or two), we plan to open source it! If I remember, I can drop a link here when I do.

bugraaydogar commented 3 years ago

Hi @elihunter173 ,

It has been a long time since your last comment, is the mentioned library finalized and available as open-source somewhere?

elihunter173 commented 3 years ago

Hi @bugraaydogar !

No sadly the project got dropped and never finished. I was doing the work with an undergraduate aerial robotics club and during development the plane crashed and the gimbal hardware was damaged. When we ordered replacement gimbal hardware, we ended up not using the same gimbal (we switched to the storm32 gimbal), so development was halted.

maiermic commented 2 years ago

FYI I'm using Python on Linux Mint to control my gimbal connected via USB (see example). I'm using pySerial to connect to the gimbal:

connection = serial.Serial('/dev/ttyUSB0', baudrate=115200, timeout=10)