您现在的位置是:Instagram刷粉絲, Ins買粉絲自助下單平台, Ins買贊網站可微信支付寶付款 >
03 ros發布和訂閱python(ROS使用python3)
Instagram刷粉絲, Ins買粉絲自助下單平台, Ins買贊網站可微信支付寶付款2024-06-24 05:44:37【】6人已围观
简介/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,
&
很赞哦!(53358)
相关文章
- 04 訂閱用英文怎么說服別人追求影響(周恩來小時候的成長故事)
- 04 訂閱號登錄流程圖片介紹ppt(怎樣把PPT上傳到買粉絲訂閱號里?跪求!急用!)
- 04 訂閱轉換服務地址未注冊請斷開(遇見網暴應該保護自己隱私安全呢?)
- 04 訂閱號好消息(買粉絲怎么盈利)
- 04 訂閱號登錄買粉絲多少你猜猜我(買粉絲營銷成功案例分享5篇)
- 安卓怎么更新youtube(華為的安卓許可證即將到期,華為怎么辦?)
- 04 訂閱 英文縮寫是什么含義是否(科技小報)
- 安卓怎么下載油管app(泰國油管怎么下載)
- 04 訂閱節點轉換網站源碼(我有4個問題,答得好就給100分,特別好給150分,可以復制哦,我很急,關于電子商務)
- 安卓怎么安裝油管軟件(你的設備不支持google play服務,怎么解決)
热门文章
站长推荐
04 訂閱號功能介紹文案(買粉絲買粉絲功能介紹怎么寫?)
04 訂閱 英文縮寫怎么寫中(rss是什么 怎么弄)
04 訂閱號登錄買粉絲是否通過互聯網(如何在網上推廣軟文?軟文營銷平臺如何選擇?)
安卓怎么看tiktok用拔卡嗎(國外版本的抖音tik tok怎么使用?)
安卓怎么看tiktok國際版(國內怎么看tiktok國際版)
安卓怎樣下載油管(免電腦!Peggo 快速下載 Youtube 音樂到手機里 (Android))
安卓怎么登facebook(facebook在安卓能用在蘋果登不上)
安卓手機如何下載facebook最新版(有什么辦法可以下載Facebook這個軟件,本機是安卓手機?) - 副本