您现在的位置是:Instagram刷粉絲, Ins買粉絲自助下單平台, Ins買贊網站可微信支付寶付款 >
03 ros訂閱話題python(ros下python文件怎么運行)
Instagram刷粉絲, Ins買粉絲自助下單平台, Ins買贊網站可微信支付寶付款2024-07-19 19:49:39【】5人已围观
简介/p> self.cmd_vel=rospy.Publisher('/cmd_vel',Twist,queue_size=5)
self.cmd_vel = rospy.Publisher('/cmd_vel', Twist, queue_size=5)
rate = 20
r = rospy.Rate(rate)
linear_speed = 0.2
goal_distance =1.0
angular_speed = 1.0
goal_angle = pi
angular_tolerance = radians(2.5)
# Initialize tf listener, and give some time to fill its buffer
self.tf_listener = tf.TransformListener()
rospy.sleep(2)
# Set odom_frame and base_frame
self.odom_frame = '/odom'
try:
self.tf_listener.waitForTransform(self.odom_frame,
'/base_footprint',
rospy.Time(),
rospy.Duration(1.0))
self.base_frame = '/base_footprint'
except(tf.Exception, tf.ConnectivityException, tf.LookupException): try:
self.tf_listener.waitForTransform(self.odom_frame,
'/base_link',
rospy.Time(),
rospy.Duration(1.0))
self.base_frame = '/base_link'
except(tf.Exception, tf.ConnectivityException, tf.LookupException):
rospy.loginfo("Cannot find base_frame transformed from /odom")
rospy.signal_shutdown("tf Exception")
position = Point()
for i in range(2):
move_cmd = Twist()
move_cmd.linear.x = linear_speed # Initial pose, obtained from internal odometry
(position, rotation) = self.get_odom()
x_start = position.x
y_start = position.y
distance = 0
# Keep publishing Twist msgs, until the internal odometry reach the goal
while distance < goal_distance and not rospy.is_shutdown():
self.cmd_vel.publish(move_cmd)
r.sleep()
(position, rotation) = self.get_odom()
distance = sqrt( pow( (position.x-x_start), 2 ) + \
pow( (position.y-y_start), 2 ) )
# Stop 1 ms before rotate
move_cmd = Twist()
self.cmd_vel.publish(move_cmd)
rospy.sleep(1)
move_cmd.angular.z = angular_speed # should be the current ration from odom
angle_last = rotation
angle_turn = 0 while abs(angle_turn+angular_tolerance) < abs(goal_angle) \ and not rospy.is_shutdown():
self.cmd_vel.publish(move_cmd)
r.sleep()
(position, rotation) = self.get_odom
delta_angle = normalize_angle(rotation - angle_last)
angle_turn += delta_angle
angle_last = rotation
move_cmd = Twist()
self.cmd_vel.publish(move_cmd)
rospy.sleep(1)
self.cmd_vel.publish(Twist())
def get_dom(self): try:
(trans, rot) = self.tf_listener.lookupTransfrom(self.odom_frame,
&
很赞哦!(1)
相关文章
- 02 外貿企業退稅率與征收率之間的差(如何進行增值稅出口退稅的稅務籌劃)
- 01 男頭像ins高級質感模糊感(網名男ins高級質感)
- 01 男網紅秀才頭像(抖音秀才多少歲)
- 01 男生頭像ins高級質感背影(英文網名ins高級質感)
- 02 外貿信用卡支付手續費多少(paypal轉賬手續費多少)
- 02 外貿信托上不上征信(中國對外經濟貿易信托有限公司上征信嗎)
- 02 外貿催客戶下單的郵件(外貿中由于快過年了,單子比較多,讓客戶趕快下單怎么說)
- 01 男生ins森系網名單字(仙女ins森系網名一個字,仙女專屬森系網名)
- 01 男網紅夏天個人資料(網紅三斤佟鑫個人簡介和誰像)
- 01 男扮女裝抖音網紅白雪(抖音帶貨王辛巴徒弟 時大漂亮個人簡歷(男扮女裝))