Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use tf2 package to develop auto aim task #2

Open
gezp opened this issue Mar 11, 2022 · 2 comments
Open

Use tf2 package to develop auto aim task #2

gezp opened this issue Mar 11, 2022 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@gezp
Copy link
Member

gezp commented Mar 11, 2022

Feature request

Feature description

在自瞄中,需要在相机与云台之间做坐标变换,采用tf2可以方便的管理维护坐标关系,其还提供了简洁的坐标变换接口,以及tf消息同步功能(将IMU转换为tf,间接的实现IMU-相机同步),可以极大的方便开发。

Implementation considerations

(1)建立坐标系之间关系:

  • base_link->gimbal_yaw->gimbal_pitch->camera->camera_optical->target(识别到的目标装甲板):其中gimbal_yaw和gimbal_pitch根据云台角度实时更新维护,camera_optical->target之间的变换由自瞄算法计算出来。
  • 在使用枪管瞄准的时候,需要使用一个额外的参考坐标系gimbal_home,用于计算瞄准所需要的云台转动yaw,pitch角度,其为当云台角度为0时的gimbal_pitch参考系,可使用静态tf维护base_link->gimbal_home。

Tip:

  • gimbal_pitch->camera->camera_optical 可简化为gimbal_pitch->camera_optical
  • gimbal_home参考系可以灵活选取,如果base_link->gimbal_home绑定静态变换,那计算出来的yaw为绝对角,如果gimbal_yaw->gimbal_home绑定静态变换,则计算出的yaw为相对角度。

(2)瞄准解算:

  • 使用tf2工具,将target转换到gimbal_home坐标系下,计算云台转到绝对角。
@gezp gezp self-assigned this Mar 11, 2022
@gezp gezp added the enhancement New feature or request label Mar 11, 2022
@gezp
Copy link
Member Author

gezp commented Mar 11, 2022

实现步骤:

@gezp gezp changed the title Use tf2 to transform frame in auto aim task Use tf2 package to develop auto aim task Mar 12, 2022
@gezp
Copy link
Member Author

gezp commented Jan 31, 2024

这种方式可能会限制开发模式,从中间件(ROS)-算法功能解耦的角度看,建议采用的开发模式为:

  • 使用Eigen自行实现内部的云台模型(独立的类,增加复用性),读取云台编码器传感器数据,进行相应的换算。
  • 自瞄功能调用云台模型,得到最终的目标控制命令。

同时,也可以支持tf的发布,方便进行可视化调试,而不是直接用tf参与自瞄目标位置到控制命令的计算。

另一方面,对于数据同步,可以采用buffer进行自行处理,更加方便,如需插值,也可实现插值工具类(可支持线性插值,球面插值等不同插值算法)。

@gezp gezp changed the title Use tf2 package to develop auto aim task ~~Use tf2 package to develop auto aim task~~ Jan 31, 2024
@gezp gezp changed the title ~~Use tf2 package to develop auto aim task~~ Use tf2 package to develop auto aim task Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant