简体   繁体   English

在裸机硬件上处理ROS / MAVROS消息

[英]Handling of ROS / MAVROS messages on bare metal hardware

I have a project which involves simple serial communication with a proxy using a predefined small subset of MAVLink and ROS / MAVROS messages. 我有一个项目,涉及使用预定义的MAVLink和ROS / MAVROS消息的小子集与代理进行简单的串行通信。

I'm running on my own bare metal embedded ARM Cortex F4 hardware with no underlying operating system (other than my own framework that supports serial comms and other hardware I/O etc). 我在没有基础操作系统的裸机嵌入式ARM Cortex F4硬件上运行(除了我自己的支持串行通讯和其他硬件I / O的框架以外)。

With respect to the MAVLink aspect of this task, the process seems relatively straightforward. 关于此任务的MAVLink方面,该过程似乎相对简单。 Message IDs are predefined and the MAVLink header files (generated from the XML) contain the packing and serialisation functions. 消息ID是预定义的,并且MAVLink头文件(从XML生成)包含打包和序列化功能。 I have successfully implemented and tested this aspect. 我已经成功实现并测试了这方面。

However, I'm struggling to achieve the same functionality with ROS and MAVROS. 但是,我正在努力实现与ROS和MAVROS相同的功能。

I notice that the MAVROS distribution contains header files that define the MAVROS messages and conversion to / from MAVLink messages. 我注意到,MAVROS分发包含一些头文件,这些头文件定义了MAVROS消息以及从MAVLink消息到/从MAVLink消息的转换。

The following bullet points outline the process I'm trying to understand. 以下要点概述了我要理解的过程。

  • A message is received as a MAVLink packet, how do I determine if it's actually a ROS / MAVROS message? 收到一条消息作为MAVLink数据包,如何确定它实际上是ROS / MAVROS消息? I assume that the MAVLink message ID will be different to standard MAVLink messages, but I cannot find any information about this. 我假设MAVLink消息ID与标准MAVLink消息不同,但是我找不到与此有关的任何信息。
  • Once I know it's a ROS / MAVROS message, I can convert it using the MAVLink to MAVROS conversion code defined in the MAVROS distribution (as mentioned above). 一旦知道它是ROS / MAVROS消息,就可以使用MAVROS分发中定义的MAVLink到MAVROS转换代码将其转换(如上所述)。
  • Now that I have a MAVROS message, how can I determine the actual message type and parse and extract its payload? 既然有了MAVROS消息,如何确定实际的消息类型并解析并提取其有效载荷? I assume that this relates to the first bullet point (identifying the ROS / MAVROS messages). 我认为这与第一个要点有关(标识ROS / MAVROS消息)。
  • Similarly, how do I reverse this process to build a MAVROS message from the required payload for a particular ROS message type? 类似地,我该如何逆转此过程,以从特定ROS消息类型所需的有效负载中构建MAVROS消息? Its subsequent conversion to MAVLink and serialisation is straightforward as described above. 如上所述,其随后对MAVLink的转换和序列化非常简单。

Ultimately all I want to do is serialise and de-serialise a small subset of the ROS / MAVROS messages without the requirement of a large framework overhead. 最终,我要做的就是序列化和反序列化ROS / MAVROS消息的一小部分,而无需占用大量框架开销。 Whilst the information allowing me to do this with MAVLink is readily available and easy to implement, I cannot find the equivalent information I need to implement the same functionality with ROS / MAVROS messages. 尽管允许我使用MAVLink进行此操作的信息是容易获得且易于实现的,但是我找不到与ROS / MAVROS消息实现相同功能所需的等效信息。

Any help or clarification would be very welcome! 任何帮助或澄清将非常欢迎!

Many thanks! 非常感谢!

I had worked with pixhawk sometime back. 我曾经和pixhawk合作过。 I will try my best to help here. 我会尽力为您提供帮助。 Documentations on mavros, as I am aware of includes: 据我所知,有关mavros的文档包括:

Basically, mavros consists of two parts: 基本上,mavros包含两个部分:

  • libmavcon libmavcon
  • mavros 马夫罗斯

libmovcon is the mavlink transiver that sends/receives messages from radio/ethernet/wifi network and publish/subscribe the ENCODED (still in MAVLINK's format) message to ROS message distribution system. libmovcon是mavlink收发器,可从无线电/以太网/ wifi网络发送/接收消息,并将已编码(仍为MAVLINK格式)的消息发布/订阅到ROS消息分发系统。 mavros is the glue piece that publish/subscribe to the ENCODED version of the message and selectively decode and translate them into ROS messages. mavros是发布/订阅消息的ENCODED版本并有选择地将其解码并转换为ROS消息的粘合剂。 (eg. mavlink global velocity to ROS geometry_msgs/TwistStamped) (例如,将mavlink全局速度转换为ROS geometry_msgs / TwistStamped)

Back to your question: 回到您的问题:

  1. In libmavcon, you define the hardware resource (serial port, udp port etc.) that will send/receive mavlink messages. 在libmavcon中,您定义将发送/接收mavlink消息的硬件资源(串行端口,udp端口等)。
  2. Yes, mavros will do the conversion between mavlink message definition and ROS message definition. 是的,mavros将在mavlink消息定义和ROS消息定义之间进行转换。
  3. mavros will compile a table to mavlink message ID and its binding ROS message. mavros会将一个表编译为mavlink消息ID及其绑定的ROS消息。 There is done by plugins. 插件完成了。 You can create your own plug-in to cover custom messages. 您可以创建自己的插件来覆盖自定义消息。
  4. save as 3 另存为3

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM