Skip to content

Instantly share code, notes, and snippets.

@Fabien-B
Fabien-B / simu.py
Created April 21, 2022 16:02
Simple robot simulator
#!/usr/bin/python3
import time
from math import cos, sin, atan2, sqrt, pi
import threading
SIMU_PERIOD = 0.01
ACCEL_MAX = 1000
ACCEL_ANG_MAX = 100
#!/usr/bin/python3
from ivy.std_api import *
import time
from math import cos, sin, atan2, sqrt
from enum import Enum
BUS = "127.255.255.255:2010"
#SPEED_REG = "SpeedCmd (.+) (.+) (.+)"
SPEED_REG = "Direction (.+),(.+),(.+)"
#define HOME 9
#define TOOL_MEASURE 10
#define WORK_MEASURE 11
#define X_MINUS 8
#define X_PLUS 6
#define Y_MINUS 3
#define Y_PLUS 7
#define Z_MINUS 4
#define Z_PLUS 5
@Fabien-B
Fabien-B / ust-05ln.py
Created June 18, 2018 22:55
getting UST-05LN data over serial USB.
from serial import Serial
import time
from collections import namedtuple
class UST:
Command = namedtuple('Command',['command', 'answer_expected', 'answer'])
START_RANGING = Command('#GT15466', False, '')
STOP_RANGING = Command('#ST5297', True, '#ST00A845')
@Fabien-B
Fabien-B / soundbox.py
Created May 15, 2018 11:28
soundbox to allow the robots and any other agent to play sounds in the club !
import time, sys, os
import ivy
import argparse
from pygame import mixer
from ivy.std_api import *
IVY_APP_NAME = "SoundBox"
DEFAULT_BUS = '127.0.0.1:2010'
SOUNDS_PATH = None
[Desktop Entry]
Name=Eclipse
Comment=IDE for C/C++
Keywords=Development;code;robotics;C;
Exec=/home/fabien/eclipse/eclipse
Icon=/home/fabien/eclipse/icon.xpm
Terminal=false
Type=Application
StartupNotify=true
Categories=Development;
@Fabien-B
Fabien-B / algo.py
Last active July 28, 2017 11:54
Intersect
MAX_RECURSION_DEPTH = 10
#le principe :
#on a des polygones sur la table (pas encore de ronds, on verra ça plus tard).
# on cherche le chemin qui "tourne le moins" : en visant l'objectif, on contourne les obstacles au plus près.
# donc en gros on entre dans une recursion sur un arbre binaire : à chaque point, on a deux chemins possibles
# à moins que l'on puisse atteindre l'objectif. Dans ce cas, on arrête la recherche sur cette branche de l'arbre.
# Il y a un risque de stack overflow, donc il vaut mieux mettre une limite de récursion, c'est plus prudent.
# on trace la ligne droite du point de départ à celui d'arrivé.