Skip to content

Instantly share code, notes, and snippets.

View ymollard's full-sized avatar
🐧
Art, engineering & digital training

Yoan Mollard ymollard

🐧
Art, engineering & digital training
View GitHub Profile
from datetime import datetime
class BankAccount:
def __init__(self, owner: str, initial_balance: int = 0):
self._owner = owner
self._balance = initial_balance
def print(self):
print(f"This account belongs to {self._owner} and has a balance of ${self._balance}")
rosrun ros4pro_custom manipulate.py
[ INFO] [1648045282.089866728]: Loading robot model 'poppy_ergo_jr'...
[ INFO] [1648045282.112056133]: No root/virtual joint specified in SRDF. Assuming fixed joint
[ WARN] [1648045282.112710544]: Could not identify parent group for end-effector 'fixed_tip'
[ WARN] [1648045282.112856214]: Could not identify parent group for end-effector 'moving_tip'
[ INFO] [1648045283.378258795]: cache file /home/ubuntu/catkin_ws/src/ros4pro_custom/src/poppy_ergo_jrarm_base_linkfixed_tip_5000_1.000000_1.000000.ikcache initialized!
[ INFO] [1648045283.824455476]: Found 2 IK solutions for a 6-dof system with 1 end effectors in /home/ubuntu/catkin_ws/src/ros4pro_custom/src/poppy_ergo_jrarm_and_finger_base_linkmoving_tip_5000_1.000000_1.000000.ikcache
[ INFO] [1648045283.824846103]: freeing buffer
[ INFO] [1648045283.825067761]: freed buffer
[ INFO] [1648045283.825317731]: cache file /home/ubuntu/catkin_ws/src/ros4pro_custom/src/poppy_ergo_jrarm_and_finger_base_linkmoving_tip_5000_1.000000_1.0
import time
def log(*args):
if not hasattr(log, "t0"):
log.t0 = time.time()
print("t+" + str(int(time.time()-log.t0)) + "\t: ", end="")
print(*args)
@ymollard
ymollard / pdf_rat.modules.php.md
Created February 3, 2022 16:46
Dolibarr timesheet bug
from datetime import datetime
from typing import Optional
class BankAccount:
def __init__(self, owner: str, initial_balance: int):
self.balance = initial_balance
self.owner = owner
def print(self):
from matplotlib import pyplot
class Scenario:
"""
Represents a scenario of virus propagation characterized by simulation parameters
Version with lockdowns but no incubation duration
"""
def __init__(self,
duration: int,
@ymollard
ymollard / quick_logging.py
Last active November 19, 2021 01:03
Python 3 quick stdout logging
import logging, sys
logging.basicConfig(stream=sys.stderr, level="DEBUG")
# Parent module switched to debug for both the logger and the stream handler
import logging
h = logging.StreamHandler()
h.setLevel("DEBUG")
l = logging.getLogger("pypot")
l.setLevel("DEBUG")
l.addHandler(h)
@ymollard
ymollard / mount_img.md
Last active October 20, 2021 20:23
losetup: Mount an img file with multiple partitions to edit files in them
sudo losetup 2020-10-23-poppy-torso.img -Pf
ll /dev/loop*

Then find the partition there eg /dev/loop15p2

mdkir -p mnt

Gestion des images sous ROS et Marker RViz

  1. Tester le package usb_cam qui ouvre l'image de la webcam et la publie sur sur un topic (pour tester, affichez-la avec le package image_viewer)
  2. Ecrire un noeud color.py qui calcule la couleur dominante de l'image de ce topic et l'écrit dans le terminal
  3. Remplacer l'écriture dans le terminal par la publication d'un Marker dans RViz

Ronds et carrés Turtlesim : Roslaunch, rosparam et noeud

  1. Ecrire un noeud move_turtle.py qui fait dessiner un carré à la tortue de turtlesim
  2. Mettre le code du carré dans une fonction et écrire une autre fonction qui dessine un cercle
  3. Créer un package et un launchfile pour pouvoir lancer en une seule commande turtlesim et move_turtle.py en tapantn roslaunch formation dessin.launch
  4. Modifier le launchfile pour écrire square ou circle dans un paramètre /shape du serveur de paramètres selon ce qui est passé en argument e.g. draw.launch shape:=circle

Image to PDF

convert -density 300 in.jpeg out.pdf

Concat

sudo apt-get install pdftk
pdftk in1.pdf in2.pdf cat output out.pdf