Go to the documentation of this file.00001
00002 import rospy
00003 from std_msgs.msg import Bool
00004 from dataspeed_ulc_msgs.msg import UlcCmd
00005
00006
00007
00008 class Speed(object):
00009
00010 def __init__(self):
00011 rospy.Timer(rospy.Duration(0.02), self.timer_callback)
00012
00013 self.t = 0
00014 self.enabled = False
00015
00016 self.ulc_cmd = UlcCmd()
00017 self.ulc_cmd.enable_pedals = True
00018 self.ulc_cmd.enable_steering = False
00019 self.ulc_cmd.shift_from_park = False
00020
00021
00022 rospy.Subscriber('/vehicle/dbw_enabled', Bool, self.recv_enable)
00023 self.pub_ulc_cmd = rospy.Publisher('/vehicle/ulc_cmd', UlcCmd, queue_size=1)
00024
00025
00026 self.v1 = rospy.get_param('~v1', default=0.0)
00027 self.v2 = rospy.get_param('~v2', default=5.0)
00028 self.period = rospy.get_param('~period', default=10.0)
00029 self.ulc_cmd.enable_shifting = rospy.get_param('~enable_shifting', default=False)
00030 self.ulc_cmd.linear_accel = rospy.get_param('~accel_limit', default=0.0)
00031 self.ulc_cmd.linear_decel = rospy.get_param('~decel_limit', default=0.0)
00032
00033 def timer_callback(self, event):
00034
00035 pass
00036
00037 def recv_enable(self, msg):
00038 if msg.data and not self.enabled:
00039 self.t = 0
00040
00041 self.enabled = msg.data