找回密码
 立即注册
搜索
查看: 499|回复: 1

turn_on_robot::Publish_Odom() 里程计坐标不需要动态发布吗,为啥注释了?

[复制链接]

1

主题

2

帖子

5

积分

新手上路

Rank: 1

积分
5
发表于 2025-2-6 15:04:17 | 显示全部楼层 |阅读模式
void turn_on_robot:ublish_Odom()
{
    //Convert the Z-axis rotation Angle into a quaternion for expression
     //把Z轴转角转换为四元数进行表达

    tf2:uaternion q;
    q.setRPY(0,0,Robot_Pos.Z);
    geometry_msgs::msg:uaternion odom_quat=tf2::toMsg(q);

    wheeltec_robot_msg::msg:ata robotpose;
    wheeltec_robot_msg::msg:ata robotvel;
    nav_msgs::msg::Odometry odom; //Instance the odometer topic data //实例化里程计话题数据

    odom.header.stamp = rclcpp::Node::now();
    odom.header.frame_id = odom_frame_id; // Odometer TF parent coordinates //里程计TF父坐标
    odom.child_frame_id = robot_frame_id; // Odometer TF subcoordinates //里程计TF子坐标

    odom.pose.pose.position.x = Robot_Pos.X; //Position //位置
    odom.pose.pose.position.y = Robot_Pos.Y;
    odom.pose.pose.position.z = Robot_Pos.Z;
    odom.pose.pose.orientation = odom_quat; //Posture, Quaternion converted by Z-axis rotation //姿态,通过Z轴转角转换的四元数


    odom.twist.twist.linear.x =  Robot_Vel.X; //Speed in the X direction //X方向速度
    odom.twist.twist.linear.y =  Robot_Vel.Y; //Speed in the Y direction //Y方向速度
    odom.twist.twist.angular.z = Robot_Vel.Z; //Angular velocity around the Z axis //绕Z轴角速度

    robotpose.x = Robot_Pos.X;
    robotpose.y = Robot_Pos.Y;
    robotpose.z = Robot_Pos.Z;

    robotvel.x = Robot_Vel.X;
    robotvel.y = Robot_Vel.Y;
    robotvel.z = Robot_Vel.Z;

/*   geometry_msgs::msg::TransformStamped odom_tf;


    odom_tf.header = odom.header;
    odom_tf.child_frame_id = odom.child_frame_id;
    odom_tf.header.stamp = rclcpp::Node::now();


    odom_tf.transform.translation.x = odom.pose.pose.position.x;
    odom_tf.transform.translation.y = odom.pose.pose.position.y;
    odom_tf.transform.translation.z = odom.pose.pose.position.z;
    odom_tf.transform.rotation = odom.pose.pose.orientation;


    tf_bro->sendTransform(odom_tf);


*/
//上面这段代码怎么注释了,里程计坐标不需要动态发布吗?
    //There are two types of this matrix, which are used when the robot is at rest
    //and when it is moving.Extended Kalman Filtering officially provides 2 matrices for the robot_pose_ekf feature pack
    //这个矩阵有两种,分别在机器人静止和运动的时候使用。扩展卡尔曼滤波官方提供的2个矩阵,用于robot_pose_ekf功能包
    //tf_pub_->publish(odom_tf);
    odom_publisher->publish(odom); //Pub odometer topic //发布里程计话题
    robotpose_publisher->publish(robotpose); //Pub odometer topic //发布里程计话题
    robotvel_publisher->publish(robotvel); //Pub odometer topic //发布里程计话题

}


回复

使用道具 举报

0

主题

254

帖子

756

积分

高级会员

Rank: 4

积分
756
发表于 2025-2-10 11:46:54 | 显示全部楼层

你看的是什么时候的源码呢?我们这里近一年的源码里面都没有红字部分的注释
动态发布通过其他的程序发布,不通过wheeltec_robot.cpp, 比如建图,除了carto建图算法,其他通过robot_pose_ekf实现
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

粤ICP备20017043号|小黑屋|手机版|Archiver|轮趣科技(东莞)有限公司  

GMT+8, 2025-2-22 02:15 , Processed in 0.066859 second(s), 23 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表