Skip to content

Instantly share code, notes, and snippets.

View michalpelka's full-sized avatar

Michał Pełka michalpelka

View GitHub Profile

Command

fio --name=write_test --filename=/media/usb/foo --size=1G --time_based --runtime=30 --rw=write --direct=1 --bs=4M --iodepth=1 --numjobs=1

Results

Device Technology FS Write (MB/s) RPI5 Write (MB/s) x86
Platinet PMFPPD256 USB 3.2 SSD FAT32 309 409
from pymodbus.client import ModbusTcpClient
import struct
import os
# Define device connection
client = ModbusTcpClient('127.0.0.1', port=502) # Change IP and port as needed
# Connect to the device
while client.connect():
num_registers = 12
@michalpelka
michalpelka / CMakeLists.txt
Created November 22, 2024 13:50
PL2000ToWGS
cmake_minimum_required(VERSION 3.10)
project(WGS)
add_executable(main main.cpp wgs84_do_puwg92.cc)
@michalpelka
michalpelka / CMakeLists.txt
Created November 18, 2024 17:19
Ceres SLAM example with standalone cmake
cmake_minimum_required(VERSION 3.10)
project(HelloCeres)
# Find Ceres.
find_package(Ceres REQUIRED)
# Add executable.
add_executable(hello_ceres hello_ceres.cpp)
# Link Ceres to the target.
import os
import rosbag2_py
import numpy as np
import struct
from sensor_msgs.msg import PointCloud2
from sensor_msgs_py import point_cloud2
from rclpy.serialization import deserialize_message
def read_bag_convert_to_csv(bag_file, topic, output_csv):
# Open ROS 2 bag
@michalpelka
michalpelka / Test_GPIO_FOR_Raspberry.md
Last active September 29, 2024 09:18
Nice tools to detect GPIOs in Rapsbery pi

Install libs:

sudo apt-get install python3-rpi.gpio

Then run:

python3 test_gpio_output.py
python3 test_gpio_input.py
``
@michalpelka
michalpelka / ZED_NMEA_LIVOX360
Created April 6, 2024 19:46
ZED-F9P and Mid360 config
{
"type": "CFG-ITEM",
"items": [
{
"value": 9600,
"layer": 0,
"action": "Set",
"valueType": "U4",
"requestId": "1882a918-6321-4b5f-aa26-ac4a1f98fa68",
"key": "0x40520001"
from pathlib import Path
import gpxpy
import gpxpy.gpx
from rosbags.highlevel import AnyReader
import sys
bag = sys.argv[1]
gpx = sys.argv[2]
@michalpelka
michalpelka / sample.cpp
Created January 19, 2024 10:12
O3DE draw coordinate system
#include <Atom/RPI.Public/AuxGeom/AuxGeomFeatureProcessorInterface.h>
#include <Atom/RPI.Public/Scene.h>
void MyComponent::Activate()
{
auto* entityScene = AZ::RPI::Scene::GetSceneForEntityId(GetEntityId());
m_drawQueue = AZ::RPI::AuxGeomFeatureProcessorInterface::GetDrawQueueForScene(entityScene);
AZ::TickBus::Handler::BusConnect();
TwistNotificationBus::Handler::BusConnect(GetEntityId());
#!/usr/bin/env python
# --------------------------------------------------------------------
# Simple sum of squared differences (SSD) stereo-matching using Numpy
# --------------------------------------------------------------------
# Copyright (c) 2016 David Christian
# Licensed under the MIT License
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as patches