-
Notifications
You must be signed in to change notification settings - Fork 682
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added scripts for use_sim_time management (#183)
Co-authored-by: hosokawa <hosokawa@sng-3f-ros2-eval.l.sng.tier4.jp>
- Loading branch information
1 parent
0bead67
commit 700dcdc
Showing
3 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/perl | ||
|
||
$use_sim_time_str='<param name="use_sim_time" value="$(env AW_ROS2_USE_SIM_TIME false)"/>' . "\n"; | ||
|
||
$out_line=""; | ||
while(<>){ | ||
if(/^(\s*)<\s*node\s/){ | ||
$indent=$1; | ||
$out_line = $indent . " " . $use_sim_time_str; | ||
if(/\/\s*>\s*$/){ | ||
$re_str = quotemeta($&); | ||
~s/$re_str/ >\n/; | ||
print; | ||
$out_line = $out_line . $indent . "</node>\n"; | ||
print $out_line; | ||
$out_line = ""; | ||
}else{ | ||
print; | ||
} | ||
}elsif($out_line ne ""){ | ||
if(/^\s*<\s*param\s*name.*use_sim_time.*AW_ROS2_USE_SIM_TIME/){ | ||
$out_line = ""; | ||
}elsif(/^\s*<\s*\/\s*node\s*>\s*$/){ | ||
print $out_line; | ||
$out_line = ""; | ||
} | ||
print; | ||
}else{ | ||
print; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
|
||
if [ -n "$1" ]; then | ||
find_dir=$1 | ||
else | ||
echo "Usage: $0 <dir ('install' dir is recommended)>" | ||
exit 0 | ||
fi | ||
|
||
patch_script=$(dirname $(realpath $0))/$(basename $0 .sh).pl | ||
|
||
for xml in $(find $find_dir -type f | grep launch.xml$); do | ||
echo "mv $xml ${xml}.org_tmp" | ||
eval "mv $xml ${xml}.org_tmp" | ||
echo "$patch_script ${xml}.org_tmp > $xml" | ||
eval "$patch_script ${xml}.org_tmp > $xml" | ||
echo "rm ${xml}.org_tmp" | ||
eval "rm ${xml}.org_tmp" | ||
echo "" | ||
done | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
( for node in $(ros2 run topic_tools node_list |& grep \/ | perl -pe "~s/^[^\/]\//\//") | ||
#for node in $(ros2 param list|grep :) | ||
do | ||
#n=$(dirname $node)/$(basename $node :) | ||
#echo "$n: use_sim_time: $(ros2 param get $n use_sim_time)" | ||
echo "$node: use_sim_time: $(ros2 param get $node use_sim_time)" | ||
done) |& grep \/ |