示例#1
0
    def MarkLinkpoint(self,
                      component_name,
                      linkpoint_name,
                      color='red',
                      marking_radius=0.01):
        '''Add a colored sphere to the linkpoint of a component to identify it during simulation. \nUse 'red', 'blue' or 'green'.'''
        if not self.use_helpers:
            return

        if color != 'blue' and color != 'green':
            color = 'red'

        if MiroAPI.API == 'AGX' and self.warning_print:
            print(
                'Warning: MiroModule.MarkLinkPoint is not stable in the AGX api, may cause unstable systems. Consider using MiroModule.DisableHelpers().'
            )

        texture = 'textures/markpattern_' + color + '.png'
        backup_color = [(color == 'red') * 1, (color == 'green') * 1,
                        (color == 'blue') * 1]

        comp = self.components[component_name]
        pos = comp.GetLinkPoint(linkpoint_name)
        ball = MiroAPI.add_sphereShape(False,
                                       marking_radius,
                                       pos,
                                       texture=texture,
                                       Collide=False,
                                       Fixed=False,
                                       color=backup_color)
        link = MiroAPI.LinkBodies_Hinge(comp.GetBody(), ball, pos, [0, 1, 0])

        self.hidden_bodies.append(ball)
        self.hidden_links.append(link)
示例#2
0
def DUMMY(rot=[0, 0, 0], pos=[0, 0, 0], Fixed=False, radius=0.025):
    body_ball = MiroAPI.add_sphereShape(False,
                                        radius,
                                        pos,
                                        texture='test_texture.png',
                                        scale=[0.07, 0.07],
                                        Collide=False)

    # Generate MiroComponent with above body
    COMPONENT = mc.MiroComponent(body_ball)
    COMPONENT.AddLinkPoint('A', [0, 0, 0], [0, 0, 0])
    COMPONENT.Rotate(rot)
    COMPONENT.MoveToPosition(pos)

    return COMPONENT
示例#3
0
 def AddToSystem(self, system):
     MiroAPI.add_boxShape(system, self.width, self.height, 0.05, self.position, 'textures/notifboard.png', rotX=self.tilt_angle, rotY=self.turn_angle, rotDegrees=False)
     self.bulb = MiroAPI.add_sphereShape(system, self.radius, self.position+self.bulb_pos, 'textures/notifbulb.png', rotX=self.tilt_angle+np.pi/2, rotY=self.turn_angle, rotDegrees=False)
示例#4
0
def eyeball(MiroSystem, pos, radius=0.1):
    MiroAPI.add_sphereShape(MiroSystem, radius, [pos[0], pos[1]+radius, pos[2]], texture='eyeball.png', density = 100, Fixed=False, rotY=-30)
示例#5
0
def pokeball(MiroSystem, pos, rot = 0):
    r = 0.05

    MiroAPI.add_sphereShape(MiroSystem, r, [pos[0], pos[1]+r, pos[2]], texture='pokeball.jpg', density = 100, Fixed=False, rotY=rot)