Feature Request: Dynamic Type Handling for Generic Subscriptions
Los mantenedores suelen responder en 1 día
@Barry-Xu-2018 ya está trabajando en esto.
Desde el 22/6/2024.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
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
- Lenguaje dominante
- C++
- Estrellas
- 829
- Forks
- 587
- Merge medio
- 4 d 6 h
- PR fusionados (30 d)
- 30
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de ros2/rclcpp
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
Los mantenedores suelen responder en 1 día
-
Memory grows per callback group created and destroyed on long lived nodesPosiblemente ocupada @jwallace42 la tomó hace 1 día. Abiertobug
Dificultad 4/5 3-5 días Aptitud para principiantes 28/100
ros2/rclcpp#3428 · 1 comentario · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
removing and immediately re-adding a node to the EventsCBGExecutor leaves its entities unregisteredPosiblemente ocupada @skyegalaxy la tomó hace 10 días. Abiertobug
ros2/rclcpp#3418 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
[Humble] Removing a node with more than one auto-added callback group leaves a dangling guard condition in the executorPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
ros2/rclcpp#3410 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de ros2/rclcpp
Issues similares
-
arch-based bug niri
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
noctalia-dev/noctalia#5552 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 1/5 1-3 horas Aptitud para principiantes 82/100
EchoTools/nevr-runtime#2912 ·
Los mantenedores suelen responder en 1 día
-
area/docdb kind/failing-test priority/medium status/awaiting-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
yugabyte/yugabyte-db#39462 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
meshtastic/firmware#12519 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
Los mantenedores suelen responder en 1 día