Git Product home page Git Product logo

labjackcanbus's People

Contributors

bellh14 avatar ghafha avatar squidtoon99 avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

sahanyw

labjackcanbus's Issues

Change button to read from digital

super simple change button code from AIN0 to any digital pin that is not being occupied, this issue should only be marked as complete once the actual button has been attached and testing to the new location

ECU data conversion

Currently the data from the ECU is unreadable, conversion needs to be done it for us to process it

Refactor DAQ.py

remove all lin pot specific file and place them in a "read_lin_pot.py" file
this includes all initializations, headers, and collecting code
implement this code in the method DAQRun
change naming convention of files and methods to snake_case to make the program more pythonic for example DAQRun to daq_run
remove unneeded else blocks in the code
see if the ECU data can also be moved into an ecu class
reorganize the project to add better structure for files which are not DAQRun
identify any other levels of abstraction in DAQ,py which can be removed

Implement proper logging

Currently we log using print statements and even errors are printed to stdout. We should use a proper logging manager and potentially start piping some log data into persistent storage for help with debugging in the future and better code practice.

File Saving Fixes

Current debrief of the code

There is a switch on the car that reads if the code should be in a saving state or in a reading state. It saves both a master copy with all iterations and a current iteration.

This is to keep track of each 'run' that the car drives. The current code does not save just the current iteration but the whole data frame.

Fixes

One way to fix this is to have the linpot data into an iteration dataframe that only stores the data until the next save and then have a master copy that concats each iteration into it. The iterations data frame will need to be cleared after saving the file.

Naming Fixes

To better keep track of iterations and files, have the file name start with a formatted version of the current data and time including year, month, day, 24 hour format, minute. You can include seconds if you want but probably not needed.

Sync Lin-Pot and Accel Data

for the sake of convenience i would like for all of the data to be recorded on to one csv file, the first 4 columns should be the lin pot data then the 5th should be accel data and so on, modify the codebase to support this

Migrate to Streams

LabJack Streams are much faster and more consistent than polling methods. This feature closely aligns with our requirements and will allow us to massively increase the rate of data ingestion while freeing up Rasberry PI processing for other features.

Core Functionality

  • Basic Stream support
  • Error Handling(+retries)
  • Abstract Classes for modularity
  • Upload to endpoint (wss/https)

Sensors

  • Linpots
  • Accelerometers
  • Gyro

Enhancements

  • Python Logging #17
  • Documentation
  • Clear Comments

Accelerometer

  • refactor code to support I2C communication
  • save data from the accelerometer into dataframe
  • convert the voltage to m/s^2

Run DAQ.py on Raspberry Pi Startup

The raspberry pi 4 is running a version of Debian Linux. Research how to run the python file on startup and come to the shop and implement it on the pi directly.

This should be fairly easy and will be good exposure if you have never used Linux based operating systems before or the command line.

Optionally add in a way to check if the program is running. Could be save a file with the date and time of starting the program if the script starts successfully or an error message in the file if failed.

Add Config Files

Config File to Initialize the Sensors

  • Create a JSON file that can stores which sensors are on the car, which ports they are connected to, and what those sensors represent
  • Create a parser class that parses this data
  • Once the refactors are done, the parse should have methods to return a useable version of the data to initialize the sensors

JSON File

Up to interpretation on how to implement the JSON data, but it needs to be easily parseable and logical to add to it.

Possible option:

Sensors {
     Linpots: {
         inputs: [
             {
                 name: "Front Right",
                 port: "AIN1",
            },
            {
                 name: "Front Left",
                 port: "AIN2",
            },
        ],
    },
    Switch: {
        inputs: [
             {
                 name: "Saving Switch",
                 port: "AIN0",
            },
        ],
    },

  Accelerometers: {
          inputs: [
               {
                   name: "Acc1",
                   ports: [
                          "AIN10",
                           "AIN11",
                           "AIN12",
                        ],
              },
          ],
      },
}

Do not worry about the specific port numbers and names as these might change.

Parser Class

  • Should initialize off of the name of the config file. self.config_data = load_json(self.file_name). (note load json is probably a different method name)
  • Have a method for parsing each sensor, so
def read_linpot_config(self) -> [[]]: 
  return [[name, port], [name, port], [name, port], [name, port]]

This is just a possible option you are free to implement it as you see fit. The only requirements here are that it is logical and easy to use.

What the data goes to.

#  General Form for 1 Linpot
# Will need to call this for each list in the return list
self.linpot_df.loc[index, name] = ljm.eReadName(
                            self.handle, port)
# Current
self.linpot_df.loc[index, "Front Right"] = ljm.eReadName(
                            self.handle, "AIN1")

Questions

If you have any questions message Noel or I.

Gyro Sensor

the sensor we are using also has gyro capabilities, we want to have this available as well
this sensor uses I2C for communication
datasheet for the sensor:
xcel: https://utdallas.box.com/s/o9jgf40pgph88szxvvick6mbc0ejwx25
gyro: https://utdallas.box.com/s/uwg92u5eyph3kpjilo8zamjkmtr8axqh
sample code for reading in from i2c can be found here in the labjack docs: https://github.com/labjack/labjack-ljm-python/blob/master/Examples/More/I2C/sht3x.py

you will need to find the slave address on the chip which contains the gyro address then connect to it using a method from the ljm docs, refer to the accelerometer code as well for help

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.