Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Zollerboy1 committed Jan 10, 2025
0 parents commit d2629cc
Show file tree
Hide file tree
Showing 14 changed files with 231 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM ros:jazzy

RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y python3-pip

COPY devcontainer.env .
RUN $(cat devcontainer.env) && \
git clone "https://${GITHUB_USERNAME}:${GITHUB_TOKEN}@github.com/p2p-industries/hyveos_ros_msgs.git" /home/p2p-industries/src/hyveos_msgs
RUN $(cat devcontainer.env) && \
python3 -m pip install -U --break-system-packages "git+https://${GITHUB_USERNAME}:${GITHUB_TOKEN}@github.com/p2p-industries/hyveos.git#subdirectory=sdks/python"
RUN rm devcontainer.env

ENV SHELL=/bin/bash

WORKDIR /home/p2p-industries/src/hyveos

CMD ["/bin/bash"]
22 changes: 22 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "P2P Industries ROS 2 Development Container",
"build": {
"dockerfile": "Dockerfile"
},
"workspaceFolder": "/home/p2p-industries/src/hyveos",
"workspaceMount": "source=${localWorkspaceFolder},target=/home/p2p-industries/src/hyveos,type=bind",
"customizations": {
"vscode": {
"extensions": [
"ms-python.python",
"ms-iot.vscode-ros"
]
}
},
"containerEnv": {
"DISPLAY": "unix:0",
"ROS_AUTOMATIC_DISCOVERY_RANGE": "LOCALHOST",
"ROS_DOMAIN_ID": "42"
},
"postCreateCommand": "rosdep update && rosdep install --from-paths .. --ignore-src -y"
}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.vscode/
.zed/

.devcontainer/devcontainer.env
19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2025 P2P Industries Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# hyveos_ros

This repository contains the HyveOS ROS 2 bridge.
Empty file added hyveos/__init__.py
Empty file.
42 changes: 42 additions & 0 deletions hyveos/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import asyncio
import rclpy
from rclpy.node import Node

from hyveos_msgs.msg import Test as TestMsg
from hyveos_msgs.srv import Test as TestSrv

class Test(Node):
def __init__(self):
super().__init__('test')
self.publisher_ = self.create_publisher(TestMsg, 'test', 10)
self.service_ = self.create_service(TestSrv, 'test', self._service_callback)

async def _service_callback(self, request, response):
response.resp = f'Hello, {request.req}!'
return response

async def run(self):
while rclpy.ok():
msg = TestMsg()
msg.data = 'Hello, World!'
self.publisher_.publish(msg)
await asyncio.sleep(1)

async def ros_loop(node):
while rclpy.ok():
rclpy.spin_once(node, timeout_sec=0)
await asyncio.sleep(1e-4)

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

test = Test()

future = asyncio.gather(ros_loop(test), test.run())
asyncio.get_event_loop().run_until_complete(future)

test.destroy_node()
rclpy.shutdown()

if __name__ == '__main__':
main()
21 changes: 21 additions & 0 deletions 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>hyveos</name>
<version>0.1.0</version>
<description>The HyveOS ROS 2 bridge</description>
<maintainer email="josef@walterzollerpiano.com">Josef Zoller</maintainer>
<license>MIT</license>

<exec_depend>rclpy</exec_depend>
<exec_depend>hyveos_msgs</exec_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 added resource/hyveos
Empty file.
4 changes: 4 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[develop]
script_dir=$base/lib/hyveos
[install]
install_scripts=$base/lib/hyveos
26 changes: 26 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from setuptools import find_packages, setup

package_name = 'hyveos'

setup(
name=package_name,
version='0.0.0',
packages=find_packages(exclude=['test']),
data_files=[
('share/ament_index/resource_index/packages',
['resource/' + package_name]),
('share/' + package_name, ['package.xml']),
],
install_requires=['setuptools'],
zip_safe=True,
maintainer='Josef Zoller',
maintainer_email='josef@walterzollerpiano.com',
description='The HyveOS ROS 2 bridge',
license='MIT',
tests_require=['pytest'],
entry_points={
'console_scripts': [
'test = hyveos.test:main',
],
},
)
25 changes: 25 additions & 0 deletions test/test_copyright.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# 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


# Remove the `skip` decorator once the source file(s) have a copyright header
@pytest.mark.skip(reason='No copyright header has been placed in the generated source file.')
@pytest.mark.copyright
@pytest.mark.linter
def test_copyright():
rc = main(argv=['.', 'test'])
assert rc == 0, 'Found errors'
25 changes: 25 additions & 0 deletions 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 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'

0 comments on commit d2629cc

Please sign in to comment.