Hi,

I am working on an addition to APM that manages a data connection via a DroneCell or other cellular modem. It maintains control of the mobile and checks the state of the connection, instead of just putting it into transparent mode and hoping everything will be OK.

It has worked fine under ArduPlane 2.68. Now I am trying to integrate it into 2.70 while preparing for some finishing touches like being able to work with several different cellular modules.

I am running into a problem with the current design of the APM code, which I think will only get worse in the future, as we will probably have even more possibilities for data connections - on-board IP stack, 3 and 4G, etc.

The problem is that the concern of basic I/O is mixed with that of printing strings. This forces one to make more specializations for the different hardware and simulation platforms that may be necessary. I have made an UML, existingDesignWithAdditions.pdf, that shows the current layout with addition of my MobileDriver which is again made to work with 2 different modems. The need to support printing in basically all streams results in a (too) large number of subclasses for the different platforms.

In eg. Java the concern of printing character stuff is separated from that of doing I/O. That is quite nice - you can combine any I/O stream with any character printer, or with none at all. Could this be done here too?

I have put together the UML newDesign.pdf to illustrate (some trivial methods were omitted). Stream does not inherit from Print, and BetterStream basically is renamed to BufferedIOStream. To print, one makes a PrintStream with a reference to the BetterStream (could strictly just habe been a Stream). PrintStream implements the interface of BufferedIOStream but just forwards all non-print messages to its stream. For the platform specifics of printing, concrete subclasses of PrintStream for each platform exist.

Now things are orthogonal and the subclass explosion is gone.

Would there be anything in the way of using this design? OK I have only checked with ArduPlane. Is there some Arduino interface for streams that say they must have printf, and is it necessary to stick with that?

I'd happily implement it - just need to be on the developer list first... :)

Regards

Soren

existingDesignWithAdditions.pdf

newDesign.pdf

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • Developer

    The printf family of functions with formatted text messages are very costly on a 8-bit AVR processor (even to some degree on 32-bit ARM), and should be avoided at all cost when doing real time communications. It's mostly there to support the CLI mode.

This reply was deleted.

Activity

DIY Robocars via Twitter
23 hours ago
DIY Robocars via Twitter
RT @SahikaGenc: AWS DeepRacer & Hot Wheels Track https://youtu.be/4H0Ei07RdR4 via @YouTube
Sep 14
DIY Robocars via Twitter
Sep 8
DIY Robocars via Twitter
RT @davsca1: We are releasing the code of our Fisher Information Field, the first dedicated map for perception-aware planning that is >10x…
Sep 8
DIY Robocars via Twitter
RT @SmallpixelCar: How this works: 1)object detection to find cones in single camera image, 30 frames/sec on @NVIDIAEmbedded Xavier. 2)comp…
Sep 8
DIY Robocars via Twitter
RT @SmallpixelCar: Use two color cones to guide the robocar. No map needed, on onsite training needed. Just place the cones and it will fol…
Sep 7
DIY Robocars via Twitter
Sep 7
DIY Robocars via Twitter
RT @roboton_io: Great to see http://roboton.io running at 60fps on the cheapest #chromebook we could find! #edtech #robotics #educat…
Sep 3
DIY Robocars via Twitter
RT @openmvcam: Crazy in-depth article about using the OpenMV Cam for Astrophotography: https://github.com/frank26080115/OpemMV-Astrophotography-Gear https://t.co/BPoK9QDEwS
Sep 3
DIY Robocars via Twitter
RT @openmvcam: Hi folks, it's finally here! Our first draft of our Arduino Interface Library is out! It works over SoftwareSerial, Hardware…
Sep 3
DIY Robocars via Twitter
RT @chr1sa: Please let them have an open API. This would be perfect for @DIYRobocars races https://twitter.com/NintendoAmerica/status/1301513099707658246
Sep 3
DIY Robocars via Twitter
RT @SmallpixelCar: Lanenet pretty much used all my GPU power on @NVIDIAEmbedded Xavier since I optimized with tensorRT. I need to run anoth…
Sep 3
xemone liked Max Gilson's profile
Aug 31
DIY Robocars via Twitter
RT @LyftLevel5: Our @kaggle competition on Motion Prediction for Autonomous Vehicles is now live! Experiment with the largest-ever self-dri…
Aug 24
DIY Robocars via Twitter
RT @chr1sa: Our next @DIYRobocars virtual AI car race will be on Sept 26th. Sign up here https://www.meetup.com/DIYRobocars/events/272786977/ https://t.co/UENKGSOWO8
Aug 24
DIY Robocars via Twitter
New ready-to-run @NVIDIAEmbedded JetRacer car from Waveshare. Perfect for the next @diyrobocars race as soon as we… https://twitter.com/i/web/status/1297960223013867520
Aug 24
More…