Exemple #1
0
    def _spawnCube(self):
        # Now lets spawn an object
        obj = scene.SceneObject()
        position = self._robot._main_part._node.position
        robotOrient = self._robot._main_part._node.orientation

        # 30cm below robot
        offset = ogre.Vector3(0.4, 0.30 - (self._count * 0.2), 0)
        position = position + robotOrient * offset 
        
        cfg = {
            'name' : self._name + str(self._count),
            'position' : position,
            'Graphical' : {
                'mesh' : 'cylinder.mesh', 
                'scale' : [0.127, 0.0127, 0.0127],
                'material' : 'Simple/Yellow',
                'orientation' : robotOrient 
            },
            'Physical' : {
                'mass' : 0.005,
                'orientation' : robotOrient,
                'Shape' : {
                    'type' : 'cylinder',
                    'radius' : 0.0127,
                    'height' : 0.0127
                }
            }
        }
        obj.load((self._scene, None, cfg))
        self._scene._objects.append(obj)
Exemple #2
0
    def _spawnMarker(self):
        # Now lets spawn an object
        obj = scene.SceneObject()
        position = self._robot._main_part._node.position
        robotOrient = self._robot._main_part._node.orientation

        # 30cm below robot
        offset = ogre.Vector3(0.15, 0.30 - (self._count * 0.2), -0.10)
        position = position + robotOrient * offset 
        orientation = ogre.Quaternion(ogre.Degree(90), ogre.Vector3.UNIT_X)

        cfg = {
            'name' : self._name + str(self._count),
            'position' : position,
            'Graphical' : {
                'mesh' : 'cylinder.mesh', 
                'scale' : [0.0762, 0.0127, 0.0127],
                'material' : 'Simple/Red',
                'orientation' : orientation * robotOrient
            },
            'Physical' : {
                'mass' : 0.01, 
                'center_of_mass' : [0, 0, 0.0127], # Top heavy
                'orientation' : orientation * robotOrient,
                'Shape' : {
                    'type' : 'cylinder',
                    'radius' : 0.0127,
                    'height' : 0.0762
                }
            }
        }
        obj.load((self._scene, None, cfg))
        self._scene._objects.append(obj)