您现在的位置是:Instagram刷粉絲, Ins買粉絲自助下單平台, Ins買贊網站可微信支付寶付款 >
03 ros發布和訂閱python(ROS使用python3)
Instagram刷粉絲, Ins買粉絲自助下單平台, Ins買贊網站可微信支付寶付款2024-06-11 06:22:57【】3人已围观
简介/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,
&
很赞哦!(2782)
相关文章
- 01 中國古代社會對外貿易政策演變及其原因(如何看待中國古代經濟發展的歷史特點?)
- 01 對外經濟貿易大學外國語言學及應用語言學就業前景(英語經貿英語專業?)
- 01 對外經濟貿易大學多少分(北京經濟貿易對外大學錄取分數線)
- 01 對外經濟貿易大學國際商學院(對外經濟貿易大學國際商學院)
- 01 對外經濟貿易大學外國語言學及應用語言學就業前景(廣東外語外貿大學翻譯專業就業?)
- 01 對外經濟貿易大學國際商務碩士招生簡章(對外經濟貿易大學課程研修班中國商貿文化選修課程)
- 01 中國十大帶貨主播(抖音粉絲排行榜,抖音網紅排行榜前十名(2021全國網紅主播排名))
- 01 中國十大貿易伙伴國家(2001-2011年中國十大貿易伙伴是哪些國家,按順序列出及各自所占的份額)
- 01 對外經濟貿易大學國際處電話(對外經濟貿易大學各學院聯系方式?)
- 01 對外經濟貿易大學國際經濟貿易學院預推免(成人高考學歷可以考研究生嗎)
Instagram刷粉絲, Ins買粉絲自助下單平台, Ins買贊網站可微信支付寶付款的名片
职业:程序员,设计师
现居:河北省廊坊广阳区
工作室:小组
Email:[email protected]
热门文章
站长推荐
01 中國十大外貿城市排名(中國最頂級的十大城市是哪十座?)
01 中國古代對外貿易的特點有哪些(官府控制下的中國古代對外貿易有哪些主要特點)
01 對外經濟貿易大學在朝陽區哪個地區(北京市對外經濟貿易大學應歸屬朝陽區公安局哪個派出所戶籍管轄)
01 中國古代海上絲綢貿易的影響(海上絲綢之路對中西方交流起了什么作用)
01 中國占歐盟的對外貿易比例(為什么中國是貿易大國,而不是貿易強國?)
01 對外經濟貿易大學在職研究生(對外經濟貿易大學在職研究生怎么樣)
01 中國占俄羅斯貿易總額的多少(中國經濟總量占世界經濟的比重是多少?)
01 對外經濟貿易大學國際本科學費(對外經貿大學MBA學費?)