def _getNode(self, op): n = None if self.myname in conf.cassandra_nodes: n = cassandra.Cassandra(self.myname) self._doOperation(n, op) if self.myname in conf.swift_nodes: n = swift.Swift(self.myname, True) self._doOperation(n, op) if self.myname in conf.proxy_nodes: n = swift.Swift(self.myname, False) self._doOperation(n, op) if self.myname in conf.other_nodes: n = other.Other(self.myname) self._doOperation(n, op)
def storageBackend(script): if len(script.args) <= 1: logger.error( "Storage backend must be specified, either 'swift', 's3', 'noop', or 'disk'" ) sys.exit(1) if script.args[1].lower() == "disk": import disk return disk.Disk(script.options.bucket, script.options.noop) if script.args[1].lower() == "noop": import noop return noop.NoOP(script.options.bucket, script.options.noop) if script.args[1].lower() == "s3": import s3 if len(script.args) > 2: region = script.args[2] else: region = "us-east-1" return s3.S3(script.options.bucket, script.options.sse_c_key, region, script.options.noop) if script.args[1].lower() == "swift": import swift return swift.Swift(script.options.bucket, script.options.noop) logger.error( "Invalid storage backend, must be 'swift', 's3', 'noop', or 'disk'") sys.exit(1)
def storageBackend(script): if len(script.args) <= 1: logger.error("Storage backend must be specified, either 'swift' or 's3'") sys.exit(1) if script.args[1].lower() == "noop": import noop return noop.NoOP(script.options.bucket, script.options.noop) if script.args[1].lower() == "s3": import s3 return s3.S3(script.options.bucket, script.options.keyprefix, script.options.noop) if script.args[1].lower() == "swift": import swift return swift.Swift(script.options.bucket, script.options.noop) logger.error("Invalid storage backend, must be 'swift', 's3', or 'noop'") sys.exit(1)
def storageBackend(script): if len(script.args) <= 1: logger.error( "Storage backend must be specified, either: disk, gcs, noop, s3, or swift" ) sys.exit(1) if script.args[1].lower() == "disk": import disk return disk.Disk(script.options.bucket, script.options.noop) if script.args[1].lower() == "noop": import noop return noop.NoOP(script.options.bucket, script.options.noop) if script.args[1].lower() == "s3": import s3 s3args = {"region": "us-east-1"} for i in script.args[2:]: fields = i.split("=") if len(fields) > 1: gcsargs[fields[0]] = fields[1] else: gcsargs["region"] = fields[0] return s3.S3(script.options.bucket, s3args["region"], script.options.noop) if script.args[1].lower() == "swift": import swift return swift.Swift(script.options.bucket, script.options.noop) if script.args[1].lower() == "gcs": import gcs gcsargs = {"project": "", "region": "us"} for i in script.args[2:]: fields = i.split("=") if len(fields) > 1: gcsargs[fields[0]] = fields[1] else: gcsargs["region"] = fields[0] return gcs.GCS(script.options.bucket, gcsargs["project"], gcsargs["region"], script.options.noop) logger.error( "Invalid storage backend, must be: disk, gcs, noop, s3, or swift") sys.exit(1)
T = robot.fkine(robot.qz) print(T) # IK T = SE3(0.7, 0.2, 0.1) * SE3.OA([0, 1, 0], [0, 0, -1]) sol = robot.ikine_LMS(T) # solve IK, ignore additional outputs print(sol.q) # display joint angles # FK shows that desired end-effector pose was achieved print(robot.fkine(sol.q)) qtraj = rtb.jtraj(robot.qz, sol.q, 50) robot.plot(qtraj.q, movie="panda1.gif") # URDF + Swift version dt = 0.050 # simulation timestep in seconds robot = rtb.models.URDF.Panda() print(robot) env = swift.Swift() # instantiate 3D browser-based visualizer env.launch("chrome") # activate it env.add(robot) # add robot to the 3D scene env.start_recording("panda2", 1 / dt) for qk in qtraj.q: # for each joint configuration on trajectory robot.q = qk # update the robot state env.step() # update visualization env.stop_recording() # ffmpeg -i panda2.webm -vf "scale=iw*.5:ih*.5" panda2.gif
@author Jesse Haviland """ import swift from math import pi import roboticstoolbox as rtb from spatialgeometry import Mesh from spatialmath import SO3, SE3 import numpy as np # TODO # rotate the rings according to the rotation axis, so that the axles # point the right way # Launch the simulator Swift env = swift.Swift() env.launch() path = rtb.path_to_datafile('data') g1 = Mesh(filename=str(path / 'gimbal-ring1.stl'), color=[34, 143, 201], scale=(1. / 3, ) * 3) g2 = Mesh(filename=str(path / 'gimbal-ring2.stl'), color=[31, 184, 72], scale=(1.1 / 3, ) * 3) g3 = Mesh(filename=str(path / 'gimbal-ring3.stl'), color=[240, 103, 103], scale=(1.1**2 / 3, ) * 3)