Beispiel #1
0
    def __init__(self,
                 parent,
                 index,
                 onoff='on',
                 hidden='false',
                 type='XY',
                 stacked='false',
                 bar_hgap=0.00,
                 **kwargs):
        GraceObject.__init__(self, parent, locals())
        self.legend = Legend(self)
        self.frame = Frame(self)
        self.xaxis = Axis(self, 'x')
        self.yaxis = Axis(self, 'y')
        self.altxaxis = Axis(self, 'x', 'alt', 'off')
        self.altyaxis = Axis(self, 'y', 'alt', 'off')
        self.title = Title(self)
        self.subtitle = Subtitle(self)
        self.view = View(self)
        self.world = World(self)

        self.datasets = []
        self._datasetIndex = INDEX_ORIGIN

        self.drawing_objects = []
Beispiel #2
0
def demo1():
    theta = Axis('th', unit=u'deg')
    theta2 = Axis('tth', unit=u'deg')
    theta.position = 5.
    theta.speed = 10.
    theta2.position = 24
    theta2.speed = 5

    move(theta2, 30, theta, 40)
Beispiel #3
0
    def __determine_y_axes(self):
        lowest_primary_y_value = None
        highest_primary_y_value = None
        lowest_secondary_y_value = None
        highest_secondary_y_value = None

        for data_set in self.data_sets:

            lowest_y_value = data_set.get_lowest_value()
            highest_y_value = data_set.get_highest_value()

            if self.additional_axis_meta_data.get_axis_meta_data_item(
                    data_set.name).axis_type == AxisType.PRIMARY:

                if lowest_primary_y_value is None:
                    lowest_primary_y_value = lowest_y_value
                else:
                    if lowest_y_value < lowest_primary_y_value:
                        lowest_primary_y_value = lowest_y_value

                if highest_primary_y_value is None:
                    highest_primary_y_value = highest_y_value
                else:
                    if highest_y_value > highest_primary_y_value:
                        highest_primary_y_value = highest_y_value

            elif self.additional_axis_meta_data.get_axis_meta_data_item(
                    data_set.name).axis_type == AxisType.SECONDARY:

                if lowest_secondary_y_value is None:
                    lowest_secondary_y_value = lowest_y_value
                else:
                    if lowest_y_value < lowest_secondary_y_value:
                        lowest_secondary_y_value = lowest_y_value

                if highest_secondary_y_value is None:
                    highest_secondary_y_value = highest_y_value
                else:
                    if highest_y_value > highest_secondary_y_value:
                        highest_secondary_y_value = highest_y_value

        y_data_type, y_low, y_high = self.__evaluate_axis_data_by_type(
            lowest_primary_y_value, highest_primary_y_value)
        self.y_primary_axis = Axis(y_low, y_high, y_data_type)

        y_data_type, y_low, y_high = self.__evaluate_axis_data_by_type(
            lowest_secondary_y_value, highest_secondary_y_value)
        self.y_secondary_axis = Axis(y_low, y_high, y_data_type)
Beispiel #4
0
    def __init__(self, address):

        super().__init__(address)

        self.about = About(self)
        self.access = Access(self)
        self.adjustment = Adjustment(self)
        self.axis = Axis(self)
        self.displacement = Displacement(self)
        self.ecu = Ecu(self)
        self.functions = Functions(self)
        self.manual = Manual(self)
        self.network = Network(self)
        self.nlc = Nlc(self)
        self.pilotlaser = Pilotlaser(self)
        self.realtime = Realtime(self)
        self.system = System(self)
        self.system_service = System_service(self)
        self.update = Update(self)
        try:
            self.streaming = Streaming(self)
        except NameError as e:
            if "Streaming" in str(e):
                print("Warning: Streaming is not supported on your platform")
            else:
                raise e
Beispiel #5
0
def print_axis_and_parabola(original,
                            threshold,
                            stepRho=1,
                            stepTheta=np.pi / 180):
    """
    Prints axis and parabola in the original image
    """
    # original image
    image = cv2.cvtColor(original.copy(), cv2.COLOR_GRAY2RGB)

    # axis
    axis = Axis(original, threshold)
    original_axis = axis.get_axis()
    rotate_angle, axis_90degree = axis.get_axis_in_90degree()

    axis.draw_axis(image)
    axis.draw_axis_origin(image)

    # parabola
    parabola = Parabola(original, rotate_angle, original_axis,
                        axis.axis_origin)
    a, b, c = parabola.get_parabola()
    parabola.draw_parabola(image)

    return image
Beispiel #6
0
 def __init__(self):
     pygame.sprite.Sprite.__init__(self)
     self.image, self.rect = Utility.load_image_file('player.png')
     grect = Utility.screen.get_rect()
     self.rect.x = (grect.width - self.rect.width) / 2
     self.rect.y = (grect.height - self.rect.height)
     self.axis = Axis()
     self.speed = 5
     self.speed_slow = 2
Beispiel #7
0
    def CreateCenter(self, vector, colour):

        # Create the axis, add the geometry and collision
        axis = Axis(self.name, vector, colour, default=True)
        axis.AddGeometry(NodePath(Box(0.1, 0.1, 0.1)), sizeStyle=NONE)
        axis.AddCollisionSolid(CollisionSphere(0, 0.1), sizeStyle=NONE)
        axis.reparentTo(self)

        return axis
Beispiel #8
0
 def __determine_x_axis(self):
     lowest_x_value, highest_x_value = self.data_sets.get_lowest_and_highest_key(
     )
     x_data_type, x_low, x_high = self.__evaluate_axis_data_by_type(
         lowest_x_value, highest_x_value)
     # x_low = lowest_x_value
     # x_high = highest_x_value
     # #self.x_axis = Axis(x_low, x_high, x_data_type, self.x_axis_format)
     self.x_axis = Axis(lowest_x_value, highest_x_value, x_data_type,
                        self.x_axis_format)
Beispiel #9
0
    def __init__(self):
        ''' connect to midi device and set up ros
        '''
        self.sp = SmartPAD('SmartPAD')
        self.axis = Axis()
        self.axis.init()
        self.web = pages.Pages()

        rospy.loginfo("Using input device %s" % self.sp.device)
        os.environ['PORT'] = '8081'
Beispiel #10
0
    def addAxis(self, key, **kwprops):
        """
        Add a new axis to the plot, with its name given by key. If key already exists,
        do nothing.

        Return the axis, regardless of whether it already exists or was just created.
        """

        if key not in self._axes.keys():
            self._axes[key] = Axis(self._figure.canvas(), self, **kwprops)
            self.addChild(self._axes[key])
        return self._axes[key]
Beispiel #11
0
 def CreateCamCircle( self, colour, radius ):
     
     # Create the geometry and collision
     circle = self.CreateCircle( colour, radius )
     collPoly = CollisionPolygon( Point3(-1.2, 0, -1.2), Point3(-1.25, 0, 1.25), Point3(1.25, 0, 1.25), Point3(1.25, 0, -1.25) )
     
     # Create the axis, add the geometry and collision
     self.camAxis = Axis( self.name, CAMERA_VECTOR, colour, planar=True, default=True )
     self.camAxis.AddGeometry( circle,  sizeStyle=SCALE )
     self.camAxis.AddCollisionSolid( collPoly, sizeStyle=SCALE )
     self.camAxis.reparentTo( self )
     
     return self.camAxis
Beispiel #12
0
def test_sig(vhdl_output_path=None):

    axis_y = Axis(32)
    axis_x = Axis(32)
    y_pow, y_fac, y_exp = [Signal(intbv(0)[32:]) for i in range(3)]
    clk = Signal(bool(0))
    clk_gen_1 = clk_gen(clk, period=10)
    reset = ResetSignal(0, active=1, async=False)
    # power_1 = power(clk, reset, y_pow, x, prec, end, start)
    # factorial_1 = factorial(clk, reset, y_fac, prec, end, start)
    # exponential_1 = exponential(clk, reset, y_exp, x, prec, end, start)
    sigmoid_1 = sigmoid(clk, reset, axis_y, axis_x, 4, fraction=16)

    @instance
    def reset_gen():
        reset.next = 0
        yield delay(4000)
        yield clk.negedge
        reset.next = 1


    @instance
    def stimulus():
        axis_x.tdata.next = 0
        yield delay(1000)
        print("sig z", axis_x.tdata, "o prec 4 =", axis_y.tdata)
        axis_x.tdata.next = 2
        yield delay(1500)
        print("sig z", axis_x.tdata, "o prec 4 =", axis_y.tdata)
        axis_x.tdata.next = 8
        yield delay(1500)
        print("sig z", axis_x.tdata, "o prec 4 =", axis_y.tdata)
        raise StopSimulation()

    if vhdl_output_path is not None:
        sigmoid_1.convert(hdl='VHDL', path=vhdl_output_path)

    return instances()
Beispiel #13
0
 def CreateSquare( self, vec, colour ):
     
     # Create the geometry and collision
     self.square = pm.NodePath( Square( 0.2, 0.2, pm.Vec3(0, 1, 0) ) )
     self.square.setBillboardPointEye()
     collSphere = pm.CollisionSphere( 0, 0.125 )
     
     # Create the axis, add the geometry and collision
     axis = Axis( self.name, CAMERA_VECTOR, colour, planar=True, default=True )
     axis.AddGeometry( self.square, sizeStyle=NONE )
     axis.AddCollisionSolid( collSphere, sizeStyle=NONE )
     axis.reparentTo( self )
     
     return axis
Beispiel #14
0
    def CreateBox(self, vector, colour):

        # Create the geometry and collision
        line = NodePath(Line((0, 0, 0), vector))
        box = NodePath(Box(0.1, 0.1, 0.1, vector * 0.05))
        collSphere = CollisionSphere(Point3(vector * -0.05), 0.1)

        # Create the axis, add the geometry and collision
        axis = Axis(self.name, vector, colour)
        axis.AddGeometry(line, colour=GREY, highlight=False, sizeStyle=SCALE)
        axis.AddGeometry(box, vector, colour)
        axis.AddCollisionSolid(collSphere, vector)
        axis.reparentTo(self)

        return axis
Beispiel #15
0
 def CreateArrow( self, vec, colour ):
     
     # Create the geometry and collision
     vec.normalize()
     line = pm.NodePath( Line( (0, 0, 0), vec ) )
     cone = pm.NodePath( Cone( 0.05, 0.25, axis=vec, origin=vec * 0.125 ) )
     collTube = pm.CollisionTube( (0,0,0), pm.Point3( vec ) * 0.95, 0.05 )
     
     # Create the axis, add the geometry and collision
     axis = Axis( self.name, vec, colour )
     axis.AddGeometry( line, sizeStyle=SCALE )
     axis.AddGeometry( cone, vec, colour )
     axis.AddCollisionSolid( collTube, sizeStyle=TRANSLATE_POINT_B )
     axis.reparentTo( self )
     
     return axis
Beispiel #16
0
    def __init__(self, name, puzzle_string):
        self.name = name
        # string of 81 digits representing the original puzzle
        self.puzzle_string = puzzle_string
        # string of 81 digits representing valid, unique solution
        self.solution = ""
        # list of strings representing valid but not necessarily unique solutions
        self.valid_completion_list = []
        # string representing the end of an attempt to solve an invalid puzzle
        self.final_string = ""
        # dictionary of the 81 boxes in the puzzle
        self.box_map = {}
        # dictionary of the 27 row/column/square axes
        self.axis_map = {}
        self.solved = False
        # All valid puzzles have at least 17 clues initially
        self.too_few_clues = False
        self.no_solution = False
        self.multiple_solution = False
        self.error_description = ""
        # List of functions applied to solve puzzle and whether progress made
        self.method_log = []
        # Difficulty level
        self.difficulty = ""

        # initialize axis map
        for i in range(0, 27):
            self.axis_map[i] = Axis(i)

        # initialize box map
        for i in range(0, 81):
            self.box_map[i] = Box(i)

        # put the known box values into the box map
        for i in range(0, 81):
            value = int(puzzle_string[i])
            if value != 0:
                self.box_map[i].given = True
                # make sure value can legally be put in this box
                if value in self.box_map[i].tally:
                    self.update_new_known(i, value)
                else:
                    self.no_solution = True
                    self.error_description = f'Unable to initialize: ' \
                                             f'{value} cannot be placed in row {self.box_map[i].row +1}, ' \
                                             f'column  {self.box_map[i].col + 1}'
                    break
Beispiel #17
0
 def __init__(self, labels, screen_width, screen_height):
     self.screen_width = screen_width / 2
     self.screen_height = screen_height
     self.screen = pygame.Surface((self.screen_width, self.screen_height))
     self.xliftoff = 50
     self.yliftoff = 50
     self.bar_width = 17
     self.labels = labels
     self.axes = Axis(self.screen, self.screen_width, self.screen_height,
                      self.xliftoff, self.yliftoff, self.bar_width)
     self.movement = 0
     self.profile = 0
     self.power = 0
     self.charts = 0
     pub.subscribe(self.movement_handler, "gamepad.movement")
     pub.subscribe(self.profile_handler, "gamepad.profile")
     pub.subscribe(self.power_handler, "Thruster.Power")
Beispiel #18
0
 def CreateRing( self, vector, colour, rot ):
     
     # Create an arc
     arc = Arc( numSegs=32, degrees=180, axis=Vec3(0, 0, 1) )
     arc.setH( 180 )
     
     # Create the axis from the arc
     axis = Axis( self.name, vector, colour )
     axis.AddGeometry( arc, sizeStyle=SCALE )
     axis.AddCollisionSolid( self.collSphere, sizeStyle=SCALE )
     axis.reparentTo( self )
     
     # Create the billboard effect and apply it to the arc. We need an
     # extra NodePath to help the billboard effect so it orients properly.
     hlpr = NodePath( 'helper' )
     hlpr.setHpr( rot )
     hlpr.reparentTo( self )
     arc.reparentTo( hlpr )
     bbe = BillboardEffect.make( Vec3(0, 0, 1), False, True, 0, 
                                 self.camera, (0, 0, 0) )
     arc.setEffect( bbe )
     
     return axis
Beispiel #19
0
    def __init__(self):

        self.axis = Axis(verbose=0)
        self.axis.init()
        self.poser = ArmPos()
        self.csvf = open('kin.csv', 'wb')
        self.csv  = csv.writer(self.csvf)

        #complicated reset just for fun with Python comprehensions
        self.angles = [0.2,  1.4, 0.2,  1.5]
        self.rtinvert = [ 1.0, 1.0, 1.0, 1.0]
        self.lfinvert = [ 1.0,-1.0, 1.0,-1.0]
        self.lch = ['la0', 'la1', 'la2', 'la3']
        self.rch = ['ra0', 'ra1', 'ra2', 'ra3']
        data = [ Datum(j[0],j[1]*j[2]) for j in zip(self.rch,self.angles,self.rtinvert)]
	self.axis.process_keys(data)
        rospy.sleep(0.5)
        data = [ Datum(j[0],j[1]*j[2]) for j in zip(self.lch,self.angles,self.lfinvert)]
	self.axis.process_keys(data)

        self.pose = [0.2,  1.4, 0.2,  1.5, 0.2,-1.4, 0.2,-1.5]
        self.tfBuffer = tf2_ros.Buffer()
        self.tfListener = tf2_ros.TransformListener(self.tfBuffer)
        self.poser.subscribe(Kinemate.leftandright)
Beispiel #20
0
def demo2():
    theta = Axis('th', unit=u'deg')
    theta2 = Axis('tth', unit=u'deg')
    chi = Axis('chi', unit='deg')
    phi = Axis('phi', unit='deg')
    mu = Axis('mu', unit='deg')
    gam = Axis('gam', unit='deg')
    theta.position = 10.
    theta.speed = 9.
    theta2.position = 10.
    theta2.speed = 8.
    chi.position = 10.
    chi.speed = 7.
    phi.position = 10.
    phi.speed = 6.
    mu.position = 10.
    mu.speed = 5.
    gam.position = 10.
    gam.speed = 4.
    move(theta, 90.5, theta2, 45.5, chi, 55.2, phi, 35.5, mu, 27.9, gam, 12.40)
Beispiel #21
0
GPIO.setup(RPi_pins["gotCandy"], GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(RPi_pins["coinInserted"], GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
""" create objects of candy grabber """

# create motors
Motor1 = Motor(m1)
Motor2 = Motor(m2)
Motor3 = Motor(m3)

# create endswitches
EndDU = MockSwitch()
EndBF = RealSwitch(RPi_pins["endBack"], RPi_pins["endFront"])
EndLR = RealSwitch(RPi_pins["endLeft"], RPi_pins["endRight"])

# create axis
AxisBF = Axis(Motor2, ("back", "front"), EndBF)
AxisLR = Axis(Motor1, ("left", "right"), EndLR)
AxisDU = Axis(Motor3, ("down", "up"), EndDU)

# create Candy Grabber object
CG = CandyGrabber(AxisBF, AxisLR, AxisDU)
""" //////////////////// methods /////////////////////// """


def move_claw(direction):
    """
    method move_claw for subhandler_direction in opcua server
    """

    print("move method call with parameter: ", direction)
Beispiel #22
0
 def ticks(self, inc=None, size=None):
     self.add_opts('axis', Axis().ticks(inc=inc, size=size))
     return self
Beispiel #23
0
    rbd.forwardKinematics(mb, mbc)

    X_s = sva.PTransformd(sva.RotY(-np.pi / 2.), e.Vector3d(0.1, 0., 0.))
    mbv = MultiBodyViz(mbg,
                       mb,
                       endEffectorDict={'b4': (X_s, 0.1, (0., 1., 0.))})

    # test MultiBodyViz
    from tvtk.tools import ivtk
    viewer = ivtk.viewer()
    viewer.size = (640, 480)
    mbv.addActors(viewer.scene)
    mbv.display(mb, mbc)

    # test axis
    from axis import Axis
    a1 = Axis(text='test', length=0.2)
    a1.addActors(viewer.scene)
    a1.X = sva.PTransformd(sva.RotX(np.pi / 2.), e.Vector3d.UnitX())

    # test vector6d
    from vector6d import ForceVecViz, MotionVecViz
    M = sva.MotionVecd(e.Vector3d(0.2, 0.1, 0.), e.Vector3d(0.1, 0., 0.2))
    F = sva.ForceVecd(e.Vector3d(-0.2, -0.1, 0.), e.Vector3d(-0.1, 0., -0.2))
    MV = MotionVecViz(M, a1.X)
    FV = ForceVecViz(
        F, sva.PTransformd(sva.RotX(np.pi / 2.),
                           e.Vector3d.UnitX() * 1.4))
    MV.addActors(viewer.scene)
    FV.addActors(viewer.scene)
Beispiel #24
0
 def __determine_y_axis(self):
     lowest_y_value, highest_y_value = self.data_sets.get_lowest_and_highest_value(
     )
     y_data_type, y_low, y_high = self.__evaluate_axis_data_by_type(
         lowest_y_value, highest_y_value)
     self.y_primary_axis = Axis(y_low, y_high, y_data_type, None)
Beispiel #25
0
 def ax_labels(self, xlabel='', ylabel='', **kwargs):
     """Sets the axis X and Y labels"""
     self.add_opts('axis', Axis().labels(xlabel, ylabel, **kwargs))
     return self
Beispiel #26
0
def demo0():
    theta = Axis('th', unit=u'deg')
    theta.position = 5.
    theta.speed = 10.

    move(theta, 50)
Beispiel #27
0
from cothread import catools as ca
from axis import Axis
from coordsys import CoordSys
from controller import make_controller
from trajectory import Trajectory

# number of decimals to use in verifying positions
# cant be very high on a clipper since it seems to
# set 'in position' a little early
DECIMALS = 2

brick_pv_root = bpr = 'BRICK1:'

brick_axes = {
    'm1': Axis(bpr, 'PMAC_BRICK_TEST:MOTOR1', 1, 0),
    'm2': Axis(bpr, 'PMAC_BRICK_TEST:MOTOR2', 2, 0),
    'm3': Axis(bpr, 'PMAC_BRICK_TEST:MOTOR3', 3, 0),
    'm4': Axis(bpr, 'PMAC_BRICK_TEST:MOTOR4', 4, 0),
    'm5': Axis(bpr, 'PMAC_BRICK_TEST:MOTOR5', 5, 0),
    'm6': Axis(bpr, 'PMAC_BRICK_TEST:MOTOR6', 6, 0),
    'm7': Axis(bpr, 'PMAC_BRICK_TEST:MOTOR7', 7, 0),
    'm8': Axis(bpr, 'PMAC_BRICK_TEST:MOTOR8', 8, 0),
    'A2': Axis(bpr, 'BRICK1CS2:A', 1, 2),
    'B2': Axis(bpr, 'BRICK1CS2:B', 2, 2),
    'A3': Axis(bpr, 'BRICK1CS3:A', 1, 3),
    'B3': Axis(bpr, 'BRICK1CS3:B', 2, 3),
    'X3': Axis(bpr, 'BRICK1CS3:X', 7, 3),
    'Y3': Axis(bpr, 'BRICK1CS3:Y', 8, 3)
}

brick_groups = {
Beispiel #28
0
 def limits(self, xmin=None, xmax=None, ymin=None, ymax=None):
     """Sets up the limits that the plot is showed."""
     self.add_opts('axis', Axis().limits(xmin, xmax, ymin, ymax))
     return self