您现在的位置是:Instagram刷粉絲, Ins買粉絲自助下單平台, Ins買贊網站可微信支付寶付款 >
03 ros發布和訂閱python(如何在ros 使用odometry python)
Instagram刷粉絲, Ins買粉絲自助下單平台, Ins買贊網站可微信支付寶付款2024-05-28 10:12:51【】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,
&
很赞哦!(493)
相关文章
- 高壓油管D型接頭(液壓接頭d型軟管什么型號)
- facebook主頁標簽上限是多少(抖音運營有什么技巧?) - 副本
- facebook人臉驗證后的照片(fackbook密碼忘了改完密碼提示要刷臉驗證有事嗎身份會泄露嗎?)
- facebook主頁名字修改不了手機(手機facebook主頁名字修改不了) - 副本
- facebook人臉識別開關(facebook有成人開關嗎)
- facebook人臉驗證(fackbook密碼忘了改完密碼提示要刷臉驗證有事嗎身份會泄露嗎?)
- 高壓油管價格(廢舊高壓膠管多少錢一噸?)
- 飯店油煙機管道清洗賺錢嗎(清洗油煙機排煙管道多少錢)
- facebook為什么進不去官網(vivo Y85全球官網手機為什么不能下載Facebook 和messenger )
- 馬來西亞tiktok語言怎么設置(tiktok馬來西亞可以用簡體中文嗎)
热门文章
站长推荐
facebook人臉驗證一直轉圈(facebook人臉驗證要多久被封了) - 副本
餐飲行業油煙管道多長時間清洗一次(餐飲排油煙管道多久清洗一次)
facebook人臉識別有影響嗎(世界前沿科技是什么?)
香港電話卡國內能上facebook(如何開通使用happy卡?) - 副本
facebook人臉驗證沒反應(基石資本張維:生物醫藥、信息技術等行業必將誕生數家世界級企業) - 副本
facebook人臉審核安全嗎(人臉識別的利弊及風險) - 副本
高壓油管和低壓油管用什么字母表示(汽車方向機助力泵高壓油管和低壓油管的區別)
facebook二維碼在哪掃描在哪(facebook二維碼怎么掃描)