Code Monkey home page Code Monkey logo

cyrillkuettel / ecstatic-pilot Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 0.0 401.86 MB

Navigation software for autonomous robot. Real-time object detection using high-performance neural network inference computing framework. To communicate with microcontroller, text-based bluetooth communication. Progress of the roboter is shown on Website: We communicate with the server using websockets https://github.com/cyrillkuettel/rover/

Java 1.29% CMake 2.26% C++ 86.50% C 8.95% Shell 0.01% Kotlin 1.01%
android computer-vision classic-bluetooth nanodet ncnn ndk websockets opencv-mobile pren

ecstatic-pilot's Introduction

Hi, I'm Cyrill

GPP Key
-----BEGIN PGP PUBLIC KEY BLOCK-----
mDMEYwFihRYJKwYBBAHaRw8BAQdAkSj5mBuWGlfjgR6ucD5K/LvYaNHyeJcsi1OY
h6M5Wfi0KEN5cmlsbCBLw7x0dGVsIDxjeXJpbGxrdWV0dGVsQGdtYWlsLmNvbT6I
kAQTFggAOBYhBAOq5wqk1Z+N+GLa7gON7lENPEliBQJjAWKFAhsDBQsJCAcCBhUK
CQgLAgQWAgMBAh4BAheAAAoJEAON7lENPEliyPgA/13VtJ3YnBKYa91nBK2PRxmc
X3qFPjz7R7zF1u7uuDDFAP0TZ6Oc6f7IZxCAAVFr41/UfLUsF++yT6LBbdf0P1xX
A7g4BGMBYoUSCisGAQQBl1UBBQEBB0DN/+3hPk806s84jGsCS7rKyjk0JW077Y64
wTntEjh6GwMBCAeIeAQYFggAIBYhBAOq5wqk1Z+N+GLa7gON7lENPEliBQJjAWKF
AhsMAAoJEAON7lENPEliybkA/2HfFY2q+DtRGp0zy4fOkpsdQAOlN0wYpQkKKQms
/PZTAQDokJrClXVqIK8eRhOIN6SqmWH2lwSWJ7qCtBOuUhJlCg==
=ABjf

-----END PGP PUBLIC KEY BLOCK-----

Email cyrillkuettel [at] gmail.com

The programmer, like the poet, works only slightly removed from pure thought-stuff. He builds his castles in the air, from air, creating by exertion of the imagination. Few media of creation are so flexible, so easy to polish and rework, so readily capable of realizing grand conceptual structures... Yet the program construct, unlike the poet's words, is real in the sense that it moves and works, producing visible outputs separate from the construct itself. โ€” Frederick P. Brooks, The Mythical Man-Month: Essays on Software Engineering

ecstatic-pilot's People

Contributors

cyrillkuettel avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

ecstatic-pilot's Issues

Recover from unexpected bluetooth serial IO Error / disconnect

Current State

In some rare cases, the Serial Bluetooth connection has disconnected in the past. Why exactly this happens can be hard to determine, I haven't been able to reproduce this bug. The problem is most likely the microcontroller. (Hardware problem ;)
If that ever happens during tournament, I want to have backup plan. Too much depends on this connection.

Solution

Backup Plan: Recovery

Implement a recovery sequence that starts if the Bluetooth connection drops.

  1. Pop the TerminalFragment from the backstack,
  2. This results in coming back to the previous Fragment and then it should automatically reconnect, because that Fragment has that ability in onResume

For this to work, the device has to be uniquely identified (MAC-Address).

Edit: I now have a recovery sequence

API-Button can request images at onClick.

General idea:

Thread 1:
After the API-Button is clicked, it should take a photo and wait for it to save.
(maybe remember it's name latestName so we know exactly which one it is.)
possible implementation: Callable the kotlin equivalent

Thread 2:
Join Thread 1. We can be sure image is saved. Now it it's time to actually do the request and pass the link to the file as a parameter to RetrofitWrapper. The link itself will probably be queried form the database, something like SELECT Plant where name = latestName

-> Executors for this? There will be multiple images in a row, at least 5.

Fix dubious, potentially unsafe call on navHostFragment: Just use ViewModel to trigger transition

I currenly use this code to manually get a reference to the instance of the Fragment:

        val navHostFragment = binding.fragmentContainer.getFragment<NavHostFragment>()
        val fragment: Fragment = navHostFragment.childFragmentManager.fragments[0]
        val intermediateFragment = fragment as IntermediateFragment

        intermediateFragment.navigateToCameraFragment()

This works fine. It's however quite the opposite of elegant.
It is possible to achieve the same by just using a ViewModel. This approach is better because is less complex, needs less code.
Just use the GlobalStateViewModel to actually start the Fragment Transition to CameraFragment

set count of confirmations to zero after some time has passed.

The class MainActivityNanodetNCNN has a method plantVaseDetectedCallback which makes use of a local variable count to track the number of confirmations from the object detection model.

To prevent this counter from accumulating, I suppose it's a good idea to reset it after a few seconds (let's say two seconds)

public void plantVaseDetectedCallback(String helloFromTheOtherSide) {

Add ViewPager with TabLayout

Extend the MainActivity. Need more space to test things out.
I will choose fragments over activites whenever possible

Remove unsafe call to terminalFragment, instead use a second ViewModel only for this purpose

State

Currently, I am calling the send method from NanodetncnnActivity That method is used to send commands over Bluetooth.

Problem

The problem is that it is a unsafe call.
The send method is in fact an instance method of the TerminalFragment. I'm calling method of fragment from it's HostActivity. The current solution is kind of a hack. First of all, that reference might be null. This is unacceptable, we have to find a better solution.

Solution

To avoid calling a function on a Nullable object, create a new ViewModel. This ViewModel will be used in only one direction, TerminalFragment is only observing changes.

I don't want to use the existing GlobalStateViewModel because there would be a feedback loop. The value it would change would also be observed at the same place.

Probability of latest object detection should display as Text

The objects plant / vase are sometimes detected for a split second. It would be interesting to know the probability.

For this I will have to modify NanoDet::invoke_class_from_static which forwards this probability form NDK to the Android Code.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.