Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions autonomy/samples/python/aggregator/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<package format="3">
<name>aggregator</name>
<version>0.0.0</version>
<description>TODO: Package description</description>
<description>Sample aggregator node for data collection</description>
<maintainer email="[email protected]">eddyzhou</maintainer>
<license>Apache2.0: License declaration</license>
<license>Apache2.0</license>

<test_depend>ament_copyright</test_depend>
<test_depend>ament_flake8</test_depend>
Expand Down
12 changes: 9 additions & 3 deletions autonomy/samples/python/aggregator/setup.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import os
from glob import glob
from glob install_requires=['setuptools'],
zip_safe=True,
maintainer='eddyzhou, aryanafrouzi',
maintainer_email='[email protected], [email protected]',
description='Sample aggregator node for data collection',
license='Apache2.0',
tests_require=['pytest'], glob
from setuptools import setup

package_name = 'aggregator'

setup(

Check failure on line 13 in autonomy/samples/python/aggregator/setup.py

View workflow job for this annotation

GitHub Actions / Autopep8

autonomy/samples/python/aggregator/setup.py#L1-L13

+from setuptools import setup import os -from glob install_requires=['setuptools'], - zip_safe=True, - maintainer='eddyzhou, aryanafrouzi', - maintainer_email='[email protected], [email protected]', - description='Sample aggregator node for data collection', - license='Apache2.0', - tests_require=['pytest'], glob -from setuptools import setup +from glob install_requires = ['setuptools'], +zip_safe = True, +maintainer = 'eddyzhou, aryanafrouzi', +maintainer_email = '[email protected], [email protected]', +description = 'Sample aggregator node for data collection', +license = 'Apache2.0', +tests_require = ['pytest'], glob package_name = 'aggregator'
name=package_name,
version='0.0.0',
packages=[package_name],
Expand All @@ -21,8 +27,8 @@
zip_safe=True,
maintainer='eddyzhou, aryanafrouzi',
maintainer_email='[email protected], [email protected]',
description='TODO: Package description',
license='TODO: License declaration',
description='Sample aggregator node for data collection',
license='Apache2.0',
tests_require=['pytest'],
entry_points={
'console_scripts': [
Expand Down
4 changes: 2 additions & 2 deletions autonomy/samples/python/producer/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<package format="3">
<name>producer</name>
<version>0.0.0</version>
<description>TODO: Package description</description>
<description>Sample producer node for data generation</description>
<maintainer email="[email protected]">eddyzhou</maintainer>
<license>Apache2.0: License declaration</license>
<license>Apache2.0</license>

<test_depend>ament_copyright</test_depend>
<test_depend>ament_flake8</test_depend>
Expand Down
4 changes: 2 additions & 2 deletions autonomy/samples/python/producer/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
zip_safe=True,
maintainer='eddyzhou, aryanafrouzi',
maintainer_email='[email protected], [email protected]',
description='TODO: Package description',
license='TODO: License declaration',
description='Sample producer node for data generation',
license='Apache2.0',
tests_require=['pytest'],
entry_points={
'console_scripts': [
Expand Down
4 changes: 2 additions & 2 deletions autonomy/samples/python/transformer/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<package format="3">
<name>transformer</name>
<version>0.0.0</version>
<description>TODO: Package description</description>
<description>Sample transformer node for data processing</description>
<maintainer email="[email protected]">eddyzhou</maintainer>
<license>Apache2.0: License declaration</license>
<license>Apache2.0</license>

<test_depend>ament_copyright</test_depend>
<test_depend>ament_flake8</test_depend>
Expand Down
4 changes: 2 additions & 2 deletions autonomy/samples/python/transformer/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
zip_safe=True,
maintainer='eddyzhou, aryanafrouzi',
maintainer_email='[email protected], [email protected]',
description='TODO: Package description',
license='TODO: License declaration',
description='Sample transformer node for data processing',
license='Apache2.0',
tests_require=['pytest'],
entry_points={
'console_scripts': [
Expand Down
2 changes: 1 addition & 1 deletion autonomy/samples/sample_msgs/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<version>0.0.0</version>
<description>Sample ROS messages</description>

<maintainer email="[email protected]">watouser</maintainer>
<maintainer email="[email protected]">conjeevaram</maintainer>
<license>Apache2.0</license>

<buildtool_depend>ament_cmake</buildtool_depend>
Expand Down
2 changes: 1 addition & 1 deletion autonomy/wato_msgs/sample_msgs/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<version>0.0.0</version>
<description>Sample ROS messages</description>

<maintainer email="[email protected]">watouser</maintainer>
<maintainer email="[email protected]">conjeevaram</maintainer>
<license>Apache2.0</license>

<buildtool_depend>ament_cmake</buildtool_depend>
Expand Down
51 changes: 51 additions & 0 deletions docker/perception/perception.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
ARG BASE_IMAGE=ghcr.io/watonomous/robot_base/base:humble-ubuntu22.04

################################ Source ################################
FROM ${BASE_IMAGE} AS source

WORKDIR ${AMENT_WS}/src

# Copy in source code
COPY src/perception/depth_estimation depth_estimation
COPY src/perception/pose_estimation pose_estimation
COPY src/perception/perception_launch perception_launch
COPY src/wato_msgs/sample_msgs sample_msgs

# Scan for rosdeps
RUN apt-get -qq update && rosdep update && \
rosdep install --from-paths . --ignore-src -r -s \
| grep 'apt-get install' \
| awk '{print $3}' \
| sort > /tmp/colcon_install_list

################################# Dependencies ################################
FROM ${BASE_IMAGE} AS dependencies

# Install Rosdep requirements
COPY --from=source /tmp/colcon_install_list /tmp/colcon_install_list
RUN apt-fast install -qq -y --no-install-recommends $(cat /tmp/colcon_install_list)

# Copy in source code from source stage
WORKDIR ${AMENT_WS}
COPY --from=source ${AMENT_WS}/src src

# Dependency Cleanup
WORKDIR /
RUN apt-get -qq autoremove -y && apt-get -qq autoclean && apt-get -qq clean && \
rm -rf /root/* /root/.ros /tmp/* /var/lib/apt/lists/* /usr/share/doc/*

################################ Build ################################
FROM dependencies AS build

# Build ROS2 packages
WORKDIR ${AMENT_WS}
RUN . /opt/ros/$ROS_DISTRO/setup.sh && \
colcon build \
--cmake-args -DCMAKE_BUILD_TYPE=Release --install-base ${WATONOMOUS_INSTALL}

# Source and Build Artifact Cleanup
RUN rm -rf src/* build/* devel/* install/* log/*

# Entrypoint will run before any CMD on launch. Sources ~/opt/<ROS_DISTRO>/setup.bash and ~/ament_ws/install/setup.bash
COPY docker/wato_ros_entrypoint.sh ${AMENT_WS}/wato_ros_entrypoint.sh
ENTRYPOINT ["./wato_ros_entrypoint.sh"]
13 changes: 13 additions & 0 deletions modules/docker-compose.perception.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
services:
perception: # PYTHON
build: &perception_build
context: ..
dockerfile: docker/perception/perception.Dockerfile
cache_from:
- "${SAMPLES_PRODUCER_IMAGE:?}:${TAG}"
- "${SAMPLES_PRODUCER_IMAGE:?}:main"
image: "${SAMPLES_PRODUCER_IMAGE:?}:${TAG}"
profiles: [deploy]
command: /bin/bash -c "ros2 launch perception_launch perception.launch.py"
volumes:
- ${MONO_DIR}/src/perception:/root/ament_ws/src/perception
9 changes: 9 additions & 0 deletions src/perception/depth_estimation/config/params.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# more info on YAML configs for ROS2 Params:
# https://roboticsbackend.com/ros2-yaml-params/
depth_estimation_node:
ros__parameters:
pos_x: 1.0
pos_y: 1.0
pos_z: 1.0

velocity: 1.0
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Copyright 2023 WATonomous
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import math


class DepthEstimationCore():

def __init__(self, pos_x, pos_y, pos_z, vel):
# Init member variables for serialization
self.__pos_x = pos_x
self.__pos_y = pos_y
self.__pos_z = pos_z
self.__velocity = vel

def update_position(self):
# velocity in 3D delta_x = delta_y = delta_z
self.__pos_x += self.__velocity / math.sqrt(3)
self.__pos_y += self.__velocity / math.sqrt(3)
self.__pos_z += self.__velocity / math.sqrt(3)

def serialize_data(self):
return "x:" + str(self.__pos_x) + ";y:" + \
str(self.__pos_y) + ";z:" + str(self.__pos_z) + ";"



Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright 2023 WATonomous
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import time

import rclpy
from rclpy.node import Node

from sample_msgs.msg import Unfiltered
from depth_estimation.depth_estimation_core import DepthEstimationCore


class DepthEstimationNode(Node):

def __init__(self):
pass



def main(args=None):
rclpy.init(args=args)
return

if __name__ == '__main__':
main()
21 changes: 21 additions & 0 deletions src/perception/depth_estimation/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>depth_estimation</name>
<version>0.0.0</version>
<description>Depth estimation module for humanoid robot perception</description>
<maintainer email="[email protected]">eddyzhou</maintainer>
<license>Apache2.0</license>

<depend>rclpy</depend>
<depend>sample_msgs</depend>

<test_depend>ament_copyright</test_depend>
<test_depend>ament_flake8</test_depend>
<test_depend>ament_pep257</test_depend>
<test_depend>python3-pytest</test_depend>

<export>
<build_type>ament_python</build_type>
</export>
</package>
Empty file.
4 changes: 4 additions & 0 deletions src/perception/depth_estimation/setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[develop]
script_dir=$base/lib/depth_estimation
[install]
install-scripts=$base/lib/depth_estimation
34 changes: 34 additions & 0 deletions src/perception/depth_estimation/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import os
from glob import glob
from setuptools import setup

package_name = 'depth_estimation'

setup(
name=package_name,
version='0.0.0',
packages=[package_name],
data_files=[
# Install marker file in the package index
('share/ament_index/resource_index/packages', ['resource/' + package_name]),
# Include our package.xml file
(os.path.join('share', package_name), ['package.xml']),
# Include all launch files
(os.path.join('share', package_name, 'launch'),
glob(os.path.join('launch', '*.launch.py'))),
# Include config files for parameters
(os.path.join('share', package_name, 'config'), glob(os.path.join('config', '*.yaml'))),
],
install_requires=['setuptools'],
zip_safe=True,
maintainer='eddyzhou, aryanafrouzi',
maintainer_email='[email protected], [email protected]',
description='Depth estimation module for humanoid robot perception',
license='Apache2.0',
tests_require=['pytest'],
entry_points={
'console_scripts': [
'depth_estimation_node = depth_estimation.depth_estimation_node:main'
],
},
)
23 changes: 23 additions & 0 deletions src/perception/depth_estimation/test/test_copyright.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2015 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from ament_copyright.main import main
import pytest


@pytest.mark.copyright
@pytest.mark.linter
def test_copyright():
rc = main(argv=['.', 'test'])
assert rc == 0, 'Found errors'
25 changes: 25 additions & 0 deletions src/perception/depth_estimation/test/test_flake8.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2017 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from ament_flake8.main import main_with_errors
import pytest


@pytest.mark.flake8
@pytest.mark.linter
def test_flake8():
rc, errors = main_with_errors(argv=[])
assert rc == 0, \
'Found %d code style errors / warnings:\n' % len(errors) + \
'\n'.join(errors)
23 changes: 23 additions & 0 deletions src/perception/depth_estimation/test/test_pep257.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2015 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from ament_pep257.main import main
import pytest


@pytest.mark.linter
@pytest.mark.pep257
def test_pep257():
rc = main(argv=['.', 'test'])
assert rc == 0, 'Found code style errors / warnings'
Loading
Loading