Skip to content

Commit 3ac8c31

Browse files
authored
Merge pull request #4 from WATonomous/tahseen-package-refactor
Tahseen package refactor
2 parents 9b6f954 + 24859c9 commit 3ac8c31

File tree

13 files changed

+54
-109
lines changed

13 files changed

+54
-109
lines changed

docker/perception/perception.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ FROM ${BASE_IMAGE} AS source
66
WORKDIR ${AMENT_WS}/src
77

88
# Copy in source code
9-
COPY src/perception/depth_estimation depth_estimation
9+
COPY src/perception/depth_estimation depth_estimation
1010
COPY src/wato_msgs/sample_msgs sample_msgs
1111

1212
# Scan for rosdeps

modules/docker-compose.perception.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ services:
88
- "${SAMPLES_PRODUCER_IMAGE:?}:main"
99
image: "${SAMPLES_PRODUCER_IMAGE:?}:${TAG}"
1010
profiles: [deploy]
11-
command: /bin/bash -c "ros2 launch perception perception.launch.py"
11+
command: /bin/bash -c "ros2 launch depth_estimation depth_estimation.launch.py"
1212
volumes:
1313
- ${MONO_DIR}/src/samples/python/perception:/root/ament_ws/src/perception

src/perception/depth_estimation/config/params.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# more info on YAML configs for ROS2 Params:
22
# https://roboticsbackend.com/ros2-yaml-params/
3-
producer_node:
3+
depth_estimation_node:
44
ros__parameters:
55
pos_x: 1.0
66
pos_y: 1.0

src/perception/depth_estimation/producer/__init__.py renamed to src/perception/depth_estimation/depth_estimation/__init__.py

File renamed without changes.

src/perception/depth_estimation/producer/producer_core.py renamed to src/perception/depth_estimation/depth_estimation/depth_estimation_core.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,9 @@
1515
import math
1616

1717

18-
class ProducerCore():
18+
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
2621

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)
3222

33-
def serialize_data(self):
34-
return "x:" + str(self.__pos_x) + ";y:" + \
35-
str(self.__pos_y) + ";z:" + str(self.__pos_z) + ";"
23+
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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.
14+
15+
import time
16+
17+
import rclpy
18+
from rclpy.node import Node
19+
20+
from sample_msgs.msg import Unfiltered
21+
from depth_estimation.depth_estimation_core import DepthEstimationCore
22+
23+
24+
class DepthEstimationNode(Node):
25+
26+
def __init__(self):
27+
pass
28+
29+
30+
31+
def main(args=None):
32+
rclpy.init(args=args)
33+
return
34+
35+
if __name__ == '__main__':
36+
main()

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@ def generate_launch_description():
2424
# path is the share directory. Check setup.py for how
2525
# the param file got there
2626
param_file_path = os.path.join(
27-
get_package_share_directory('producer'),
27+
get_package_share_directory('depth_estimation'),
2828
'config',
2929
'params.yaml'
3030
)
3131

3232
return LaunchDescription([
3333
Node(
34-
package='producer',
35-
name='producer_node',
36-
executable='producer_node',
34+
package='depth_estimation',
35+
name='depth_estimation_node',
36+
executable='depth_estimation_node',
3737
parameters=[param_file_path]
3838
)
3939
])

src/perception/depth_estimation/package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0"?>
22
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
33
<package format="3">
4-
<name>producer</name>
4+
<name>depth_estimation</name>
55
<version>0.0.0</version>
66
<description>TODO: Package description</description>
77
<maintainer email="e23zhou@watonomous.ca">eddyzhou</maintainer>

src/perception/depth_estimation/producer/producer_node.py

Lines changed: 0 additions & 79 deletions
This file was deleted.
File renamed without changes.

0 commit comments

Comments
 (0)