正在加载图片...
FeEHF MeN Hen D0⊙$厚●夏张条常 Mu:uis Iichts Irert Mael Ticbet nodd whod whrd 3 h:以e pia"e_nocd 可pty w rhw 干5e a19?化 Bnt 联3j39 : h 00: 1hA保F行 X2移 054 7 RP 40 34.46 4n1 卡Im 柱tLt以Hde Ink Gazeboi连续的发布里程数据。检查topic我吗可以查看其中发布的数据。 S rostopic echo /odom/pose/pose position: x:0.32924763712 y:0.97509878254 z:0.0 orientation: x:0.0 y:0.0 z:0.941128847661 w:0.33804806182 可以看到,Gazebo确实是创建了里程信息。接下来,我们查看这个差速器插件的源代码 来了解,它是如何创建这个里程的。这个插件文件位于erratic gazebo plugins包内,文件名 为diffdrive_plugin.cpp。可以用rosed打开文件 S rosed erratic_gazebo_plugins diffdrive_plugin.cpp 文件有很多代码,但是和里程相关的重要代码在以下的函数publish odometry(0里面: void DiffDrivePlugin::publish_odometry() ros::Time current_time ros::Time::now(); std::string odom frame tf::resolve(tf prefix,"odom"); std::string base_footprint frame=tf::resolve(tf_prefix,"base footprint"); /getting data for base footprint to odom transform math::Pose pose=this->parent->GetState().GetPose(); btQuaternion qt(pose.rot.x,pose.rot.y,pose.rot.z,pose.rot.w); -11-- 11 - Gazebo连续的发布里程数据。检查topic我吗可以查看其中发布的数据。 $ rostopic echo /odom/pose/pose --- position: x: 0.32924763712 y: 0.97509878254 z: 0.0 orientation: x: 0.0 y: 0.0 z: 0.941128847661 w: 0.33804806182 --- 可以看到,Gazebo确实是创建了里程信息。接下来,我们查看这个差速器插件的源代码 来了解,它是如何创建这个里程的。这个插件文件位于erratic_gazebo_plugins 包内,文件名 为diffdrive_plugin.cpp 。可以用rosed打开文件 $ rosed erratic_gazebo_plugins diffdrive_plugin.cpp 文件有很多代码,但是和里程相关的重要代码在以下的函数publish_odometry()里面: void DiffDrivePlugin::publish_odometry() { ros::Time current_time = ros::Time::now(); std::string odom_frame = tf::resolve(tf_prefix_, "odom"); std::string base_footprint_frame = tf::resolve(tf_prefix_, "base_ footprint"); // getting data for base_footprint to odom transform math::Pose pose = this->parent->GetState().GetPose(); btQuaternion qt(pose.rot.x, pose.rot.y, pose.rot.z, pose.rot.w);
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有