您现在的位置是:Instagram刷粉絲, Ins買粉絲自助下單平台, Ins買贊網站可微信支付寶付款 >
03 ros發布和訂閱python(如何在ros 使用odometry python)
Instagram刷粉絲, Ins買粉絲自助下單平台, Ins買贊網站可微信支付寶付款2024-07-28 00:27:57【】8人已围观
简介/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,
&
很赞哦!(96)
相关文章
- tiktok哪個版本好(tiktok版本各國版本號不一樣嗎) 01
- 01 wallpaperengine壁紙取消訂閱了內存怎么(wallpaperengine換電腦后訂閱的壁紙沒有了)
- tiktok各國下載量(小學生都在用的App但隱私有問題?你不可不知的抖音TikTok) 01
- tiktok可以掛購物車嗎(tiktok是什么意思?) 04
- tiktok國際版下載安卓版官網(tiktok國際版怎么下載) 01
- tiktok國際版APK下載(怎樣下載國際版tiktok) 02
- tiktok去除地區限制插件(買粉絲為什么會自動升級新版本呢?) 01
- 01 買粉絲 買粉絲nverter mp3 youtube windows 10(請問諾基亞6300的使用技巧以及應用軟件)
- 01 買粉絲s 買粉絲s youtube 買粉絲s(related 買粉絲s是什么意思)
- tiktok博主龍蝦(五一期間宜昌景區優惠活動匯總) 01
热门文章
站长推荐
01 wallpaperengine訂閱好友能看到嗎(wallpaper怎么看好友訂閱)
tiktok國際版下載蘋果版安裝包(蘋果手機怎么下載TikTok(抖音國際版)) 01
01 vivo登instagram用什么買粉絲(vivo怎么登陸instagram?)
tiktok去水印軟件免費的軟件(2022最新版從0-1運營TikTok的保姆級教程) 02
01 vanced youtube for pc 買粉絲(youtubevanced無法播放)
01 買粉絲 downloader app for youtube(ios9越獄后要裝什么才能看越獄系統)
01 vanced youtube for pc apk mode(youtube vanced鴻蒙閃退)
01 vanced youtube latest version翻譯中文(youtube vanced鴻蒙閃退)