Skip to content

Instantly share code, notes, and snippets.

View Achllle's full-sized avatar

Achille Verheye Achllle

View GitHub Profile
@Achllle
Achllle / async_ttl_cache.py
Created April 26, 2023 17:13
An Async TTL cache with a lock that forces concurrent calls to wait for the first call to complete and use the cached result rather than recompute
import asyncio
import time
import functools
def cache_result(seconds):
"""
Caches result of an async function, depending on its arguments
No support for maxsize, only TTL for now
@Achllle
Achllle / Dockerfile
Last active January 25, 2023 01:59
Building a ROS2 component from source with Docker for development
FROM ubuntu:jammy
ARG GH_USER=ros2
ARG GH_BRANCH=rolling
ENV DEBIAN_FRONTEND=noninteractive
RUN \
# apt-get -y install --no-install-recommends software-properties-common \
apt-get update \
&& apt-get -y install --no-install-recommends \
@Achllle
Achllle / relay_topic2service.py
Last active December 4, 2020 21:52
generic ROS topic to service relay node
#!/usr/bin/env python
"""
convert topic with payload to a service. The topic does not have to exist yet for this to run.
Usage:
rosrun [some_pkg] relay_topic2service.py /input_topic topic_type /service_address srv_type python_expression
e.g.
rosrun [some_pkg] relay_topic2service.py /my_trigger_topic std_msgs/Empty /trigger_this std_srvs/Empty ''
or
@Achllle
Achllle / dq_viz.py
Last active November 18, 2019 09:22
visualization dual quaternions with RViz
#!/usr/bin/env python
import rospy
import copy
import numpy as np
from interactive_markers.interactive_marker_server import *
from visualization_msgs.msg import *
from dual_quaternions_ros import DualQuaternion
from geometry_msgs.msg import Vector3, Point, Pose