如何在我的ROS2程序中包含turtlesim/msg/pose?

问题描述 投票:0回答:1

这是我在尝试不同的方法后不断遇到的错误,可能的错误是什么? 我可以在终端的主题列表中清楚地看到主题turtlesim/pose和msg类型turtlesim/msg/pose,但是编译没有检测到目录,并且无法包含这些是CMakelist文件和.xml文件https://i.stack.imgur.com/acCjz.pngCMakelist file .xml file可能是什么问题?

如果你也发布你的代码就更好了。或者至少有一个
compiler-errors include ros2
1个回答
0
投票

这可能是一个错字,正如评论中提到的starball

无论如何,您都可以查看 git 中的工作示例

。具体来说:

您应该将其包含在

  • #include <turtlesim/msg/pose.hpp>
你可以这样使用它:
  • pose_subscription_ = this->create_subscription<turtlesim::msg::Pose>( "turtle1/pose", 1, std::bind(&SquareMove::pose_callback_, this, std::placeholders::_1));

© www.soinside.com 2019 - 2024. All rights reserved.