Skip to content

Instantly share code, notes, and snippets.

View johnwason's full-sized avatar

John Wason johnwason

  • Wason Technology, LLC
  • New York
View GitHub Profile
from RobotRaconteur.Client import *
import numpy as np
c = RRN.ConnectService("rr+tcp://localhost:59843?service=mp_robot")
robot_pose_type = RRN.GetStructureType("experimental.robotics.motion_program.RobotPose",c)
moveabsj_type = RRN.GetStructureType("experimental.robotics.motion_program.MoveAbsJCommand",c)
movej_type = RRN.GetStructureType("experimental.robotics.motion_program.MoveJCommand",c)
movel_type = RRN.GetStructureType("experimental.robotics.motion_program.MoveLCommand",c)
movec_type = RRN.GetStructureType("experimental.robotics.motion_program.MoveCCommand",c)
@johnwason
johnwason / abb_loaddata_to_spatialinertia.py
Created March 14, 2024 17:28
abb_loaddata_to_spatialinertia.py
import numpy as np
import general_robotics_toolbox as rox
# abb loaddata has the form [mass, [com_x, com_y, com_z], [aom_qw, aom_qx, aom_qy, aom_qz], ixx, iyy, izz]
# abb uses mm while spatial inertia uses m
abb_loaddata = [5,[1002,2003,0],[-0.00585693,0.595997,0.802901,-0.0101995],0.0349296,0.21552,0.250029]
mass = abb_loaddata[0]
com = np.array(abb_loaddata[1],dtype=np.float64)/1000.0
@johnwason
johnwason / experimental.tesseract_robotics.environment.robdef
Created October 23, 2023 17:36
tesseract_robotraconteur concept service definitions
service experimental.tesseract_robotics.environment
import com.robotraconteur.geometry
using com.robotraconteur.geometry.Pose
using com.robotraconteur.geometry.SpatialInertia
struct Visual
field pose origin
field varvalue geometry
@johnwason
johnwason / python_packaging.md
Last active September 13, 2023 09:23
Software Packaging for Robotics

Python Packaging Best Practices

Python is a versatile and popular programming language. According to the TIOBE index, it is currently the world's most popular programming language. It has found extensive use and engineering and scientific applications, including robotics. Python is popular because it has clear/flexible syntax, a "batteries included" standard library, easy interfacing to native code, and a massive ecosystem of packages providing additional functionality. This document provides an overview of best practices for packaging Python robotics software for distribution.

There are many tutorials, blog posts, and whitepapers on Python packaging. This guide is intended to provide a quick overview of the most important aspects of packaging, with references to more detailed guides.

@johnwason
johnwason / benchmark_rws_upload.py
Created October 25, 2022 19:27
benchmark_rws_upload
import abb_motion_program_exec_client as abb
import time
client = abb.MotionProgramExecClient(base_url = 'http://127.0.0.1')
ramdisk = client.get_ramdisk_path()
small_file = b'0'*1024
small_t1 = time.perf_counter()
client.upload_file(ramdisk + "/small.bin", small_file)
@johnwason
johnwason / library_eventloop.js
Created June 18, 2022 21:12
library_eventloop.js sigs
/**
* @license
* Copyright 2010 The Emscripten Authors
* SPDX-License-Identifier: MIT
*/
// Implementation of functions from emscripten/eventloop.h.
LibraryJSEventLoop = {
emscripten_unwind_to_js_event_loop: function() {
@johnwason
johnwason / gazebo_model_resource_locator.py
Created May 17, 2022 18:03
gazebo_model_resource_locator.py
import re
import traceback
import os
from tesseract_robotics.tesseract_common import ResourceLocator, SimpleLocatedResource
#resource locator class using GAZEBO_MODEL_PATH and model:// url
class GazeboModelResourceLocator(ResourceLocator):
def __init__(self):
super().__init__()
model_env_path = os.environ["GAZEBO_MODEL_PATH"]
self.model_paths = model_env_path.split(os.pathsep)
# Copyright (c) 2020, Rensselaer Polytechnic Institute, Wason Technology LLC
# 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
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# python -m pip install beautifulsoup4 requests numpy
import requests
from bs4 import BeautifulSoup
import traceback
from collections import namedtuple
import numpy as np
from datetime import datetime
import re
import time