Git Product home page Git Product logo

neblina-python's Introduction

Motsai

Motsai Utilities Package

An R package for the analysis conducted by Sultan Wehaibi from Concordia University

Instructions

For Mac and Linux:

  • Install the release version of devtools from CRAN with
install.packages("devtools")
  • Install motsai package via the following command
devtools::install_github("xsultan/motsai")

For Windows:

Follow the same steps above, if you experience the following error:

Warning in install.packages :
 'lib = "C:/Program Files/R/R-X.X.X/library"' is not writable

Run the following code:

setwd(dir.create("packages_to_install"))
pathOfPackages <- paste(getwd(), "packages_to_install", sep="\\")
download.package(c("nlme", "lme4"), destdir=pathOfPackages, type="win.binary")
setwd(pathOfPackages)
install.packages(list.files(), repos=NULL, type="win.binary", lib=Sys.getenv("R_LIBS_USER"))
install.packages(c("minqa", "abind", "coda", "nloptr")

Now try to install the motsai package using the following command:

devtools::install_github("xsultan/motsai")

neblina-python's People

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

neblina-python's Issues

Doesn't recover from an already streaming COM port

Traceback (most recent call last):
  File "streammenu.py", line 171, in <module>
    console . cmdloop()
  File "C:\Users\Omid Sarbishei\AppData\Local\Programs\Python\Python35\lib\cmd.py", line 138, in cmdloop
    stop = self.onecmd(line)
  File "C:\Users\Omid Sarbishei\AppData\Local\Programs\Python\Python35\lib\cmd.py", line 217, in onecmd
    return func(arg)
  File "streammenu.py", line 104, in do_streamIMUData
    packet = self.waitForAck(myslip)
  File "streammenu.py", line 30, in waitForAck
    packet = neb.NebResponsePacket(consoleBytes)
  File "C:\Users\Omid Sarbishei\Documents\GitHub\neblina-python\neblina.py", line 415, in __init__
    .format(packetStringLength))
NotImplementedError: Packets are not supposed to be anything other than 20 bytes for now but got 19

Adding number of samples to the python script for the flash recorder command

"flashRecord" command will be followed by an integer number "n" that will represent the total number of samples to be recorded. Currently Step 7 in the NOR flash recorder routine sets n to the value of 1000 (20 seconds of recording at 50Hz sampling). This value should be replaced by the input argument "n".

Finger Swipe

Implement finger swipe gesture interpretation

Retry when attempting to connect to the wrong COM port

If the program throws an exception:

serial.serialutil.SerialException: could not open port 'COM16': FileNotFoundError(2, 'The system cannot find the file specified.', None, 2)

Prompt the user to enter the write COM port number. This will be especially beneficial on Windows since the COM port increments all the time.

Modifying the flash record/playback routines to operate as a unit test for UART0

The goal is to have the flash playback routine operate as a unit test for the UART0 data transfer as well as its primary objective of dumping the recorded data to PC. The playback process on Neblina engages UART in a high-speed packet transfer (~300Hz), which makes it crucial to evaluate the robustness of the interface. Considering the flash record routine that stores IMU data in the NOR flash, the playback routine should expect the exact same number of recorded samples all being valid IMU data packets coming from Neblina. The playback routine in Python will count the total number of valid IMU data packets that has been received during playback. This number should match the number of recorded samples.

Packet generation script generates three identical byte lists.

Instead of having three different types of packets for three different files, it has all three packet types in one file. They only contain 10 Euler angle commands (0x05) and the rests are pedometer commands (0x0B). Only the yaw rotation has values: the pitch and the roll are all zeros.

Trajectory Info Packet

Counter and progress percentage has been added in the firmware. Need to add logic in the Python code to interpret the new data.

The end user of the API should not have to deal with the notion of packets

End-user application will use neblinaAPI.py as the API to talk to the module or ProMotion board. The goal of this is to abstract away the notion of packets and UART and deal solely with information important to the user such as quaternions, temperature, flash storage, versions, etc.

Good:

def EEPROMRead(self, readPageNumber):
     (...)
     return packet.data.dataBytes

Bad:

def EEPROMRead(self, readPageNumber):
     (...)
     return packet.data

`

Opening the port while the device is busy

WHen opening the serial port while the device is busy, it thros an exceptin and exits the program:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 274, in open
    self.fd = os.open(self.portstr, os.O_RDWR|os.O_NOCTTY|os.O_NONBLOCK)
OSError: [Errno 16] Device or resource busy: '/dev/ttyACM0'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "streammenu.py", line 130, in <module>
    console = StreamMenu()
  File "streammenu.py", line 22, in __init__
    self.sc = serial.Serial(port='/dev/ttyACM0',baudrate=230400)
  File "/usr/lib/python3/dist-packages/serial/serialutil.py", line 261, in __init__
    self.open()
  File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 277, in open
    raise SerialException("could not open port %s: %s" % (self._port, msg))
serial.serialutil.SerialException: could not open port /dev/ttyACM0: [Errno 16] Device or resource busy: '/dev/ttyACM0'

We could make it so that the program waits for the device to become available before continuing with the execution.

Add a test routine command to the main menu for the ProMotion board

The routine checks the following:

  1. Communication with the LSM9DS1 chip, by getting the temperature value
  2. Communication between KL26Z and Nordic chips, by getting the firmware versions
  3. The EEPROM memory: try a write, followed by a read, which must match the write data
  4. Flash Recorder and motion engine's Euler/Quaternion streaming: Do a flash record and playback for both Euler angles and Quaternion data. The number of packets recorded and played back must match.
  5. Communication with the power management module: Get battery level (state of charge)

Raspberry Pi visualization

Attach the BluePy interface to the visualisation environment to be able to plot live streams of Neblina data on the RPi.

Timeout for waiting for device

One way to implement a timeout is to count the empty debug packets and if you receive a lot of them you can try again. We have to make sure we remove this once the medium of transmission is perfected.

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.