八、ROS小车闭环控制:将DSO算法得到相机位姿信息作为ROS节点广播

本文介绍如何将DSO算法获取的相机位姿信息整合到ROS节点中进行广播。通过使用DSO算法的任意副本,正确添加'getCameraPose()'函数,并参照特定项目的代码片段,可以实现从DSO输出中提取相机位姿并转换为ROS消息格式。最后,通过catkin_make编译并设置DSO路径,即可在终端看到准确的相机位姿信息。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

DSO算法鼎鼎大名,不用多说。

一般的相机都能用(我用Kinect V2,现在想想,只说DSO的话,它并不是必须的,一般的相机只要能标定就行),优快云都有相关的教程,我这里说一下如何将DSO算法得到相机位姿信息作为ROS节点广播。

一句话来说,就是请参考这个链接里面我的回答,也就是二楼:https://github.com/rancheng/dso_ros/issues/1

后续我有时间会把相关完整代码放出来,我的描述相信找到这里的人基本也能看懂。站在前人的肩膀上。

附:我的回复

Here is a brief description of what I've done:

  1. Use any DSO copy you like(the original is best), just remember:
    (1)sampleoutput=1 may be different in some Rosrun command example, be careful;
    (2)referring to the DSO_main of this author, add the function ' getCameraPose()' correctly, this is all we need for the main DSO!

  2. For the ROS client, we don't really need to write the wrapper like in this project, we can:
    (1)refer to this project: https://github.com/BluewhaleRobot/dso_ros , then add what is relevant to ' getCameraPose()' like in this project, pay attention to headers:
    ` std::vector<IOWrap::Output3DWrapper *> wraps = fullSystem->outputWrapper;
    if (wraps.size() != 0) {
    std::cout << frameID << std::endl;
    IOWrap::Output3DWrapper *wrap = wraps.back();
    std::vector *poses = wrap->getCameraPose();
    if (poses->size() != 0) {
    SE3 pose = poses->back();
    std::cout << "----------Pose Size: " << poses->size() << "--------"
    << std::endl;
    // std::cout << "-----------------------Camera
    // Pose!!!!!----------------------" << std::endl;
    std::cout << pose.matrix3x4() << std::endl;
    std::cout << "----------1" << std::endl;
    auto rt_matrix = pose.matrix3x4();
    geometry_msgs::Transform dso_est_tf;

    dso_est_tf.translation.x = rt_matrix(0, 3);
    dso_est_tf.translation.y = rt_matrix(1, 3);
    dso_est_tf.translation.z = rt_matrix(2, 3);
    dso_est_tf.rotation.x = pose.unit_quaternion().x();
    dso_est_tf.rotation.y = pose.unit_quaternion().y();
    dso_est_tf.rotation.z = pose.unit_quaternion().z();
    dso_est_tf.rotation.w = pose.unit_quaternion().w();
    std::cout << dso_est_tf.translation.x << dso_est_tf.translation.y
    << dso_est_tf.translation.z << std::endl;
    std::cout << "----------2" << std::endl;
    }
    }`
    (2)catkin_make it and remember to export the DSO path.
    This an example pic:
    _003

Now your terminal should show the exact camera poses with other stuff.
Just focus on the camera pose for now.
The next thing is to publish the pose, which you should know what to do.

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值