Skip to content

Instantly share code, notes, and snippets.

View felixvd's full-sized avatar

Felix von Drigalski felixvd

  • Mujin Inc.
  • Tokyo, Japan
View GitHub Profile
<mxfile host="app.diagrams.net" modified="2022-08-08T00:21:03.699Z" agent="5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36" etag="Ew5GSj-MdiIKkWVcNSuW" version="20.2.3" type="device"><diagram id="Cpf80pf9YbQiV9m7Jv06" name="Page-1">dZNNU8MgEIZ/DcfMENC2HrWJ9aKX6Hh0aNgGlIQMoSbtrzcpkI+pncmBffZdWN4liG7LbmdYLV41B4UI5h2iCSIkviMEDR/mJ0fWa+pAYST3oglk8gweYk+PkkOzEFqtlZX1Eua6qiC3C8aM0e1SdtBqeWrNCrgCWc7UNf2U3ApHN/d44i8gCxFOjrHPlCyIPWgE47qdIZoiujVaW7cquy2owbzgi6t7vpEdGzNQ2X8K9P578INgxfb9TC6CtCqUbISrvPAvqKKP7GaWQ5SkLpvA0Ta5z4Ym+NuZKmItfuCHolo9vv9EWRSPlxubbuwpGNoKaSGrWT7Ebf9oEH0Sthw6jPul2/8XjIXu5kXnJ+xAl2DNqZf4Ahoc90+ObHzcTgOMg0bMhrfyjPk3U4xbT7b2C3+rEHqjQzgN9CKd/RY0/QM=</diagram></mxfile>
@felixvd
felixvd / drawioGettext.py
Last active January 18, 2024 19:41
Read draw.io diagrams in Python and read/write text fields
#!/usr/bin/python3
# Provides gettext-like functionality for drawio files:
# - Extract translatable strings from drawio diagram files (svg, png, xml) to PO files
# - Replace translatable strings in drawio diagram file with translations from a PO file
# - Regenerate the diagram in another language
# Reads .drawio.svg or .drawio.xml file, prints (or modifies) the `value` fields of the diagram, then writes a new file.
# Only changes the metadata, not the SVG. Use drawio to generate the SVG from the new metadata, e.g.:
# drawio -x -e -f svg -o regenerated.drawio.svg changed.drawio.svg
@felixvd
felixvd / autodoc-myst-parser-bug.md
Created June 15, 2022 07:11
Content to reproduce a bug in MyST-Parser

With rST

This command will be rendered normally:

.. autoclass:: sphinx.util.docfields.Field
    :members:
    :noindex:
openapi: 3.0.0
servers:
- url: 'http://petstore.swagger.io/v2'
info:
description: >-
This is a sample server Petstore server. For this sample, you can use the api key
`special-key` to test the authorization filters.
version: 1.0.0
title: OpenAPI Petstore
license:
@felixvd
felixvd / ur_axis_angle_to_quat.py
Created July 6, 2021 03:21
Convert between ROS Quaternion and UR (Universal Robot) axis-angle rotation representation
from math import pi, cos, sin, sqrt, atan2
def norm2(a, b, c=0.0):
return sqrt(a**2 + b**2 + c**2)
def ur_axis_angle_to_quat(axis_angle):
# https://en.wikipedia.org/wiki/Axis%E2%80%93angle_representation#Unit_quaternions
angle = norm2(*axis_angle)
axis_normed = [axis_angle[0]/angle, axis_angle[1]/angle, axis_angle[2]/angle]
s = sin(angle/2)
@felixvd
felixvd / example_scene.urdf.xacro
Created November 2, 2020 15:48
URDF with two differently prefixed UR robots
<?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro"
name="example_scene" >
<!-- robot arms -->
<xacro:ur5_robot prefix="a_bot_" joint_limited="false"
shoulder_pan_lower_limit="${-pi}" shoulder_pan_upper_limit="${pi}"
shoulder_lift_lower_limit="${-pi}" shoulder_lift_upper_limit="${pi}"
elbow_joint_lower_limit="0.0" elbow_joint_upper_limit="${pi}"
wrist_1_lower_limit="${-pi}" wrist_1_upper_limit="${pi}"
@felixvd
felixvd / cartesian_path_service_capability.cpp
Last active October 22, 2020 04:27
Comparing time parametrizations
/*********************************************************************
* Software License Agreement (BSD License)
*
* Copyright (c) 2012, Willow Garage, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
@felixvd
felixvd / ur5e_problem_trajectory.yaml
Last active October 8, 2020 12:06
ur5e_problem_trajectory
!!python/object/new:trajectory_msgs.msg._JointTrajectory.JointTrajectory {state: [
!!python/object/new:std_msgs.msg._Header.Header {state: [1, !!python/object/new:rospy.rostime.Time {
state: [1601987639, 899594068]}, world]}, [shoulder_pan_joint, shoulder_lift_joint,
elbow_joint, wrist_1_joint, wrist_2_joint, wrist_3_joint],
[!!python/object/new:trajectory_msgs.msg._JointTrajectoryPoint.JointTrajectoryPoint {
state: [!!python/tuple [2.981921261631558, -1.27472656822998, 1.3204057526082944,
-1.6164710215873699, 3.075542515700016, -6.91763185490812e-07], !!python/tuple [],
!!python/tuple [], !!python/tuple [], !!python/object/new:genpy.rostime.Duration {
state: [0, 20000000]}]}, !!python/object/new:trajectory_msgs.msg._JointTrajectoryPoint.JointTrajectoryPoint {
state: [!!python/tuple [2.9811632914464603, -1.2739736220142608, 1.3194444408261852,
@felixvd
felixvd / activate_ros_control_on_ur.cpp
Created October 1, 2020 01:32
Boilerplate code to activate ROS control script on UR robots ( https://github.com/UniversalRobots/Universal_Robots_ROS_Driver )
# Software License Agreement (BSD License)
#
# Copyright (c) 2020, OMRON SINIC X
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
@felixvd
felixvd / gist:1915b3aa511262b0950a53d2bd11d4b9
Last active September 1, 2020 15:32
clang-tidy terminal output
This file has been truncated, but you can view the full file.
root@felix-OMEN-by-HP-Desktop-PC-880-p1xx:~/ws_moveit# catkin build
-------------------------------------------------------------------------------------------------
Profile: default
Extending: [explicit] /opt/ros/melodic
Workspace: /root/ws_moveit
-------------------------------------------------------------------------------------------------
Build Space: [exists] /root/ws_moveit/build
Devel Space: [exists] /root/ws_moveit/devel
Install Space: [exists] /root/ws_moveit/install
Log Space: [exists] /root/ws_moveit/logs