| @@ -0,0 +1,2 @@ | |||||
| *.pyc | |||||
| __pycache__ | |||||
| @@ -0,0 +1,17 @@ | |||||
| 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. | |||||
| @@ -0,0 +1,30 @@ | |||||
| from trajectory_msgs.msg import JointTrajectory, JointTrajectoryPoint | |||||
| from builtin_interfaces.msg import Duration | |||||
| import rclpy | |||||
| from rclpy.node import Node | |||||
| class JTCPublisher(Node): | |||||
| def __init__(self): | |||||
| super().__init__('jtc_publisher') | |||||
| self.publisher_ = self.create_publisher(JointTrajectory, "/e1_group_controller/joint_trajectory", 10) | |||||
| trajectory = JointTrajectory( | |||||
| joint_names = [ "c1_joint", "f1_joint", "t1_joint" ], | |||||
| points = [ | |||||
| JointTrajectoryPoint (time_from_start = Duration(nanosec = 500000000), positions = [0, -1, 0]), | |||||
| JointTrajectoryPoint (time_from_start = Duration(nanosec = 1000000000), positions = [-0.3, -1.3, 0]), | |||||
| JointTrajectoryPoint (time_from_start = Duration(nanosec = 1500000000), positions = [0, -1, 0.5]), | |||||
| JointTrajectoryPoint (time_from_start = Duration(nanosec = 2000000000), positions = [-0.3, -1.3, 0]), | |||||
| ] | |||||
| ) | |||||
| self.publisher_.publish(trajectory) | |||||
| def main(args = None): | |||||
| rclpy.init(args=args) | |||||
| jtc_publisher = JTCPublisher() | |||||
| rclpy.spin(jtc_publisher) | |||||
| jtc_publisher.destroy_node() | |||||
| rclpy.shutdown() | |||||
| @@ -0,0 +1,22 @@ | |||||
| <?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>hexapod_python</name> | |||||
| <version>0.0.0</version> | |||||
| <description>TODO: Package description</description> | |||||
| <maintainer email="marcus@grieger.xyz">wuselfuzz</maintainer> | |||||
| <license>MIT</license> | |||||
| <exec_depend>rclpy</exec_depend> | |||||
| <exec_depend>std_msgs</exec_depend> | |||||
| <exec_depend>trajectory_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> | |||||
| @@ -0,0 +1,4 @@ | |||||
| [develop] | |||||
| script_dir=$base/lib/hexapod_python | |||||
| [install] | |||||
| install_scripts=$base/lib/hexapod_python | |||||
| @@ -0,0 +1,26 @@ | |||||
| from setuptools import find_packages, setup | |||||
| package_name = 'hexapod_python' | |||||
| 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='wuselfuzz', | |||||
| maintainer_email='marcus@grieger.xyz', | |||||
| description='TODO: Package description', | |||||
| license='MIT', | |||||
| tests_require=['pytest'], | |||||
| entry_points={ | |||||
| 'console_scripts': [ | |||||
| 'jtc_test = hexapod_python.jtc_test:main' | |||||
| ], | |||||
| }, | |||||
| ) | |||||
| @@ -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' | |||||
| @@ -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) | |||||
| @@ -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' | |||||