4 from dataspeed_ulc_can
import Speed
5 from dataspeed_ulc_msgs.msg
import UlcReport
13 rospy.init_node(
'speed_sine_wave')
14 super(SpeedSineWave, self).
__init__()
19 rospy.Subscriber(
'/vehicle/ulc_report', UlcReport, self.
recv_report)
29 self.ulc_cmd.linear_velocity = self.
v1 40 amplitude = 0.5 * (self.
v2 - self.
v1)
41 offset = 0.5 * (self.
v2 + self.
v1)
42 self.ulc_cmd.linear_velocity = offset - amplitude * math.cos(2 * math.pi / self.period * self.
t)
45 self.pub_ulc_cmd.publish(self.ulc_cmd)
46 if self.
v1 == 0
and self.
v2 == 0:
47 rospy.logwarn_throttle(1.0,
'both speed targets are zero')
53 if __name__ ==
'__main__':
57 except rospy.ROSInterruptException:
def timer_callback(self, event)
def recv_report(self, msg)