dallasformularacing / labjackcanbus Goto Github PK
View Code? Open in Web Editor NEWPython scripts to read data from a LabJack DAQ into csv files
Python scripts to read data from a LabJack DAQ into csv files
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
Currently the data from the ECU is unreadable, conversion needs to be done it for us to process it
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
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.
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.
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.
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.
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
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.
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.
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.
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")
If you have any questions message Noel or I.
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.