-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathautoware2sleo.py
29 lines (25 loc) · 1.07 KB
/
autoware2sleo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env python
import rospy
# from sensor_msgs.point_cloud2 import create_cloud
from geometry_msgs.msg import Twist,TwistStamped,PoseStamped
from geometry_msgs.msg import Vector3
from autoware_msgs.msg import VehicleCmd
import math
# ==============================================================================
# -- main() -------------------------edited by xhao-----------------------------
# ==============================================================================
class Transfer():
def __init__(self):
rospy.init_node('autoware_to_sleo', anonymous=True)
self.twist_pub = rospy.Publisher('sleo_velocity_controller/cmd_vel',Twist,queue_size=100)
rospy.Subscriber("/twist_raw",TwistStamped, self.TwistCallback)
def TwistCallback(self,data):
new_msg = Twist()
# data.twist.angular.z = -data.twist.angular.z*int(data.twist.linear.x)/2
new_msg = data.twist
if abs(data.twist.angular.z) >100:
new_msg=0.0
self.twist_pub.publish(new_msg)
if __name__ == '__main__':
Transfer()
rospy.spin()