| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Signed-off-by: methylDragon <methylDragon@gmail.com>
Signed-off-by: methylDragon <methylDragon@gmail.com>
Signed-off-by: methylDragon <methylDragon@gmail.com>
Signed-off-by: methylDragon <methylDragon@gmail.com>
Signed-off-by: methylDragon <methylDragon@gmail.com>
Signed-off-by: methylDragon <methylDragon@gmail.com>
Signed-off-by: methylDragon <methylDragon@gmail.com>
Signed-off-by: methylDragon <methylDragon@gmail.com>
Signed-off-by: methylDragon <methylDragon@gmail.com>
Signed-off-by: methylDragon <methylDragon@gmail.com>
|
⚠️ The sha of the head commit of this PR conflicts with #2160. Mergify cannot evaluate rules on this PR. ⚠️ |
Sorry, something went wrong.
| if (ret != RCL_RET_OK) { | ||
| throw std::runtime_error("error initializing rosidl message type support"); | ||
| } | ||
| if (!ts) { |
There was a problem hiding this comment.
Can all these bad cases be true if ret == RCL_RET_OK?
Sorry, something went wrong.
There was a problem hiding this comment.
🤔 probably not.
I might still leave in the typesupport identifier check though
Sorry, something went wrong.
|
⚠️ The sha of the head commit of this PR conflicts with #2160. Mergify cannot evaluate rules on this PR. ⚠️ |
Sorry, something went wrong.
|
|
||
| RCLCPP_PUBLIC | ||
| void | ||
| manage_description_(rosidl_runtime_c__type_description__TypeDescription * description); |
There was a problem hiding this comment.
manage is an overloaded term - this is really a make_shared function to put ownership of the object into a shared pointer, right?
Sorry, something went wrong.
There was a problem hiding this comment.
Yeah that's true.. I wanted it to be like a: "We are taking ownership/managing the lifetime of the pointer now)
It's a private method though, so I don't have any issues with changing the name
Sorry, something went wrong.
| ROS_MESSAGE = 1, // take message as ROS message and handle as ROS message | ||
| SERIALIZED_MESSAGE = 2, // take message as serialized and handle as serialized | ||
| DYNAMIC_MESSAGE_DIRECT = 3, // take message as DynamicMessage and handle as DynamicMessage | ||
| DYNAMIC_MESSAGE_FROM_SERIALIZED = 4 // take message as serialized and handle as DynamicMessage |
There was a problem hiding this comment.
The distinction here isn't clear to me between dynamic message direct and serialized.
What does this wording pattern "take as X and handle as Y" mean? Does "handle" refer to the argument type for the callback?
Sorry, something went wrong.
There was a problem hiding this comment.
Yep, "handle" is for the callback.
The way it works with ROS is that a message has to be taken, then passed to a handle function that passes it to a callback. So take -> handle.
Sorry, something went wrong.
There was a problem hiding this comment.
What about a dynamic subscription that passes serialized data to the handler function? GenericDynamicSubscription, perhaps. It's what we would want in rosbag2 recording. Or is that the case for DYNAMIC_MESSAGE_FROM_SERIALIZED, I couldn't quite tell.
Sorry, something went wrong.
There was a problem hiding this comment.
In that case you would want to use a serialized subscription (I.e. one that takes and handles serialized data), then use the DynamicMessage class to deserialize the serialized message into the DynamicMessage inside the callback
You probably would need to subclass that subscription so you can instantiate a DynamicMessage and have it accessible inside the callback
Sorry, something went wrong.
There was a problem hiding this comment.
(Basically you just need a way to implement what the executor is doing here, in the callback)
Sorry, something went wrong.
There was a problem hiding this comment.
// Take serialized and then convert to dynamic message
case rclcpp::SubscriptionType::DYNAMIC_MESSAGE_FROM_SERIALIZED:
{
std::shared_ptr<SerializedMessage> serialized_msg =
subscription->create_serialized_message();
// NOTE(methylDragon): Is this clone necessary? If I'm following the pattern, it seems so.
DynamicMessage::SharedPtr dynamic_message = subscription->create_dynamic_message();
take_and_do_error_handling(
"taking a serialized message from topic",
subscription->get_topic_name(),
[&]() {return subscription->take_serialized(*serialized_msg.get(), message_info);},
[&]()
{
// === <<< THIS IS THE MOST IMPORTANT LINE!!! >>> ===
bool ret = dynamic_message->deserialize(&serialized_msg->get_rcl_serialized_message());
// ^^^ <<< THIS IS THE MOST IMPORTANT LINE!!! >>> ^^^
if (!ret) {
throw_from_rcl_error(ret, "Couldn't convert serialized message to dynamic data!");
}
subscription->handle_dynamic_message(dynamic_message, message_info);
}
);
subscription->return_serialized_message(serialized_msg);
subscription->return_dynamic_message(dynamic_message);
break;
}
}
Sorry, something went wrong.
|
Closing this in favor of #2176 |
Sorry, something went wrong.
|
⚠️ The sha of the head commit of this PR conflicts with #2160. Mergify cannot evaluate rules on this PR. ⚠️ |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
This PR is part of the runtime interface reflection subscription feature of REP-2011: ros2/ros2#1374
Description
This PR includes support for runtime type subscriptions, including: