data_via_rosservice.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 '''
3 BSD 2-Clause License
4 
5 Copyright (c) 2019, Simranjeet Singh
6 All rights reserved.
7 
8 Redistribution and use in source and binary forms, with or without
9 modification, are permitted provided that the following conditions are met:
10 
11 1. Redistributions of source code must retain the above copyright notice, this
12  list of conditions and the following disclaimer.
13 
14 2. Redistributions in binary form must reproduce the above copyright notice,
15  this list of conditions and the following disclaimer in the documentation
16  and/or other materials provided with the distribution.
17 
18 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 '''
29 
30 from edrone_client.srv import *
31 import rospy
32 from std_msgs.msg import Float64
33 from std_msgs.msg import Int32
34 
35 class request_data():
36  """docstring for request_data"""
37  def __init__(self):
38  rospy.init_node('drone_board_data')
39  data = rospy.Service('eDroneService', edrone_services, self.access_data)
40 
41  def access_data(self, req):
42  print "accx = " + str(req.accX), "accy = " + str(req.accY), "accz = " + str(req.accZ)
43  print "gyrox = " + str(req.gyroX), "gyroy = " + str(req.gyroY), "gyroz = " + str(req.gyroZ)
44  print "magx = " + str(req.magX), "magy = " + str(req.magY), "magz = " + str(req.magZ)
45  print "roll = " + str(req.roll), "pitch = " + str(req.pitch), "yaw = " + str(req.yaw)
46  print "altitude = " +str(req.alt)
47  print "battery = " + str(req.battery), "Power Consumed = " + str(req.rssi)
48  rospy.sleep(.1)
49  return edrone_servicesResponse(rcAUX2 =1500)
50 
51 test = request_data()
52 rospy.spin()


edrone_server
Author(s): Simranjeet Singh
autogenerated on Sun Dec 1 2019 03:30:53