def spawnGenEnvironment(req): initial_pose = Pose() initial_pose.position.x = 0 initial_pose.position.y = 0 initial_pose.position.z = 0 quaternion = tf.transformations.quaternion_from_euler(0, 0, 0) initial_pose.orientation.x = quaternion[0] initial_pose.orientation.y = quaternion[1] initial_pose.orientation.z = quaternion[2] initial_pose.orientation.w = quaternion[3] f = open( '/home/knmcguire/Software/catkin_ws/src/indoor_environment_generator/models/random_generated_environment/test_model.sdf', 'r') sdff = f.read() rospy.wait_for_service('gazebo/spawn_sdf_model') spawn_model_prox = rospy.ServiceProxy('gazebo/spawn_sdf_model', SpawnModel) spawn_model_prox("some_robo_name", sdff, "robotos_name_space", initial_pose, "world") msg = Trigger() msg.succes = True msg.message = "jeej" return []
def _toggle(req): global _ctrl_on _ctrl_on = not _ctrl_on srv = Trigger() srv.success = True srv.message = "Controller is {}".format(_ctrl_on) return TriggerResponse(True, "Controller is {}".format(_ctrl_on))
def callback(self, message): self.latest_message = message self.detection_dict = self.four_sector_detection() crashed, direction = self.has_crashed(): if crashed: trigger = Trigger() trigger.success = False trigger.message = direction self.crash_publisher.publish(trigger)