Skip to content

Commit cad30d0

Browse files
zifengqi123tonybaltovski
authored andcommitted
ros2 foxy
1 parent 987376f commit cad30d0

File tree

5 files changed

+42
-36
lines changed

5 files changed

+42
-36
lines changed

package.xml

+7-19
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,19 @@
11
<?xml version="1.0"?>
2-
<package format="2">
2+
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
3+
<package format="3">
34
<name>robot_upstart</name>
45
<version>0.4.2</version>
56
<description>
67
The robot_upstart package provides scripts which may be used to install
78
and uninstall Ubuntu Linux upstart jobs which launch groups of roslaunch files.
89
</description>
910

10-
<maintainer email="[email protected]">Chris Iverach-Brereton</maintainer>
11-
<maintainer email="[email protected]">Tony Baltovski</maintainer>
12-
<author email="[email protected]">Mike Purvis</author>
13-
14-
<license>BSD</license>
15-
16-
<buildtool_depend>catkin</buildtool_depend>
17-
18-
<exec_depend>daemontools</exec_depend>
19-
<exec_depend>net-tools</exec_depend>
20-
<exec_depend>roslaunch</exec_depend>
21-
<exec_depend>util-linux</exec_depend>
22-
<exec_depend>xacro</exec_depend>
23-
24-
<test_depend>roslint</test_depend>
25-
<test_depend>rosunit</test_depend>
11+
<test_depend>ament_copyright</test_depend>
12+
<test_depend>ament_flake8</test_depend>
13+
<test_depend>ament_pep257</test_depend>
14+
<test_depend>python3-pytest</test_depend>
2615

2716
<export>
28-
<architecture_independent/>
29-
<rosdoc config="rosdoc.yaml"/>
17+
<build_type>ament_python</build_type>
3018
</export>
3119
</package>

scripts/mklaunch

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
# Please send comments, questions, or patches to [email protected]
2929

3030
path=$1
31-
files=$(ls $path/*.launch)
31+
files=$(ls $path/*.launch.py)
3232
if [[ "$?" != "0" ]]; then
3333
echo "<!-- No matching files found -->"
3434
exit 1

setup.py

+24-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,25 @@
1-
from distutils.core import setup
2-
from catkin_pkg.python_setup import generate_distutils_setup
1+
import os
2+
from setuptools import setup
3+
from glob import glob
34

4-
setup(**generate_distutils_setup(
5-
packages=['robot_upstart'],
6-
package_dir={'': 'src'}
7-
))
5+
package_name = 'robot_upstart'
6+
7+
setup(
8+
name=package_name,
9+
packages=[package_name],
10+
data_files=[
11+
('share/ament_index/resource_index/packages',
12+
['resource/' + package_name]),
13+
('share/' + package_name, ['package.xml']),
14+
(os.path.join('lib', package_name, 'scripts'), glob('scripts/*')),
15+
(os.path.join('share', package_name, 'scripts'), glob('scripts/*')),
16+
(os.path.join('share', package_name, 'templates'), glob('templates/*')),
17+
],
18+
install_requires=['setuptools'],
19+
zip_safe=True,
20+
tests_require=['pytest'],
21+
entry_points={
22+
'console_scripts': [
23+
],
24+
},
25+
)

templates/job-start.em

+9-9
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ if [[ ! -d $log_path ]]; then
5353
fi
5454

5555
@[if interface]@
56-
export ROS_IP=`rosrun robot_upstart getifip @(interface)`
56+
export ROS_IP=`ros2 run robot_upstart getifip @(interface)`
5757
if [ "$ROS_IP" = "" ]; then
58-
log err "@(name): No IP address on @(interface), cannot roslaunch."
58+
log err "@(name): No IP address on @(interface), cannot ros2 launch."
5959
exit 1
6060
fi
6161
@[else]@
@@ -75,10 +75,10 @@ log info "@(name): Launching ROS_HOSTNAME=$ROS_HOSTNAME, ROS_IP=$ROS_IP, ROS_MAS
7575
# If xacro files are present in job folder, generate and expand an amalgamated urdf.
7676
XACRO_FILENAME=$log_path/@(name).xacro
7777
XACRO_ROBOT_NAME=$(echo "@(name)" | cut -d- -f1)
78-
rosrun robot_upstart mkxacro $JOB_FOLDER $XACRO_ROBOT_NAME > $XACRO_FILENAME
78+
ros2 run robot_upstart mkxacro $JOB_FOLDER $XACRO_ROBOT_NAME > $XACRO_FILENAME
7979
if [[ "$?" == "0" ]]; then
8080
URDF_FILENAME=$log_path/@(name).urdf
81-
rosrun xacro xacro $XACRO_FILENAME -o $URDF_FILENAME
81+
ros2 run xacro xacro $XACRO_FILENAME -o $URDF_FILENAME
8282
if [[ "$?" == "0" ]]; then
8383
log info "@(name): Generated URDF: $URDF_FILENAME"
8484
else
@@ -88,10 +88,10 @@ if [[ "$?" == "0" ]]; then
8888
fi
8989

9090
# Assemble amalgamated launchfile.
91-
LAUNCH_FILENAME=$log_path/@(name).launch
92-
rosrun robot_upstart mklaunch $JOB_FOLDER > $LAUNCH_FILENAME
91+
LAUNCH_FILENAME=$log_path/@(name).launch.py
92+
ros2 run robot_upstart mklaunch $JOB_FOLDER > $LAUNCH_FILENAME
9393
if [[ "$?" != "0" ]]; then
94-
log err "@(name): Unable to generate amalgamated launchfile."
94+
log err "@(name): Unable to generate amalgamated launchfile. $JOB_FOLDER $LAUNCH_FILENAME"
9595
exit 1
9696
fi
9797
log info "@(name): Generated launchfile: $LAUNCH_FILENAME"
@@ -104,10 +104,10 @@ if [ "$?" != "0" ]; then
104104
fi
105105

106106
# Punch it.
107-
setpriv --reuid @(user) --regid @(user) --init-groups roslaunch $LAUNCH_FILENAME @(roslaunch_wait?'--wait ')&
107+
setpriv --reuid @(user) ros2 launch $LAUNCH_FILENAME @(roslaunch_wait?'--wait ')&
108108
PID=$!
109109

110-
log info "@(name): Started roslaunch as background process, PID $PID, ROS_LOG_DIR=$ROS_LOG_DIR"
110+
log info "@(name): Started ros2 launch as background process, PID $PID, ROS_LOG_DIR=$ROS_LOG_DIR"
111111
echo "$PID" > $log_path/@(name).pid
112112

113113
wait "$PID"

templates/job-stop.em

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131
PID=$(cat @(log_path)/@(name).pid)
3232
logger -p user.info "Attempting to stop @(name) (PID $PID)"
3333
kill $PID
34-
logger -s -p user.info "Waiting for roslaunch process to end"
34+
logger -s -p user.info "Waiting for ros2 launch process to end"
3535
while kill -0 $PID 2>/dev/null; do sleep 0.2; done

0 commit comments

Comments
 (0)