Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alberto Ruiz Garcia
Firmware
Commits
2250946e
Commit
2250946e
authored
6 years ago
by
TSC21
Committed by
Beat Küng
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
add verification for the ID uniqueness; give list of available ID's
parent
fc980493
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
msg/tools/generate_microRTPS_bridge.py
+31
-0
31 additions, 0 deletions
msg/tools/generate_microRTPS_bridge.py
msg/tools/px_generate_uorb_topic_helper.py
+13
-8
13 additions, 8 deletions
msg/tools/px_generate_uorb_topic_helper.py
with
44 additions
and
8 deletions
msg/tools/generate_microRTPS_bridge.py
+
31
−
0
View file @
2250946e
...
...
@@ -82,6 +82,35 @@ def parse_yaml_msg_id_file(yaml_file):
raise
def
get_used_rtps_ids
(
msg_id_map
):
msg_ids
=
{}
for
dict
in
msg_id_map
[
'
rtps
'
]:
msg_ids
.
update
({
dict
[
'
msg
'
]:
dict
[
'
id
'
]})
return
msg_ids
def
check_rtps_id_uniqueness
(
msg_id_map
):
"""
Checks if there are no ID
'
s repeated on the map
"""
msg_ids
=
get_used_rtps_ids
(
msg_id_map
)
used_ids
=
msg_ids
.
values
()
used_ids
.
sort
()
repeated_keys
=
dict
()
for
key
,
value
in
msg_ids
.
items
():
if
used_ids
.
count
(
value
)
>
1
:
repeated_keys
.
update
({
key
:
value
})
if
not
repeated_keys
:
print
(
"
All good. RTPS ID
'
s are unique
"
)
else
:
raise
AssertionError
(
"
,
"
.
join
(
'
%s
'
%
msgs
for
msgs
in
repeated_keys
.
keys
())
+
"
have their keys repeated. Please choose from the following pool:
\n
"
+
"
,
"
.
join
(
'
%d
'
%
id
for
id
in
px_generate_uorb_topic_helper
.
check_available_ids
(
used_ids
)))
default_client_out
=
get_absolute_path
(
"
src/modules/micrortps_bridge/micrortps_client
"
)
default_agent_out
=
get_absolute_path
(
...
...
@@ -206,6 +235,8 @@ uorb_templates_dir = os.path.join(msg_folder, args.uorb_templates)
urtps_templates_dir
=
os
.
path
.
join
(
msg_folder
,
args
.
urtps_templates
)
# parse yaml file into a map of ids
rtps_ids
=
parse_yaml_msg_id_file
(
os
.
path
.
join
(
msg_folder
,
args
.
yaml_file
))
# check if there are no ID's repeated
check_rtps_id_uniqueness
(
rtps_ids
)
uRTPS_CLIENT_TEMPL_FILE
=
'
microRTPS_client.cpp.template
'
...
...
This diff is collapsed.
Click to expand it.
msg/tools/px_generate_uorb_topic_helper.py
+
13
−
8
View file @
2250946e
...
...
@@ -347,18 +347,23 @@ def print_field_def(field):
array_size
,
comment
))
def
check_available_ids
(
used_msg_ids_list
):
"""
Checks the available RTPS ID
'
s
"""
return
set
(
list
(
range
(
0
,
255
)))
-
set
(
used_msg_ids_list
)
def
rtps_message_id
(
msg_id_map
,
message
):
"""
Get RTPS ID of uORB message
"""
msg
_id
=
-
1
used
_id
s
=
list
()
for
dict
in
msg_id_map
[
0
][
'
rtps
'
]:
used_ids
.
append
(
dict
[
'
id
'
])
if
message
in
dict
[
'
msg
'
]:
msg_id
=
dict
[
'
id
'
]
return
dict
[
'
id
'
]
if
msg_id
!=
-
1
:
return
msg_id
else
:
raise
AssertionError
(
"
%s does not have a RTPS ID set in the definition file. Please add an ID from the available pool!
"
)
exit
(
1
)
raise
AssertionError
(
"
%s does not have a RTPS ID set in the definition file. Please add an ID from the available pool:
\n
"
%
message
+
"
,
"
.
join
(
'
%d
'
%
id
for
id
in
check_available_ids
(
used_ids
)))
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment