Rust 配准Realsense环境并测试example

  1. 安装vscode,rust环境,跑通Hello world,参考:https://www.runoob.com/rust/rust-setup.html
  2. 安装realsense sdk,版本与https://github.com/Tangram-Vision/realsense-rust/tree/main 提到的版本一致
  3. 下载https://github.com/Tangram-Vision/realsense-rust/tree/main 源码到本地
  4. 配置新项目的Cargo.toml,在[dependencies]新增:
    [dependencies]
    realsense-rust = "1.1"
    anyhow = "1.0"
    realsense-sys = "2.47.0"
    
  5. 将https://github.com/Tangram-Vision/realsense-rust/blob/main/examples/demo_435i.rs 代码拷贝到main.rs中
  6. vscode 扩展应用搜索:Chocolatey 并安装
  7. 终端输入 如下命令,可能会提示访问拒绝,请确认文件夹权限
    choco install pkgconfiglite
    
  8. 终端输入如下代码,路径为第三步下载的源码的realsense-sys目录
    $Env:PKG_CONFIG_PATH="F:\project\realsense-rust\realsense-sys"
    
  9. 输入
    cargo build
    cargo run
    
    一切正常会显示:
    Distance of center pixel: 1.5960001  m | Gyro reading: -0.010471975   , 0.0034906585   , -0.0052359877
    

踩坑:
1. Package realsense2 was not found in the pkg-config search path. Perhaps you should add the directory containing `realsense2.pc' to the PKG_CONFIG_PATH environment variable No package 'realsense2' found
是因为未配置$Env

  1. use of undeclared crate or module pkg_config : 在Cargo.toml加入 anyhow = "1.0"后此错误消失
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值