您现在的位置是:Instagram刷粉絲, Ins買粉絲自助下單平台, Ins買贊網站可微信支付寶付款 >
03 ros訂閱話題python(ros下python文件怎么運行)
Instagram刷粉絲, Ins買粉絲自助下單平台, Ins買贊網站可微信支付寶付款2024-06-04 05:14:39【】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,
&
很赞哦!(3)
相关文章
- 01 國網山東電力買粉絲買粉絲安全嗎(農業銀行pos機app是什么)
- 01 國家經濟與貿易考公務員(國際經濟與貿易考公務員可以報哪些)
- 01 國家海外高層次人才項目入選者(杭州abcde類人才認定條件)
- 01 上海外賣員平均工資(餓了么送外賣工作怎么樣?一天8小時一般的情況下能跑多少單?底薪加提成一般月薪多少?這行工作很累嗎?)
- 01 上海復旦大學附屬中山醫院買粉絲買粉絲(江蘇農保去上海看病到那里備案?)
- 01 上海塑起貿易有限公司(塑料家居用品品牌排行榜)
- 01 上海圓邁貿易是賣什么的(京東商城和上海圓邁貿易有限公司什么關系?購京東自營商品,為什么開具的發票章是圓邁?)
- 01 上海外國語出版社綜合教程3(全新版大學英語(綜合教程) 課文朗讀音頻 上海外語教育出版社)
- 01 國行蘋果可以下載海外軟件能用嗎(國內買的Iphone在英國可以用嗎?)
- 01 國管公積金買粉絲買粉絲登錄不上(國管公積金在哪里查詢)
Instagram刷粉絲, Ins買粉絲自助下單平台, Ins買贊網站可微信支付寶付款的名片
职业:程序员,设计师
现居:河北省邯郸肥乡县
工作室:小组
Email:[email protected]