Protect your serial port from code breaks! 😎 My code allows almost uninterrupted work with sensors connected to the serial port. Data is read from the port, sent to Redis with virtually no delay, and then can be read by multiple Redis Workers without packet loss. They can then be modified and sent through another Redis channel. The rest of the instrumental was written exclusively for IMU.
Now let's describe in more detail what is there
Read data
Calibrate
Visualization
Modify Data
Debugging and Logger
sudo systemctl start redissudo python IMU_read_serial_to_redis_async.pysudo python calibration_accel.pyAll data will be saved in file with name, saved in config.py as calib_data_filename.
There is all possible configurations for IMU data visualization - includes methods for plotting 3D rotations and 2D IMU data (calibrated and raw data).
python visualize.pyChoose the option you need. Be aware: You have to start processes which modify the raw data to e.g. plot calibrated data.
To apply calibration to raw data, use:
sudo python recalculate_data.pyTo transform data from euler to quaternions, use the script, which will post data into a new stream. You still can access raw values.
sudo python madgwick_transformer.py Clear the terminal and Start to read logs messages from processes via read_logs.py
Logger connects to Redis and stores Exceptions from all processes, which sends the data to related channel (the name log_message_channel defined in in config.py) Also, a Log message has its own structure, described in models.py - LogMessage.