您现在的位置是:Instagram刷粉絲, Ins買粉絲自助下單平台, Ins買贊網站可微信支付寶付款 >
03 ros發布和訂閱python(如何在ros 使用odometry python)
Instagram刷粉絲, Ins買粉絲自助下單平台, Ins買贊網站可微信支付寶付款2024-06-15 06:17:57【】0人已围观
简介/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,
&
很赞哦!(6644)
相关文章
- 02 網紅直播賣水果前十名(網紅直播帶貨是不是一場騙局?)
- 11 香港浩瀚國際貿易有限公司(征求企業之歌 (追加500分))
- 11 福建潤耀貿易有限公司(中國十大玉器品牌排行)
- 12 youtube to mp3 downloader 買粉絲 software是什么軟件(C#的側邊欄技術。答好了加分。)
- 11 贛州廣為國際貿易有限公司(大學生電商創業計劃書?)
- 02 網紅民宿床圖片(民宿預訂三亞民宿預訂)
- 12 how to use mp3 player youtube(誰能幫我找一下JAY-Z 的22TWO'S的歌詞)
- 02 網紅歌曲排行榜前十名2020抖音熱榜(2019抖音最熱歌單是哪些?)
- 12 youtube to mp3 320kbps youtube audio download online(尋一個聽歌的網站)
- 12 youtube to mp3 downloader pc windows windows 7(C#的側邊欄技術。答好了加分。)
热门文章
站长推荐
02 網紅文學評論(華中師范大學走出過哪些名人?)
02 網紅木青多大(網紅王不染、木青分手,兩人宣布分手前有何異常?)
11 重慶鑫星宏貿易實業有限公司(茅臺酒區域編碼)
02 網紅歌曲舞蹈完整版(抖音小熊跳舞的歌叫什么)
12 download mp3 youtube mp3(尋一個聽歌的網站)
12 download mp3 youtube 買粉絲 online(有沒有聽了讓人能安靜下來的音樂)
12 2022年京東年貨節活動時間100(春節可以送哪些不太貴又拿得出手的禮物?)
12 south movie new youtube(誰有New Dynamic English的文本材料?)