mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-17 02:33:35 +08:00
msg: RTPS: pass RTPS ID msg definition file as an EmPy global var
This commit is contained in:
@@ -20,14 +20,6 @@ from px_generate_uorb_topic_files import MsgScope # this is in Tools/
|
||||
topic_names = [single_spec.short_name for single_spec in spec]
|
||||
send_topics = [s.short_name for idx, s in enumerate(spec) if scope[idx] == MsgScope.SEND]
|
||||
recv_topics = [s.short_name for idx, s in enumerate(spec) if scope[idx] == MsgScope.RECEIVE]
|
||||
yaml_file = os.path.abspath('uorb_rtps_message_ids.yaml')
|
||||
try:
|
||||
msg_ids = parse_yaml_msg_id_file(yaml_file)
|
||||
except OSError as e:
|
||||
if e.errno == errno.ENOENT:
|
||||
raise IOError(errno.ENOENT, os.strerror(errno.ENOENT), yaml_file)
|
||||
else:
|
||||
raise
|
||||
}@
|
||||
/****************************************************************************
|
||||
*
|
||||
@@ -120,7 +112,7 @@ void* send(void* /*unused*/)
|
||||
/* payload is shifted by header length to make room for header*/
|
||||
serialize_@(topic)(&MicroBufferWriter, &data, &data_buffer[header_length], &length);
|
||||
|
||||
if (0 < (read = transport_node->write((char)@(rtps_message_id(msg_ids, topic)), data_buffer, length)))
|
||||
if (0 < (read = transport_node->write((char)@(rtps_message_id(ids, topic)), data_buffer, length)))
|
||||
{
|
||||
total_sent += read;
|
||||
++sent;
|
||||
@@ -196,7 +188,7 @@ void micrortps_start_topics(struct timespec &begin, int &total_read, uint32_t &r
|
||||
{
|
||||
@[for topic in recv_topics]@
|
||||
|
||||
case @(rtps_message_id(msg_ids, topic)):
|
||||
case @(rtps_message_id(ids, topic)):
|
||||
{
|
||||
deserialize_@(topic)(&MicroBufferReader, &@(topic)_data, data_buffer);
|
||||
if (!@(topic)_pub) {
|
||||
|
||||
Reference in New Issue
Block a user