Skip to content

Instantly share code, notes, and snippets.

View zkytony's full-sized avatar
🍊

Kaiyu Zheng zkytony

🍊
View GitHub Profile
@zkytony
zkytony / mypy-report-mode.el
Created July 30, 2023 20:08
custom mode for navigating mypy output
;;; mypy-mode.el --- Navigate Mypy Output in Emacs
;; Copyright (C) 2023 Kaiyu Zheng
;; Author: Your Name <kaiyutony@gmail.com>
;; Keywords: convenience
;; Version: 0.0.1
;; Package-Requires: ((emacs "24.3"))
;;; Commentary:
@zkytony
zkytony / message_filter_minimum.cpp
Created April 9, 2023 16:57
Minimum C++ example of using ROS2 message_filter with latching
// Using ROS Humble
// /author: Kaiyu Zheng
#include <chrono>
#include <rclcpp/rclcpp.hpp>
#include <message_filters/subscriber.h>
#include <message_filters/synchronizer.h>
#include <message_filters/sync_policies/approximate_time.h>
#include <std_msgs/msg/header.hpp>
#include <geometry_msgs/msg/point_stamped.hpp>
@zkytony
zkytony / message_filter_minimum.py
Last active October 12, 2023 14:32
Minimum Python example of using ROS2 message_filter with latching
# Using ROS Humble
# /author: Kaiyu Zheng
import rclpy
import message_filters
import geometry_msgs.msg
import std_msgs.msg
from rclpy.node import Node
from rclpy.qos import QoSProfile, QoSDurabilityPolicy
@zkytony
zkytony / cryingbaby.py
Last active November 4, 2021 15:03
Defining and solving a small POMDP using pomdp-py
"""
Example of defining a small, tabular POMDP and solving
it using Cassandra's pomdp-solve value iteration solver.
Refer to documentation:
https://h2r.github.io/pomdp-py/html/examples.external_solvers.html
"""
import pomdp_py
def cryingbaby():
@zkytony
zkytony / efficiency.el
Created July 5, 2021 14:18
Some helpful lisp functions for emacs efficiency
;;; package --- Summary
;;;; Commentary:
;;; Code:
(require 'cl)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Note taking ;;
@zkytony
zkytony / tabletop_robot.launch
Created July 2, 2019 13:27
Gazebo launch file: A UR3 robot arm on a tabletop.
<?xml version="1.0"?>
<launch>
<arg name="limited" default="false"
doc="If true, limits joint range [-PI, PI] on all joints." />
<arg name="paused" default="true"
doc="Starts gazebo in paused mode" />
<arg name="gui" default="true"
doc="Starts gazebo gui" />
<!-- Robot pose -->
<arg name="x" default="0"/>
@zkytony
zkytony / ROS_Python.md
Last active October 10, 2023 20:46
Import python modules between ROS packages

Reference: Installing Python scripts and modules

Package structure

├── my_pkg
│   ├── setup.py
│   ├── scripts
│   │   └── executable_script
 └── src
@zkytony
zkytony / legendre.py
Created October 17, 2018 01:21
Legendre Polynomial
"""
Computes Legendre Polynomials
M m (2n-2m)! n-2m
P (x) = sum (-1) ------------------- x
n m=0 n
2 m! (n-m)! (n-2m)!
where M = n // 2
@zkytony
zkytony / plot_series.py
Last active October 17, 2018 01:20
Use SymPy to plot series functions
"""
plots series functions
"""
import math
import sympy
from pprint import pprint
import matplotlib.pyplot as plt
# constants
EVEN=1
@zkytony
zkytony / safe_rm.sh
Created October 21, 2017 15:49
Safe rm - moves deleted files to a dumping ground
# Some important aliases
SAFE_RM_DIR=${SAFE_RM_DIR:="$HOME/.safe_rm"}
REAL_RM=${REAL_RM:="/bin/rm"}
# Override rm, because it's always painful to recover
# files deleted by rm, if possible at all. Instead,
# simply move it to the $SAFE_RM_DIR for later cleaning.
rm()
{
force=false