ros2 watch
if 0
int32_t index;
msg_ok = sub_.wait_for_data(index);
/* new data or reallocate */
if (msg_ok)
{
/* reallocate request */
if ( index == ROS_SHM_SEGMENT_WROTE_NUM )
{
ZORO_LOG_INFO("Reallocate SharedMemory Request");
// TODO: remove sub_.addr_sub
// re-attach-shared memory
bool attached=false;
ZORO_LOG_INFO("Try Attaching ...");
while (!attached)
{
if ( sub_.attach_topic_segment(topic_) )
{
attached=true;
ZORO_LOG_INFO("Attach Shared Memory: Success, topic <%s>", topic_.c_str());
continue;
}
else
{
ZORO_LOG_INFO("Attach Shared Memory: Failure, topic <%s>", topic_.c_str());
}
usleep(10000);
}
continue;
}
else /* new data arrived */
{
ZORO_LOG_INFO("New data arrived: index=%d",index);
}
}
else
{
// ZORO_LOG_INFO("topic <%s> wait timeout",topic_.c_str());
}
msg_ok = false;