Skip to content

Instantly share code, notes, and snippets.

View ZdenekM's full-sized avatar

Zdeněk Materna ZdenekM

View GitHub Profile
import rospy
import sys
from sensor_msgs.msg import Image
from std_msgs.msg import String
import rosbag
from cv_bridge import CvBridge
import cv2
import json
import time
@ZdenekM
ZdenekM / build-api-0.6.0.json
Created April 23, 2021 07:47
Build OpenAPI 0.6.0 (divided overwrite flag)
{
"components":{
"schemas":{
"ImportResult":{
"description":"ImportResult(sceneId: str, projectId: str)",
"properties":{
"projectId":{
"type":"string"
},
"sceneId":{
@ZdenekM
ZdenekM / scene_service_status_code.py
Last active April 26, 2021 07:04
How to get HTTP status code from SceneServiceException
from arcor2.clients import scene_service
from arcor2.rest import RestHttpException
try:
scene_service.start()
except scene_service.SceneServiceException as e:
if isinstance(e.__context__, RestHttpException):
print(e.__context__.error_code)
else:
print("HTTP status code not available.") # a non-HTTP related error occured
@ZdenekM
ZdenekM / dobot_magician.xml
Created May 7, 2020 10:27
Dobot Magician URDF
<?xml version="1.0" encoding="utf-8"?>
<!-- =================================================================================== -->
<!-- | This document was autogenerated by xacro from model/magician_standalone.xml | -->
<!-- | EDITING THIS FILE BY HAND IS NOT RECOMMENDED | -->
<!-- =================================================================================== -->
<robot name="magician" xmlns:xi="http://www.w3.org/2001/XInclude">
<link name="root"/>
<link name="magician_link_base">
<visual>
<origin rpy="0 0 0" xyz="0 0 0"/>
@ZdenekM
ZdenekM / jsonpatch.py
Created March 18, 2020 07:42
json patch test
>>> import jsonpatch
>>>
>>> p1='{"id": "bbb", "scene_id": "bbb", "objects": [{"id": "box", "action_points": [{"id": "box-AP0", "position": {"x": -0.2453652, "y": 0.0, "z": 0.1269144}, "orientations": [{"id": "default", "orientation": {"x": 1.0, "y": 0.0, "z": 0.0, "w": 0.0}}], "robot_joints": [{"id": "default", "robot_id": "aubo", "joints": [{"name": "joint1", "value": 0}, {"name": "joint2", "value": 0}, {"name": "joint3", "value": 0}], "is_valid": true}], "actions": [{"id": "set_joints9763", "type": "RestRobotService/set_joints", "parameters": [{"id": "robot_id", "value": "\"aubo\"", "type": "string"}, {"id": "joints", "value": "\"box.box-AP0.default\"", "type": "joints"}, {"id": "move_type", "value": "\"Simple\"", "type": "string_enum"}, {"id": "speed", "value": "0.5", "type": "double"}], "inputs": [{"default": ""}], "outputs": [{"default": ""}], "uuid": "b8b5c936-718b-4f4c-9541-0940d5480332"}], "uuid": "b8e3e6bc-f614-423a-b9d2-c4dd0cdb4a77"}, {"id": "box-AP1", "position": {"x": 0.2003918, "y": 0.0, "z":
@ZdenekM
ZdenekM / ql_700.py
Created January 3, 2020 13:46
Brother QL-700: print QR code example
from brother_ql.conversion import convert
from brother_ql.backends.helpers import send
from brother_ql.raster import BrotherQLRaster
import qrcode
PX_WIDTH = 696
qr = qrcode.make('ARCOR2')
img = qr.get_image()