Skip to content

Commit 99f3d36

Browse files
author
Parasmai Conjeevaram
committed
creating modularity within perception module for several packages - centralized launch
1 parent 3ac8c31 commit 99f3d36

File tree

32 files changed

+371
-27
lines changed

32 files changed

+371
-27
lines changed

docker/perception/perception.Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ WORKDIR ${AMENT_WS}/src
77

88
# Copy in source code
99
COPY src/perception/depth_estimation depth_estimation
10+
COPY src/perception/pose_estimation pose_estimation
11+
COPY src/perception/perception_launch perception_launch
1012
COPY src/wato_msgs/sample_msgs sample_msgs
1113

1214
# Scan for rosdeps
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
services:
22
perception: # PYTHON
3-
build: &producer_build
3+
build: &perception_build
44
context: ..
55
dockerfile: docker/perception/perception.Dockerfile
66
cache_from:
77
- "${SAMPLES_PRODUCER_IMAGE:?}:${TAG}"
88
- "${SAMPLES_PRODUCER_IMAGE:?}:main"
99
image: "${SAMPLES_PRODUCER_IMAGE:?}:${TAG}"
1010
profiles: [deploy]
11-
command: /bin/bash -c "ros2 launch depth_estimation depth_estimation.launch.py"
11+
command: /bin/bash -c "ros2 launch perception_launch perception.launch.py"
1212
volumes:
13-
- ${MONO_DIR}/src/samples/python/perception:/root/ament_ws/src/perception
13+
- ${MONO_DIR}/src/perception:/root/ament_ws/src/perception

src/perception/depth_estimation/depth_estimation/depth_estimation_core.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,21 @@
1818
class DepthEstimationCore():
1919

2020
def __init__(self, pos_x, pos_y, pos_z, vel):
21+
# Init member variables for serialization
22+
self.__pos_x = pos_x
23+
self.__pos_y = pos_y
24+
self.__pos_z = pos_z
25+
self.__velocity = vel
26+
27+
def update_position(self):
28+
# velocity in 3D delta_x = delta_y = delta_z
29+
self.__pos_x += self.__velocity / math.sqrt(3)
30+
self.__pos_y += self.__velocity / math.sqrt(3)
31+
self.__pos_z += self.__velocity / math.sqrt(3)
32+
33+
def serialize_data(self):
34+
return "x:" + str(self.__pos_x) + ";y:" + \
35+
str(self.__pos_y) + ";z:" + str(self.__pos_z) + ";"
2136

2237

2338

src/perception/depth_estimation/package.xml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@
33
<package format="3">
44
<name>depth_estimation</name>
55
<version>0.0.0</version>
6-
<description>TODO: Package description</description>
6+
<description>Depth estimation module for humanoid robot perception</description>
77
<maintainer email="e23zhou@watonomous.ca">eddyzhou</maintainer>
8-
<license>Apache2.0: License declaration</license>
8+
<license>Apache2.0</license>
9+
10+
<depend>rclpy</depend>
11+
<depend>sample_msgs</depend>
912

1013
<test_depend>ament_copyright</test_depend>
1114
<test_depend>ament_flake8</test_depend>

src/perception/depth_estimation/setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
zip_safe=True,
2424
maintainer='eddyzhou, aryanafrouzi',
2525
maintainer_email='e23zhou@watonomous.ca, aafrouzi@watonomous.ca',
26-
description='TODO: Package description',
27-
license='TODO: License declaration',
26+
description='Depth estimation module for humanoid robot perception',
27+
license='Apache2.0',
2828
tests_require=['pytest'],
2929
entry_points={
3030
'console_scripts': [

src/perception/depth_estimation/launch/depth_estimation.launch.py renamed to src/perception/perception_launch/launch/perception.launch.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,31 @@
2020

2121

2222
def generate_launch_description():
23-
# To load the yaml file, we are searching for its
24-
# path is the share directory. Check setup.py for how
25-
# the param file got there
26-
param_file_path = os.path.join(
23+
# Load depth estimation parameters
24+
depth_param_file_path = os.path.join(
2725
get_package_share_directory('depth_estimation'),
2826
'config',
2927
'params.yaml'
3028
)
29+
30+
# Load pose estimation parameters
31+
pose_param_file_path = os.path.join(
32+
get_package_share_directory('pose_estimation'),
33+
'config',
34+
'params.yaml'
35+
)
3136

3237
return LaunchDescription([
3338
Node(
3439
package='depth_estimation',
3540
name='depth_estimation_node',
3641
executable='depth_estimation_node',
37-
parameters=[param_file_path]
42+
parameters=[depth_param_file_path]
43+
),
44+
Node(
45+
package='pose_estimation',
46+
name='pose_estimation_node',
47+
executable='pose_estimation_node',
48+
parameters=[pose_param_file_path]
3849
)
3950
])
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0"?>
2+
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
3+
<package format="3">
4+
<name>perception_launch</name>
5+
<version>0.0.0</version>
6+
<description>Launch files for the perception module</description>
7+
<maintainer email="pconjeevaram@watonomous.ca">conjeevaram</maintainer>
8+
<license>Apache2.0</license>
9+
10+
<exec_depend>launch</exec_depend>
11+
<exec_depend>launch_ros</exec_depend>
12+
<exec_depend>depth_estimation</exec_depend>
13+
<exec_depend>pose_estimation</exec_depend>
14+
15+
<test_depend>ament_copyright</test_depend>
16+
<test_depend>ament_flake8</test_depend>
17+
<test_depend>ament_pep257</test_depend>
18+
19+
<export>
20+
<build_type>ament_python</build_type>
21+
</export>
22+
</package>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright 2023 WATonomous
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
perception_launch
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[develop]
2+
script_dir=$base/lib/perception_launch
3+
[install]
4+
install-scripts=$base/lib/perception_launch

0 commit comments

Comments
 (0)