I'm a student and currently experimenting with the QoS-settings in ROS 2. I'm trying to implement the (RMW_EVENT_REQUESTED_DEADLINE_MISSED) event.
First I declare the subscription and event:
static const rmw_subscription_t sub1
{
"sub1", (void *) "gets deadline missed", "topic1"
};
static const rmw_event_t deadline_missed =
{
"event 1" , (void *) "deadline missed", RMW_EVENT_REQUESTED_DEADLINE_MISSED
};
After that I try to initialize the event:
rmw_subscription_event_init(deadline_missed, sub1, RMW_EVENT_REQUESTED_DEADLINE_MISSED);
But I get an error ( No matching function for call to 'rmw_subscription_event_init')
The program suggests me to change my subscription and event declaration to:
static const rmw_subscription_t *const sub1
{
"sub1", (void *) "gets deadline missed", "topic1"
};
static rmw_event_t *const deadline_missed =
{
"event 1" , (void *) "deadline missed", RMW_EVENT_REQUESTED_DEADLINE_MISSED
};
But then I get the following error (Excess elements in scalar initializer).
How do I fix this problem and which of those 2 cases is the best? Or is there a completely other way of creating this event?
Thanks in advance!