Skip to content

Instantly share code, notes, and snippets.

View awesomebytes's full-sized avatar

Sam Pfeiffer awesomebytes

View GitHub Profile

Example session of Claude Engineer to create a PySide QT UI for itself

Using https://github.com/Doriandarko/claude-engineer Total cost 1$. Nice interface, nice workflow. It got stuck on execution.

╭────────────────────────────────────────────────────── Welcome ───────────────────────────────────────────────────────╮
│ Welcome to the Claude-3-Sonnet Engineer Chat with Multi-Agent and Image Support!                                     │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Type 'exit' to end the conversation.
Type 'image' to include an image in your message.
@awesomebytes
awesomebytes / example_interactive_debugging_1.py
Created April 30, 2024 09:39
Interactive debugging tips in Python with ipdb, hickle and ipython
#!/usr/bin/env python
"""Example of usage of ipython debugger (ipdb)
to interactively debug something in the code with autocomplete and color support.
You may need to install:
sudo pip install ipdb
"""

How to keep color of a 3D model for gazebo and Rviz

Get model from SolidWorks in .ply and in .obj (All in a single file) (so, you need a model that has color information somehow, in my case, opening it with meshlab always showed the color)

Use the .obj to open in Blender, make sure to adjust the import size (probably is in mm, so 0.001)

Now export to collada (.dae) and the model will keep color

#!/usr/bin/env python
import rospy
import tf2_ros
from geometry_msgs.msg import PoseStamped
# You want to use "simulated time" so it uses the time from the rosbag
# rosparan set /use_sim_time true
# Play your rosbag with something like:
@awesomebytes
awesomebytes / project_points_on_image.py
Created March 17, 2023 11:39
The output of experimenting with ChatGPT writing and helping to fix a node to project pointcloud points on an image
#!/usr/bin/env python
import rospy
import sensor_msgs.point_cloud2 as pc2
from sensor_msgs.msg import PointCloud2, CameraInfo, CompressedImage
from cv_bridge import CvBridge
import tf2_ros
import tf2_py as tf2
import tf2_sensor_msgs
import cv2
@awesomebytes
awesomebytes / serialized_subscriber.py
Last active March 15, 2023 07:50
Python ROS 1 Subscriber that provides serialized messages and allows to deserialize at a later point
#!/usr/bin/env python3
from typing import Any
import rospy
import types
# Possible future idea: this could allow to also drop messages on purpose on the Python side
# deserializing is the second most expensive thing to do anyways (the first being just receiving the message)
# Author: Sam Pfeiffer <sammypfeiffer at gmail.com>
# License: BSD-3
#!/usr/bin/env python
import rospy
from can_msgs.msg import Frame
from std_msgs.msg import UInt8MultiArray
def create_request(channel, off_on_toggle):
"""Create a CAN Frame to request CHANNEL to OFF_ON_TOGGLE
0 - 48 0 1 2
bits 0-7 bits 8-15"""
@awesomebytes
awesomebytes / ipv6_discovery.md
Created November 10, 2022 03:18
Connect to an unconfigured board via ethernet without DHCP or link local using ipv6

SSH into directly connected ethernet board

From: https://unix.stackexchange.com/a/624347

# Find the ipv6 address connected to the interface (-I YOUR_INTERFACE)
ping6 -L -I enx8cae4cdd3a4d ff02::1
# PING ff02::1(ff02::1) from fe80::15c5:f43f:2c00:fefd%enx8cae4cdd3a4d enx8cae4cdd3a4d: 56 data bytes
# 64 bytes from fe80::f00b:9167:92a:a182%enx8cae4cdd3a4d: icmp_seq=44 ttl=64 time=3.78 ms
# Now ssh into the discovered address+interface:

Compile Kernel with PREEMPT_RT

When following https://docs.ros.org/en/foxy/Tutorials/Miscellaneous/Building-Realtime-rt_preempt-kernel-for-ROS-2.html

I built this in a VM using the Ubuntu ubuntu-20.04.5-desktop-amd64.iso. I needed to provide the VM with 7GB of RAM to avoid OOM (out of memory) errors. I needed to provide it with 60GB of storage space (Ubuntu installation needs short of 7GB and the kernel compilation seems to need over 40GB, plus testing the .deb installation it fills the disk).

39G	linux-5.15.73
8.2M	linux-headers-5.15.73-rt52_5.15.73-rt52-8_amd64.deb
84M	linux-image-5.15.73-rt52_5.15.73-rt52-8_amd64.deb
1.2G	linux-image-5.15.73-rt52-dbg_5.15.73-rt52-8_amd64.deb
1.2M	linux-libc-dev_5.15.73-rt52-8_amd64.deb