00001 #!/usr/bin/env python 00002 00003 ################################################################# 00004 ##\file 00005 # 00006 # \note 00007 # Copyright (c) 2013 \n 00008 # Fraunhofer Institute for Manufacturing Engineering 00009 # and Automation (IPA) \n\n 00010 # 00011 ################################################################# 00012 # 00013 # \note 00014 # Project name: Care-O-bot Research 00015 # \note 00016 # ROS package name: 00017 # 00018 # \author 00019 # Author: Thiago de Freitas Oliveira Araujo, 00020 # email:thiago.de.freitas.oliveira.araujo@ipa.fhg.de 00021 # \author 00022 # Supervised by: Florian Weisshardt, email:florian.weisshardt@ipa.fhg.de 00023 # 00024 # \date Date of creation: February 2013 00025 # 00026 # \brief 00027 # This module records bagfile according to triggering events 00028 # 00029 ################################################################# 00030 # 00031 # Redistribution and use in source and binary forms, with or without 00032 # modification, are permitted provided that the following conditions are met: 00033 # 00034 # - Redistributions of source code must retain the above copyright 00035 # notice, this list of conditions and the following disclaimer. \n 00036 # - Redistributions in binary form must reproduce the above copyright 00037 # notice, this list of conditions and the following disclaimer in the 00038 # documentation and/or other materials provided with the distribution. \n 00039 # - Neither the name of the Fraunhofer Institute for Manufacturing 00040 # Engineering and Automation (IPA) nor the names of its 00041 # contributors may be used to endorse or promote products derived from 00042 # this software without specific prior written permission. \n 00043 # 00044 # This program is free software: you can redistribute it and/or modify 00045 # it under the terms of the GNU Lesser General Public License LGPL as 00046 # published by the Free Software Foundation, either version 3 of the 00047 # License, or (at your option) any later version. 00048 # 00049 # This program is distributed in the hope that it will be useful, 00050 # but WITHOUT ANY WARRANTY; without even the implied warranty of 00051 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00052 # GNU Lesser General Public License LGPL for more details. 00053 # 00054 # You should have received a copy of the GNU Lesser General Public 00055 # License LGPL along with this program. 00056 # If not, see < http://www.gnu.org/licenses/>. 00057 # 00058 ################################################################# 00059 import roslib; roslib.load_manifest('srs_user_tests') 00060 00061 import sys 00062 00063 import rospy 00064 import rosservice 00065 from std_msgs.msg import String 00066 00067 def bag_service_client_start(): 00068 rospy.wait_for_service('/logger/start') 00069 try: 00070 rosservice.call_service('/logger/start', None) 00071 except rospy.ServiceException, e: 00072 print "Service call failed: %s"%e 00073 00074 def bag_service_client_stop(): 00075 rospy.wait_for_service('/logger/stop') 00076 try: 00077 rosservice.call_service('/logger/stop', None) 00078 except rospy.ServiceException, e: 00079 print "Service call failed: %s"%e 00080 00081 if __name__ == "__main__": 00082 while not rospy.is_shutdown(): 00083 var = raw_input("0: stop, 1: start\n") 00084 if var == str(0): 00085 bag_service_client_stop() 00086 elif var == str(1): 00087 bag_service_client_start() 00088 else: 00089 print "wrong command"