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
43f78705
Commit
43f78705
authored
6 years ago
by
TSC21
Committed by
Beat Küng
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
add option to set the msg IDL dir
parent
e3560795
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
msg/tools/generate_microRTPS_bridge.py
+38
-22
38 additions, 22 deletions
msg/tools/generate_microRTPS_bridge.py
src/modules/micrortps_bridge/micrortps_client/CMakeLists.txt
+1
-0
1 addition, 0 deletions
src/modules/micrortps_bridge/micrortps_client/CMakeLists.txt
with
39 additions
and
22 deletions
msg/tools/generate_microRTPS_bridge.py
+
38
−
22
View file @
43f78705
...
...
@@ -67,7 +67,8 @@ parser.add_argument("-s", "--send", dest='send', metavar='*.msg', type=str, narg
parser
.
add_argument
(
"
-r
"
,
"
--receive
"
,
dest
=
'
receive
'
,
metavar
=
'
*.msg
'
,
type
=
str
,
nargs
=
'
+
'
,
help
=
"
Topics to be received
"
)
parser
.
add_argument
(
"
-a
"
,
"
--agent
"
,
dest
=
'
agent
'
,
action
=
"
store_true
"
,
help
=
"
Flag for generate the agent, by default is true if -c is not specified
"
)
parser
.
add_argument
(
"
-c
"
,
"
--client
"
,
dest
=
'
client
'
,
action
=
"
store_true
"
,
help
=
"
Flag for generate the client, by default is true if -a is not specified
"
)
parser
.
add_argument
(
"
-i
"
,
"
--generate-idl
"
,
dest
=
'
idl
'
,
action
=
"
store_true
"
,
help
=
"
Flag for generate idl files for each msg
"
)
parser
.
add_argument
(
"
-i
"
,
"
--generate-idl
"
,
dest
=
'
gen_idl
'
,
action
=
"
store_true
"
,
help
=
"
Flag for generate idl files for each msg
"
)
parser
.
add_argument
(
"
-j
"
,
"
--idl-dir
"
,
dest
=
'
idl_dir
'
,
type
=
str
,
help
=
"
IDL files dir
"
,
default
=
''
)
parser
.
add_argument
(
"
-m
"
,
"
--mkdir-build
"
,
dest
=
'
mkdir_build
'
,
action
=
"
store_true
"
,
help
=
"
Flag to create
'
build
'
dir
"
)
parser
.
add_argument
(
"
-t
"
,
"
--topic-msg-dir
"
,
dest
=
'
msgdir
'
,
type
=
str
,
help
=
"
Topics message dir, by default msg/
"
,
default
=
"
msg
"
)
parser
.
add_argument
(
"
-b
"
,
"
--uorb-templates-dir
"
,
dest
=
'
uorb_templates
'
,
type
=
str
,
help
=
"
uORB templates dir, by default msg_dir/templates/uorb_microcdr
"
,
default
=
default_uorb_templates_dir
)
...
...
@@ -99,12 +100,17 @@ else:
agent
=
args
.
agent
client
=
args
.
client
idl
=
args
.
idl
mkdir_build
=
args
.
mkdir_build
del_tree
=
args
.
del_tree
px_generate_uorb_topic_files
.
append_to_include_path
({
msg_folder
},
px_generate_uorb_topic_files
.
INCL_DEFAULT
,
package
)
agent_out_dir
=
get_absolute_path
(
args
.
agentdir
)
client_out_dir
=
get_absolute_path
(
args
.
clientdir
)
gen_idl
=
args
.
gen_idl
idl_dir
=
args
.
idl_dir
if
idl_dir
!=
''
:
idl_dir
=
get_absolute_path
(
args
.
idl_dir
)
else
:
idl_dir
=
agent_out_dir
+
"
/idl
"
if
args
.
fastrtpsgen
is
None
or
args
.
fastrtpsgen
==
""
:
# Assume fastrtpsgen is in PATH
...
...
@@ -157,9 +163,13 @@ def generate_agent(out_dir):
if
msg_files_send
:
for
msg_file
in
msg_files_send
:
if
idl
:
px_generate_uorb_topic_files
.
generate_idl_file
(
msg_file
,
out_dir
+
"
/idl
"
,
urtps_templates_dir
,
package
,
px_generate_uorb_topic_files
.
INCL_DEFAULT
)
if
gen_idl
:
if
out_dir
!=
agent_out_dir
:
px_generate_uorb_topic_files
.
generate_idl_file
(
msg_file
,
out_dir
+
"
/idl
"
,
urtps_templates_dir
,
package
,
px_generate_uorb_topic_files
.
INCL_DEFAULT
)
else
:
px_generate_uorb_topic_files
.
generate_idl_file
(
msg_file
,
idl_dir
,
urtps_templates_dir
,
package
,
px_generate_uorb_topic_files
.
INCL_DEFAULT
)
px_generate_uorb_topic_files
.
generate_topic_file
(
msg_file
,
out_dir
,
urtps_templates_dir
,
package
,
px_generate_uorb_topic_files
.
INCL_DEFAULT
,
uRTPS_PUBLISHER_SRC_TEMPL_FILE
)
px_generate_uorb_topic_files
.
generate_topic_file
(
msg_file
,
out_dir
,
urtps_templates_dir
,
...
...
@@ -167,9 +177,13 @@ def generate_agent(out_dir):
if
msg_files_receive
:
for
msg_file
in
msg_files_receive
:
if
idl
:
px_generate_uorb_topic_files
.
generate_idl_file
(
msg_file
,
out_dir
+
"
/idl
"
,
urtps_templates_dir
,
package
,
px_generate_uorb_topic_files
.
INCL_DEFAULT
)
if
gen_idl
:
if
out_dir
!=
agent_out_dir
:
px_generate_uorb_topic_files
.
generate_idl_file
(
msg_file
,
out_dir
+
"
/idl
"
,
urtps_templates_dir
,
package
,
px_generate_uorb_topic_files
.
INCL_DEFAULT
)
else
:
px_generate_uorb_topic_files
.
generate_idl_file
(
msg_file
,
idl_dir
,
urtps_templates_dir
,
package
,
px_generate_uorb_topic_files
.
INCL_DEFAULT
)
px_generate_uorb_topic_files
.
generate_topic_file
(
msg_file
,
out_dir
,
urtps_templates_dir
,
package
,
px_generate_uorb_topic_files
.
INCL_DEFAULT
,
uRTPS_SUBSCRIBER_SRC_TEMPL_FILE
)
px_generate_uorb_topic_files
.
generate_topic_file
(
msg_file
,
out_dir
,
urtps_templates_dir
,
...
...
@@ -185,26 +199,28 @@ def generate_agent(out_dir):
package
,
px_generate_uorb_topic_files
.
INCL_DEFAULT
,
uRTPS_AGENT_CMAKELIST_TEMPL_FILE
)
# Final steps to install agent
mkdir_p
(
agent_
out_dir
+
"
/fastrtpsgen
"
)
mkdir_p
(
out_dir
+
"
/fastrtpsgen
"
)
prev_cwd_path
=
os
.
getcwd
()
os
.
chdir
(
agent_out_dir
+
"
/fastrtpsgen
"
)
for
idl_file
in
glob
.
glob
(
agent_out_dir
+
"
/idl/*.idl
"
):
ret
=
subprocess
.
call
(
fastrtpsgen_path
+
"
-d
"
+
agent_out_dir
+
"
/fastrtpsgen -example x64Linux2.6gcc
"
+
idl_file
,
shell
=
True
)
os
.
chdir
(
out_dir
+
"
/fastrtpsgen
"
)
if
not
glob
.
glob
(
idl_dir
+
"
/*.idl
"
):
raise
Exception
(
"
No IDL files found in %s
"
%
idl_dir
)
for
idl_file
in
glob
.
glob
(
idl_dir
+
"
/*.idl
"
):
ret
=
subprocess
.
call
(
fastrtpsgen_path
+
"
-d
"
+
out_dir
+
"
/fastrtpsgen -example x64Linux2.6gcc
"
+
idl_file
,
shell
=
True
)
if
ret
:
raise
Exception
(
"
fastrtpsgen not found. Specify the location of fastrtpsgen with the -f flag
"
)
rm_wildcard
(
agent_
out_dir
+
"
/fastrtpsgen/*PubSubMain*
"
)
rm_wildcard
(
agent_
out_dir
+
"
/fastrtpsgen/makefile*
"
)
rm_wildcard
(
agent_
out_dir
+
"
/fastrtpsgen/*Publisher*
"
)
rm_wildcard
(
agent_
out_dir
+
"
/fastrtpsgen/*Subscriber*
"
)
for
f
in
glob
.
glob
(
agent_
out_dir
+
"
/fastrtpsgen/*.cxx
"
):
rm_wildcard
(
out_dir
+
"
/fastrtpsgen/*PubSubMain*
"
)
rm_wildcard
(
out_dir
+
"
/fastrtpsgen/makefile*
"
)
rm_wildcard
(
out_dir
+
"
/fastrtpsgen/*Publisher*
"
)
rm_wildcard
(
out_dir
+
"
/fastrtpsgen/*Subscriber*
"
)
for
f
in
glob
.
glob
(
out_dir
+
"
/fastrtpsgen/*.cxx
"
):
os
.
rename
(
f
,
f
.
replace
(
"
.cxx
"
,
"
.cpp
"
))
cp_wildcard
(
agent_
out_dir
+
"
/fastrtpsgen/*
"
,
agent_
out_dir
)
if
os
.
path
.
isdir
(
agent_
out_dir
+
"
/fastrtpsgen
"
):
shutil
.
rmtree
(
agent_
out_dir
+
"
/fastrtpsgen
"
)
cp_wildcard
(
out_dir
+
"
/fastrtpsgen/*
"
,
out_dir
)
if
os
.
path
.
isdir
(
out_dir
+
"
/fastrtpsgen
"
):
shutil
.
rmtree
(
out_dir
+
"
/fastrtpsgen
"
)
cp_wildcard
(
urtps_templates_dir
+
"
/microRTPS_transport.*
"
,
agent_out_dir
)
os
.
rename
(
agent_
out_dir
+
"
/microRTPS_agent_CMakeLists.txt
"
,
agent_
out_dir
+
"
/CMakeLists.txt
"
)
os
.
rename
(
out_dir
+
"
/microRTPS_agent_CMakeLists.txt
"
,
out_dir
+
"
/CMakeLists.txt
"
)
if
(
mkdir_build
):
mkdir_p
(
agent_
out_dir
+
"
/build
"
)
mkdir_p
(
out_dir
+
"
/build
"
)
os
.
chdir
(
prev_cwd_path
)
return
0
...
...
This diff is collapsed.
Click to expand it.
src/modules/micrortps_bridge/micrortps_client/CMakeLists.txt
+
1
−
0
View file @
43f78705
...
...
@@ -87,6 +87,7 @@ if (NOT "${config_rtps_send_topics}" STREQUAL "" OR NOT "${config_rtps_receive_t
--urtps-templates-dir
"/templates/urtps"
--agent-outdir
${
CMAKE_CURRENT_BINARY_DIR
}
/micrortps_agent
--client-outdir
${
CMAKE_CURRENT_BINARY_DIR
}
/micrortps_client
--idl-dir
${
CMAKE_CURRENT_BINARY_DIR
}
/micrortps_agent/idl
>micrortps_bridge.log 2>&1 || cat micrortps_bridge.log
# quiet successful build output
DEPENDS
${
send_topic_files
}
${
receive_topic_files
}
COMMENT
"Generating RTPS topic bridge"
...
...
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