Feature Request: Dynamic Type Handling for Generic Subscriptions
维护者通常 1 天内回复
@Barry-Xu-2018 已经在做这个了。
开始于 2024年6月22日。
评估
这个 Issue 还没有评估数据。
描述
Feature request
Feature description
I am developing an application where I need to subscribe to topics with unknown message types (similar to rosbag2). In the subscription callback, I need access to the deserialized message and its fields without knowing the type in advance.
There is a related example here, but it requires specifying the type (T2) beforehand. I am looking for a way to use only the topic type as a string to dynamically obtain the message class.
Using snippets here and there from rclcpp I put together this incomplete example:
node->create_generic_subscription(
topic_name,
topic_type,
qos,
[this, topic_name, topic_type](std::shared_ptr<const rclcpp::SerializedMessage> message,
const rclcpp::MessageInfo & mi) {
void* deserialized_msg = nullptr;
auto ts_lib = rclcpp::get_typesupport_library(topic_type, "rosidl_typesupport_cpp");
auto type_support = rclcpp::get_message_typesupport_handle(topic_type, "rosidl_typesupport_cpp", *ts_lib);
rmw_deserialize(&message->get_rcl_serialized_message(), type_support, deserialized_msg);
});
The issue is that deserialized_msg is a null pointer ('void *'), and I am unsure how to proceed from here.
If there is currently no way to achieve this, please consider this a feature request. I am open to contributing with some guidance on the implementation. Thanks!
Related:
https://answers.ros.org/question/405796/deserialize-message-with-topic-name-ros2/
https://github.com/ros2/rclcpp/issues/2260
https://github.com/ros2/ros2/issues/1374
https://github.com/facontidavide/rosx_introspection
- 主要语言
- C++
- 星标
- 829
- 派生
- 587
- 平均合并
- 4 天 6 小时
- 30 天内合并 PR
- 30
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
ros2/rclcpp 的其他 Issue
-
enhancement
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 48/100
维护者通常 1 天内回复
-
Memory grows per callback group created and destroyed on long lived nodes可能已有人在做 @jwallace42 于 1 天前认领。 未关闭bug
难度 4/5 3-5 天 新手友好度 28/100
ros2/rclcpp#3428 · 1 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
removing and immediately re-adding a node to the EventsCBGExecutor leaves its entities unregistered可能已有人在做 @skyegalaxy 于 10 天前认领。 未关闭bug
维护者通常 1 天内回复
-
[Humble] Removing a node with more than one auto-added callback group leaves a dangling guard condition in the executor可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 4/5 3-5 天 新手友好度 55/100
维护者通常 1 天内回复
相似的 Issue
-
arch-based bug niri
难度 2/5 1-3 小时 新手友好度 68/100
noctalia-dev/noctalia#5552 ·
维护者通常 1 天内回复
-
bug
难度 1/5 1-3 小时 新手友好度 82/100
EchoTools/nevr-runtime#2912 ·
维护者通常 1 天内回复
-
area/docdb kind/failing-test priority/medium status/awaiting-triage
难度 2/5 1-3 小时 新手友好度 82/100
yugabyte/yugabyte-db#39462 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
meshtastic/firmware#12519 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 79/100
维护者通常 1 天内回复