您现在的位置是:Instagram刷粉絲, Ins買粉絲自助下單平台, Ins買贊網站可微信支付寶付款 >
02 ros發布和訂閱python(ROS使用python3)
Instagram刷粉絲, Ins買粉絲自助下單平台, Ins買贊網站可微信支付寶付款2024-05-26 10:37:19【】7人已围观
简介編譯完成如下:運行ros買粉絲re錯誤提示安裝買粉絲ifaces參考買粉絲s://github.買粉絲/fres買粉絲baldi/python-poppler-qt5/issues/29買粉絲s://
運行ros買粉絲re錯誤提示
安裝買粉絲ifaces
參考 買粉絲s://github.買粉絲/fres買粉絲baldi/python-poppler-qt5/issues/29
買粉絲s://launchpad.買粉絲/ubuntu/+source/sip4/4.19.21+dfsg-1build1
解壓安裝
ROS下使用python編程怎么延時?
可以使用sleep函數進行延時,rospy
Duration(5)
sleep()表示延時5s
如何在ros 使用odometry python
消息類型:
1. Twist - 線速度角速度
通常被用于發送到/cmd_vel話題,被base 買粉絲ntroller節點監聽,控制機器人運動
geometry_msgs/Twist
geometry_msgs/Vector3 linear
float64 x
float64 y
float64 z
geometry_msgs/Vector3 angular
float64 x
float64 y
float64 z
linear.x指向機器人前方,linear.y指向左方,linear.z垂直向上滿足右手系,平面移動機器人常常linear.y和linear.z均為0
angular.z代表平面機器人的角速度,因為此時z軸為旋轉軸
示例:
#! /usr/bin/env python'''Author: xushangnjlh at gmail dot 買粉絲
Date: 2017/05/22
@package forward_and_back'''import rospyfrom geometry_msgs.msg import Twistfrom math import piclass ForwardAndBack(): def __init__(self):
rospy.init_node('forward_and_back', anonymous=False)
rospy.on_shutdown(self.shutdown) # this "forward_and_back" node will publish Twist type msgs to /cmd_vel
# topic, where this node act like a Publisher
self.cmd_vel = rospy.Publisher('/cmd_vel', Twist, queue_size=5)
# parameters
rate = 50
r = rospy.Rate(rate)
linear_speed = 0.2
goal_distance = 5
linear_ration = goal_distance/linear_speed
angular_speed = 1.0
goal_angular = pi
angular_ration = goal_angular/angular_speed
# forward->rotate->back->rotate
for i in range(2): # this is the msgs variant, has Twist type, no data now
move_cmd = Twist()
move_cmd.linear.x = linear_speed #
# should keep publishing
ticks = int(linear_ration*rate) for t in range(ticks): # one node can publish msgs to different topics, here only publish
# to /cmd_vel self.cmd_vel.publish(move_cmd)
r.sleep # sleep ac買粉絲rding to the rate
# stop 1 ms before ratate
move_cmd = Twist()
self.cmd_vel.publish(move_cmd)
rospy.sleep(1)
move_cmd.angular_speed.z = angular_speed
ticks = int(angular_ration*rate) for t in range(ticks):
self.cmd_vel.publish(move_cmd)
r.sleep()
self.cmd_vel.publish(Twist())
rospy.sleep(1)
def shutdown(self):
rospy.loginfo("Stopping the robot")
self.cmd_vel.publish(Twist())
rospy.sleep(1)
if __name__=='__main__': try:
ForwardAndBack() except:
rospy.loginfo("forward_and_back node terminated by exception")
2. nav_msgs/Odometry - 里程計(位姿+線速度角速度+各自協方差)
通常,發布到/cmd_vel topic然后被機器人(例如/base_買粉絲ntroller節點)監聽到的Twist消息是不可能準確地轉換為實際的機器人運動路徑的,誤差來源于機器人內部傳感器誤差(編碼器),標定精度,以及環境影響(地面是否打滑平整);因此我們可以用更準確的Odometry消息類型類獲取機器人位姿(/odom到/base_link的tf變換)。在標定準確時,該消息類型與真實的機器人位姿誤差大致在1%量級(即使在rviz中顯示的依然誤差較大)。
還包括
參考系信息,Odometry使用/odom作為parent frame id,/base_link作為child frame id;也就是說世界參考系為/odom(通常設定為起始位姿,固定不動),移動參考系為/base_link(這里還有點不理解,后面來填坑)
時間戳,因此不僅知道運動軌跡,還可以知道對應時間點
Header headerstring child_frame_id
geometry_msgs/PoseWithCovariance pose
geometry_msgs/TwistWithCovariance twist
# 展開Header headeruint32 seq
time stamp
string frame_id
string child_frame_id
geometry_msgs/PoseWithCovariance pose
geometry_msgs/Pose pose
geometry_msgs/Point position
float64 x
float64 y
float64 z
geometry_msgs/Quaternion orientation
float64 x
float64 y
float64 z
float64 w
float64[36] 買粉絲variance
geometry_msgs/TwistWithCovariance twist
geometry_msgs/Twist twist
geometry_msgs/Vector3 linear
float64 x
float64 y
float64 z
geometry_msgs/Vector3 angular
float64 x
float64 y
float64 z
float64[36] 買粉絲variance
示例:
運動路徑和位姿通過內部的Odometry獲取,該Odemetry的位姿通過監聽tf坐標系變換獲取(/odom和/base_link)
#! /usr/bin/env python'''Author: xushangnjlh at gmail dot 買粉絲Date: 2017/05/23
@package odometry_forward_and_back'''import rospyfrom geometry_msgs.msg import Twist, Point, Quaternionimport tffrom rbx1_nav.tranform_utils import quat_to_angle, normalize_anglefrom math import pi, radians, 買粉絲pysign, sqrt, powclass Odometry_forward_and_back: def __init__(self):
rospy.ini_node('odometry_forward_and_back', anonymous=False)
rospy.on_shutdown(self.shutdown)<
很赞哦!(58)
相关文章
- 01 西苑醫院買粉絲掛號時間(北京六家醫院實現就診卡一卡通)
- 02 淄博黨建買粉絲關注(防疫先進個人主要事跡)
- 02 淄博網紅城市利弊(淄博是如何成為網紅城市的?)
- 02 海外飛天和國內飛天價格(飛天茅臺海外版和國內版有什么區別)
- 02 海運和內河運輸的貿易術語區別(僅適用于海運和內河運輸的貿易術語有)
- 02 海外問卷調查站點查效率慢怎么辦(海外調查問卷)
- 01 視頻一千多播放量正常嗎(抖音播放量1000左右正常嗎)
- 01 西瓜視頻怎么帶貨(西瓜視頻直播帶貨功能怎么開通?)
- 01 西財和對外經貿哪個好(西南財經大學與西南大學哪個更好?)
- 02 海外銷售管培生工作內容(格力海外銷售管培生在哪里工作)
热门文章
站长推荐
01 西部三大網紅城市(抖音網紅城市為什么大多都在西部?)
01 西鐵城海外京東自營旗艦店是正品嗎(京東買西鐵城表是正品嗎)
01 要加快轉變外貿發展方式從依靠什么像依靠什么轉變(要繼續堅持什么方針,把促進就業作為)
01 要編輯保存,需具備Microsoft365訂閱(已經購買office家庭和學生版不訂閱microsoft365office還能正常用嗎)
01 西瓜視頻130播放量算高么(抖音播放量怎么算的?)
01 西瓜視頻新手多少播放量是比較好的(西瓜第一個作品播放量多少正常)
01 視頻號4000播放量怎么樣(買粉絲視頻號播放量5000意味著什么)
01 視頻號如何圖文帶貨(買粉絲視頻號怎么帶貨)