def __init__(self, name=None): SensorCreator.__init__(self, name, "morse/sensors/odometry", \ "OdometryClass", "odometry") mesh = Cylinder("OdometryCylinder") mesh.scale = (.02, .02, .02) mesh.color(.5, .5, .5) self.append(mesh)
def __init__(self, name=None): SensorCreator.__init__(self, name, "morse/sensors/pose", \ "PoseClass", "pose") mesh = Cube("PoseCube") mesh.scale = (.04, .04, .02) mesh.color(.8, .3, .1) self.append(mesh)
def __init__(self, name=None): SensorCreator.__init__(self, name, "morse/sensors/imu", \ "ImuClass", "imu") mesh = Cube("IMUCube") mesh.scale = (.04, .04, .02) mesh.color(.3, .9, .6) self.append(mesh)
def __init__(self, name=None): SensorCreator.__init__(self, name, "morse/sensors/accelerometer", \ "AccelerometerClass", "accelerometer") mesh = Cube("AccelerometerCube") mesh.scale = (.04, .04, .02) mesh.color(.3, .9, .6) self.append(mesh)
def __init__(self, name=None): SensorCreator.__init__(self, name, "morse.sensors.battery_state.BatteryStateSensor", "battery") mesh = Cylinder("BatteryCylinder") mesh.scale = (.01, .01, .04) mesh.color(.2, .2, .2) self.append(mesh) self.properties(DischargingRate = 0.05)
def __init__(self, name=None): SensorCreator.__init__(self, name,"morse/sensors/gyroscope", \ "GyroscopeClass", "gyroscope") mesh = Sphere("GyroscopeSphere") mesh.scale = (.04, .04, .01) mesh.color(.8, .4, .1) self.append(mesh)
def __init__(self, name=None): SensorCreator.__init__(self, name, "morse/sensors/thermometer", \ "ThermometerClass", "thermometer") mesh = Cylinder("ThermometerCylinder") mesh.scale = (.02, .02, .04) mesh.color(0, .6, .5) self.append(mesh)
def __init__(self, name=None, cclass="VideoCameraClass", \ cpath="morse/sensors/video_camera", bname = "video_camera"): SensorCreator.__init__(self, name, cpath, cclass, bname) camera = Camera("CameraRobot") camera.name = "CameraRobot" self.append(camera) self.properties(cam_width = 256, cam_height = 256, cam_focal = 35.0, \ capturing = True, Vertical_Flip = True) # set the frequency to 3 (20ips for ticrate = 60Hz) self.frequency(3) # add toggle capture action (`Space` key) bpymorse.add_sensor(type="KEYBOARD") obj = bpymorse.get_context_object() sensor = obj.game.sensors[-1] sensor.key = 'SPACE' bpymorse.add_controller(type='LOGIC_AND') controller = obj.game.controllers[-1] bpymorse.add_actuator(type='PROPERTY') actuator = obj.game.actuators[-1] actuator.mode = 'TOGGLE' actuator.property = 'capturing' controller.link(sensor = sensor, actuator = actuator) # looking in +x self.rotate(x=math.pi/2, z=-math.pi/2) # append CameraMesh with its textures imported_objects = self.append_meshes(['CameraMesh'], "video_camera") # TODO fix the CameraMesh location and rotation in video_camera.blend camera_mesh = imported_objects[0] camera_mesh.rotation_euler = (math.pi/2, -math.pi/2, 0) camera_mesh.location = (0, 0, 0.015)
def __init__(self, name=None): SensorCreator.__init__(self, name) mesh = Cylinder("BatteryCylinder") mesh.scale = (.01, .01, .04) mesh.color(.2, .2, .2) self.append(mesh) self.properties(DischargingRate = 0.05)
def __init__(self, name=None): SensorCreator.__init__(self, name, "morse/sensors/stereo_unit", \ "StereoUnitClass", "stereo_unit") mesh = Cube("StereoUnitCube") mesh.scale = (.025, .24, .01) mesh.color(.8, .8, .8) self.append(mesh)
def __init__(self, name=None): SensorCreator.__init__(self, name) self.camera = Camera("CameraRobot") self.camera.name = "CameraRobot" self.append(self.camera) self.properties(cam_width = 256, cam_height = 256, cam_focal = 35.0, capturing = True, Vertical_Flip = True) # set the frequency to 20 Hz self.frequency(20) # add toggle capture action (`Space` key) bpymorse.add_sensor(type="KEYBOARD") obj = bpymorse.get_context_object() sensor = obj.game.sensors[-1] sensor.key = 'SPACE' bpymorse.add_controller(type='LOGIC_AND') controller = obj.game.controllers[-1] bpymorse.add_actuator(type='PROPERTY') actuator = obj.game.actuators[-1] actuator.mode = 'TOGGLE' actuator.property = 'capturing' controller.link(sensor = sensor, actuator = actuator) # looking in +X SensorCreator.rotate(self, x=math.pi/2, z=math.pi/2) # append CameraMesh with its textures self.append_meshes(['CameraMesh'], "camera") self.rotate(z=math.pi)
def __init__(self, name=None): SensorCreator.__init__(self, name, \ "morse.sensors.laserscanner.LaserScannerRotationZ",\ "velodyne") # set components-specific properties self.properties(Visible_arc = True, laser_range = 50.0, \ scan_window = 31.500, resolution = 0.5) """ # do it in `morse.sensors.velodyne` # Add Always (use_true_level) - And - Motion (rotation z: 0.017453) bpymorse.add_sensor(type='ALWAYS') obj = bpymorse.get_context_object() sensor = obj.game.sensors[-1] sensor.use_pulse_true_level = True bpymorse.add_controller(type='LOGIC_AND') controller = obj.game.controllers[-1] # Motion (rotation z: 0.017453) bpymorse.add_actuator(type='MOTION') actuator = obj.game.actuators[-1] actuator.offset_rotation.z = math.radians(1) controller.link(sensor = sensor, actuator = actuator) """ # append velodyne mesh, from MORSE_COMPONENTS/sensors/velodyne.blend imported_objects = self.append_meshes(['VelodyneMesh', 'Arc_31']) # TODO fix the VelodyneMesh location in velodyne.blend (z=1.2m!) velodyne_mesh = self.get_child('VelodyneMesh', imported_objects) velodyne_mesh.location.z = 0
def __init__(self, name=None): SensorCreator.__init__(self, name, "morse/sensors/gps", \ "GPSClass", "gps") mesh = Sphere("GPSSphere") mesh.scale = (.04, .04, .01) mesh.color(.5, .5, .5) self.append(mesh)
def properties(self, **kwargs): SensorCreator.properties(self, **kwargs) if 'collision_property' in kwargs: try: sensor = self._bpy_object.game.sensors[-1] sensor.property = kwargs['collision_property'] except KeyError: pass
def __init__(self, name=None): SensorCreator.__init__(self, name, "nuclear_radiation_sensor.sensors.nuclear_radiation.NuclearRadiation") mesh = Cube("SensorCube") mesh.scale = (0.016, .028, .01) mesh.color(0.8, 0.0, 0.0) self.append(mesh)
def __init__(self, name=None): SensorCreator.__init__(self, name) mesh = Cylinder("ProximityCylinder") mesh.scale = (.02, .02, .02) mesh.color(.5, .5, .5) self.append(mesh) self.properties(Range = 30.0, Track = "Robot_Tag") self.frequency(12)
def __init__(self, name="Kinect"): SensorCreator.__init__(self, name, "morse.sensors.kinect.Kinect", "kinect") mesh = Cube("KinectMesh") mesh.scale = (.02, .1, .02) mesh.color(.8, .8, .8) self.append(mesh) self.video_camera = VideoCamera('rgb') self.video_camera.properties(cam_width = 128, cam_height=128) self.depth_camera = DepthCamera('depth') #self.depth_camera.properties(Class='DepthVideoCamera') self.depth_camera.properties(cam_width = 128, cam_height=128) self.append(self.video_camera) self.append(self.depth_camera) # TODO find Kinect spec for cameras positions self.video_camera.location = (.06, +.08, .04) self.depth_camera.location = (.06, -.08, .04)
def properties(self, **kwargs): self.select() # We may be use it before the definition of radar # But angle and distance can only be defined by user, in case # where we are sure that Radar is well defined try: radar = self._bpy_object.game.sensors["Radar"] if 'Angle' in kwargs: radar.angle = kwargs['Angle'] if 'Distance' in kwargs: radar.distance = kwargs['Distance'] if 'Freq' in kwargs: radar.freq = kwargs['Freq'] except KeyError: pass SensorCreator.properties(self, **kwargs)
def __init__(self, name="Kinect"): SensorCreator.__init__(self, name, "morse.sensors.kinect.Kinect", "kinect") mesh = Cube("KinectMesh") mesh.scale = (.02, .1, .02) mesh.color(.8, .8, .8) self.append(mesh) self.video_camera = VideoCamera('rgb') self.video_camera.properties(cam_width=128, cam_height=128) self.depth_camera = DepthCamera('depth') #self.depth_camera.properties(Class='DepthVideoCamera') self.depth_camera.properties(cam_width=128, cam_height=128) self.append(self.video_camera) self.append(self.depth_camera) # TODO find Kinect spec for cameras positions self.video_camera.location = (.06, +.08, .04) self.depth_camera.location = (.06, -.08, .04)
def __init__(self, name="Kinect"): # meta sensor composed of 2 cameras (rgb and depth) SensorCreator.__init__(self, name, "morse.core.sensor.Sensor", "kinect") mesh = Cube("KinectMesh") mesh.scale = (.02, .1, .02) mesh.color(.8, .8, .8) self.append(mesh) self.video_camera = VideoCamera('rgb') self.video_camera.properties(cam_width = 128, cam_height=128) self.depth_camera = DepthCamera('depth') self.depth_camera.properties(classpath='morse.sensors.depth_camera.DepthVideoCamera') self.depth_camera.properties(cam_width = 128, cam_height=128, Vertical_Flip=True) self.append(self.video_camera) self.append(self.depth_camera) # TODO find Kinect spec for cameras positions self.video_camera.location = (.06, +.08, .04) self.depth_camera.location = (.06, -.08, .04)
def __init__(self, name=None): SensorCreator.__init__(self, name) mesh = Cylinder("SearchAndRescueCylinder") mesh.scale = (.15, .04, .04) mesh.color(.2, .8, .6) mesh.rotate(y = math.pi / 2) self.append(mesh) self.frequency(6) self.properties(Heal_range = 2.0, Abilities = "1,2") # add Radar freq: 3 Hz, prop: Injured, angle: 60.0, distance: 10.0 bpymorse.add_sensor(type="RADAR", name="Radar") obj = bpymorse.get_context_object() sensor = obj.game.sensors[-1] sensor.angle = 60.0 sensor.distance = 10.0 sensor.use_pulse_true_level = True self._set_sensor_frequency(sensor, 20) sensor.property = "Injured" # link it to the Python controller controller = obj.game.controllers[-1] controller.link(sensor = sensor)
def __init__(self, name=None): SensorCreator.__init__(self, name) mesh = Cylinder("SearchAndRescueCylinder") mesh.scale = (.15, .04, .04) mesh.color(.2, .8, .6) mesh.rotate(y = math.pi / 2) self.append(mesh) self.frequency(6) self.properties(Heal_range = 2.0, Abilities = "1,2") # add Radar freq: 3 Hz, prop: Injured, angle: 60.0, distance: 10.0 bpymorse.add_sensor(type="RADAR", name="Radar") obj = bpymorse.get_context_object() sensor = obj.game.sensors[-1] sensor.angle = 60.0 sensor.distance = 10.0 sensor.use_pulse_true_level = True sensor.frequency = 20 sensor.property = "Injured" # link it to the Python controller controller = obj.game.controllers[-1] controller.link(sensor = sensor)
def __init__(self, name="Kinect"): # meta sensor composed of 2 cameras (rgb and depth) SensorCreator.__init__(self, name, "morse.core.sensor.Sensor", "kinect") mesh = Cube("KinectMesh") mesh.scale = (.02, .1, .02) mesh.color(.8, .8, .8) self.append(mesh) self.video_camera = VideoCamera('rgb') self.video_camera.properties(cam_width=128, cam_height=128) self.depth_camera = DepthCamera('depth') self.depth_camera.properties( classpath='morse.sensors.depth_camera.DepthVideoCamera') self.depth_camera.properties(cam_width=128, cam_height=128, Vertical_Flip=True) self.append(self.video_camera) self.append(self.depth_camera) # TODO find Kinect spec for cameras positions self.video_camera.location = (.06, +.08, .04) self.depth_camera.location = (.06, -.08, .04)
def __init__(self, name=None): """ Sensor to detect objects colliding with the current object, with more settings than the Touch sensor """ SensorCreator.__init__(self, name) obj = bpymorse.get_context_object() # Sensor, Collision Sensor, detects static and dynamic objects but # not the other collision sensor objects. obj.game.physics_type = 'SENSOR' # Specify a collision bounds type other than the default obj.game.use_collision_bounds = True # replace Always sensor by Collision sensor sensor = obj.game.sensors[-1] sensor.type = 'COLLISION' # need to get the new Collision Sensor object sensor = obj.game.sensors[-1] sensor.use_pulse_true_level = True # FIXME doesnt seems to have any effect # Component mesh (eye sugar) mesh = Cube("CollisionMesh") mesh.scale = (.02, .02, .02) mesh.color(.8, .2, .1) self.append(mesh)
def __init__(self, name=None): """ Sensor to detect objects colliding with the current object. Doc: https://www.blender.org/manual/game_engine/logic/sensors/collision.html """ SensorCreator.__init__(self, name) obj = bpymorse.get_context_object() # Sensor, Collision Sensor, detects static and dynamic objects but # not the other collision sensor objects. obj.game.physics_type = 'SENSOR' # Specify a collision bounds type other than the default obj.game.use_collision_bounds = True obj.scale = (0.02,0.02,0.02) # replace Always sensor by Collision sensor sensor = obj.game.sensors[-1] sensor.type = 'COLLISION' # need to get the new Collision Sensor object sensor = obj.game.sensors[-1] sensor.use_pulse_true_level = True # FIXME doesnt seems to have any effect sensor.use_material = False # we want to filter by property, not by material # Component mesh (eye sugar) mesh = Cube("CollisionMesh") mesh.color(.8, .2, .1) self.append(mesh)
def __init__(self, name=None): SensorCreator.__init__(self, name, "morse.core.sensor.Sensor", "clock")
def __init__(self, name=None): SensorCreator.__init__(self, name) self.frequency(1000)
def append(self, cam): self.cameras_.append(cam) SensorCreator.append(self, cam)
def __init__(self, name=None): SensorCreator.__init__(self, name) mesh = Cube("PoseCube") mesh.scale = (.04, .04, .02) mesh.color(.8, .3, .1) self.append(mesh)
def __init__(self, name=None): SensorCreator.__init__(self, name, "videoray_sim.sensors.completestate.Completestate", "completestate") mesh = Cube("CompletestateCube") mesh.scale = (.04, .04, .02) mesh.color(.3, .9, .6) self.append(mesh)
def __init__(self, sensors, name=None): SensorCreator.__init__(self, name) self.sensors = sensors
def __init__(self, name=None): SensorCreator.__init__(self, name) mesh = Sphere("GPSSphere") mesh.scale = (.04, .04, .01) mesh.color(.5, .5, .5) self.append(mesh)
def __init__(self, name=None): SensorCreator.__init__(self, name, "morse.sensors.imu.IMU", "imu") mesh = Cube("IMUCube") mesh.scale = (.04, .04, .02) mesh.color(.3, .9, .6) self.append(mesh)
def rotate(self, x=0, y=0, z=0): SensorCreator.rotate(self, x=y, y=z, z=x)
def __init__(self, name=None): SensorCreator.__init__(self, name) mesh = Cylinder("ThermometerCylinder") mesh.scale = (.02, .02, .04) mesh.color(0, .6, .5) self.append(mesh)
def __init__(self, name=None): SensorCreator.__init__(self, name, "morse.sensors.armature_pose.ArmaturePose", "armature_pose")
def __init__(self, name=None): SensorCreator.__init__(self, name) self.master = None self.cameras_ = []
def __init__(self, name=None): SensorCreator.__init__(self, name, "morse.sensors.ptu_posture.PTUPosture", "ptu_posture")
def __init__(self, name=None): SensorCreator.__init__(self, name)
def __init__(self, name=None): SensorCreator.__init__(self, name, "morse.sensors.jido_posture.JidoPosture", "jido_posture") self.properties(KUKAname="KUKA_LWR", PTUname="PTU")
def __init__(self, name=None): SensorCreator.__init__(self, name, "morse.sensors.gps.GPS", "gps") mesh = Sphere("GPSSphere") mesh.scale = (.04, .04, .01) mesh.color(.5, .5, .5) self.append(mesh)
def __init__(self, name=None): SensorCreator.__init__(self, name, "morse.sensors.velocity.Velocity", "velocity") mesh = Sphere("VelocitySphere") mesh.scale = (.04, .04, .01) mesh.color(.5, .5, .5) self.append(mesh)
def __init__(self, name=None): SensorCreator.__init__(self, name) mesh = Cylinder("OdometryCylinder") mesh.scale = (.02, .02, .02) mesh.color(.5, .5, .5) self.append(mesh)
def __init__(self, name=None): SensorCreator.__init__(self, name, "morse.sensors.stereo_unit.StereoUnit", "stereo_unit") mesh = Cube("StereoUnitCube") mesh.scale = (.025, .24, .01) mesh.color(.8, .8, .8) self.append(mesh)
def after_renaming(self): SensorCreator.properties(self, master_camera=self.cameras[self.master].name)
def __init__(self, name=None): SensorCreator.__init__(self, name) mesh = Sphere("GyroscopeSphere") mesh.scale = (.04, .04, .01) mesh.color(.8, .4, .1) self.append(mesh)
def __init__(self, name=None): SensorCreator.__init__(self, name) mesh = Cube("AccelerometerCube") mesh.scale = (.04, .04, .02) mesh.color(.3, .9, .6) self.append(mesh)
def __init__(self, name=None): SensorCreator.__init__(self, name, ComponentCreator.USE_BLEND)
def __init__(self, name=None): SensorCreator.__init__(self, name) mesh = Cube("StereoUnitCube") mesh.scale = (.025, .24, .01) mesh.color(.8, .8, .8) self.append(mesh)
def __init__(self, sensors, name=None, type=""): SensorCreator.__init__(self, name, "morse.sensors.compound.CompoundSensor", type) self.sensors = sensors