diff --git a/.github/workflows/ros2-build.yml b/.github/workflows/ros2-build.yml new file mode 100644 index 00000000..0a88d813 --- /dev/null +++ b/.github/workflows/ros2-build.yml @@ -0,0 +1,17 @@ +name: ROS2 Colcon Build + +on: [push] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - uses: ros-tooling/setup-ros@0.0.25 + - uses: ros-tooling/action-ros-ci@0.0.18 + with: + package-name: spot_ros + target-ros2-distro: foxy + diff --git a/spot_description/CMakeLists.txt b/spot_description/CMakeLists.txt index a13ef4bd..8c1ed543 100644 --- a/spot_description/CMakeLists.txt +++ b/spot_description/CMakeLists.txt @@ -1,14 +1,13 @@ -cmake_minimum_required(VERSION 2.8.3) +cmake_minimum_required(VERSION 3.5) project(spot_description) -find_package(catkin REQUIRED COMPONENTS) +find_package(ament_cmake REQUIRED) -catkin_package() +install(DIRECTORY launch urdf meshes + DESTINATION share/${PROJECT_NAME}) -include_directories( - ${catkin_INCLUDE_DIRS} -) +install(DIRECTORY launch DESTINATION share/${PROJECT_NAME}) +install(DIRECTORY urdf DESTINATION share/${PROJECT_NAME}) +install(DIRECTORY meshes DESTINATION share/${PROJECT_NAME}) -install(DIRECTORY launch DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}) -install(DIRECTORY urdf DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}) -install(DIRECTORY meshes DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}) +ament_package() diff --git a/spot_description/launch/description.launch b/spot_description/launch/description.launch deleted file mode 100644 index 2e588d67..00000000 --- a/spot_description/launch/description.launch +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/spot_description/launch/description.launch.py b/spot_description/launch/description.launch.py new file mode 100644 index 00000000..a6d99b56 --- /dev/null +++ b/spot_description/launch/description.launch.py @@ -0,0 +1,22 @@ +import os + +import launch +import launch_ros.actions +from launch_ros.substitutions import FindPackageShare + +import xacro + +def generate_launch_description(): + pkg_share = FindPackageShare('spot_description').find('spot_description') + urdf_dir = os.path.join(pkg_share, 'urdf') + print(f'urdf_dir: {urdf_dir}') + xacro_file = os.path.join(urdf_dir, 'spot.urdf.xacro') + doc = xacro.process_file(xacro_file) + robot_desc = doc.toprettyxml(indent=' ') + params = {'robot_description': robot_desc} + rsp = launch_ros.actions.Node(package='robot_state_publisher', + executable='robot_state_publisher', + output='both', + parameters=[params]) + + return launch.LaunchDescription([rsp]) diff --git a/spot_description/package.xml b/spot_description/package.xml index ad2ca919..56960ee7 100644 --- a/spot_description/package.xml +++ b/spot_description/package.xml @@ -1,19 +1,23 @@ - + + spot_description - 0.0.0 + 2.0.0 The spot_description package Dave Niewinski BSD - catkin + ament_cmake robot_state_publisher urdf xacro + ament_cmake + diff --git a/spot_driver/CMakeLists.txt b/spot_driver/CMakeLists.txt deleted file mode 100644 index 9727c156..00000000 --- a/spot_driver/CMakeLists.txt +++ /dev/null @@ -1,23 +0,0 @@ -cmake_minimum_required(VERSION 2.8.3) -project(spot_driver) - -find_package(catkin REQUIRED COMPONENTS) - -catkin_package() - -include_directories( - ${catkin_INCLUDE_DIRS} -) - -catkin_install_python( - PROGRAMS - scripts/ros_helpers.py - scripts/spot_ros.py - scripts/spot_wrapper.py - scripts/__init__.py - DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} -) - -install(DIRECTORY launch DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}) -install(DIRECTORY doc DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}) -install(DIRECTORY config DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}) diff --git a/spot_driver/package.xml b/spot_driver/package.xml index 366ad831..d5841df6 100644 --- a/spot_driver/package.xml +++ b/spot_driver/package.xml @@ -1,22 +1,23 @@ - + + spot_driver - 0.0.0 + 2.0.0 The spot_driver package Dave Niewinski BSD - catkin + rclpy spot_msgs std_srvs tf2_msgs geometry_msgs sensor_msgs - rospy + ament_python diff --git a/spot_driver/resource/spot_driver b/spot_driver/resource/spot_driver new file mode 100644 index 00000000..e69de29b diff --git a/spot_driver/setup.py b/spot_driver/setup.py new file mode 100644 index 00000000..e43928a0 --- /dev/null +++ b/spot_driver/setup.py @@ -0,0 +1,36 @@ + +from setuptools import setup + +package_name = 'spot_driver' + +setup( + name=package_name, + version='2.0.0', + packages=[package_name], + data_files=[ + ('share/ament_index/resource_index/packages', + ['resource/' + package_name]), + ('share/' + package_name, ['package.xml']), + ], + install_requires=['setuptools'], + zip_safe=True, + author='Dave Niewinski', + author_email='dniewinski@clearpathrobotics.com', + maintainer='Austin Deric', + maintainer_email='Austin.Deric@gmail.com', + keywords=['ROS'], + classifiers=[ + 'Intended Audience :: Developers', + 'License :: OSI Approved :: BSD', + 'Programming Language :: Python', + 'Topic :: Software Development', + ], + description='The spot_driver package', + license='BSD', + tests_require=['pytest'], + entry_points={ + 'console_scripts': [ + 'driver = spot_driver.spot_ros.py:main', + ], + }, +) \ No newline at end of file diff --git a/spot_driver/scripts/__init__.py b/spot_driver/spot_driver/__init__.py similarity index 100% rename from spot_driver/scripts/__init__.py rename to spot_driver/spot_driver/__init__.py diff --git a/spot_driver/scripts/ros_helpers.py b/spot_driver/spot_driver/ros_helpers.py similarity index 100% rename from spot_driver/scripts/ros_helpers.py rename to spot_driver/spot_driver/ros_helpers.py diff --git a/spot_driver/scripts/spot_ros.py b/spot_driver/spot_driver/spot_ros.py similarity index 100% rename from spot_driver/scripts/spot_ros.py rename to spot_driver/spot_driver/spot_ros.py diff --git a/spot_driver/scripts/spot_wrapper.py b/spot_driver/spot_driver/spot_wrapper.py similarity index 100% rename from spot_driver/scripts/spot_wrapper.py rename to spot_driver/spot_driver/spot_wrapper.py diff --git a/spot_msgs/CMakeLists.txt b/spot_msgs/CMakeLists.txt index 21edb3c8..522daf6b 100644 --- a/spot_msgs/CMakeLists.txt +++ b/spot_msgs/CMakeLists.txt @@ -1,46 +1,36 @@ -cmake_minimum_required(VERSION 3.0.2) +cmake_minimum_required(VERSION 3.5) project(spot_msgs) -find_package(catkin REQUIRED COMPONENTS - geometry_msgs - nav_msgs - sensor_msgs - std_msgs - message_generation -) +find_package(ament_cmake REQUIRED) +find_package(builtin_interfaces REQUIRED) +find_package(nav_msgs REQUIRED) +find_package(geometry_msgs REQUIRED) +find_package(rosidl_default_generators REQUIRED) +find_package(std_msgs REQUIRED) +find_package(sensor_msgs REQUIRED) -add_message_files( - FILES - BatteryStateArray.msg - BehaviorFault.msg - EStopStateArray.msg - FootStateArray.msg - LeaseArray.msg - LeaseOwner.msg - Metrics.msg - SystemFault.msg - WiFiState.msg - BatteryState.msg - BehaviorFaultState.msg - EStopState.msg - Feedback.msg - FootState.msg - Lease.msg - LeaseResource.msg - PowerState.msg - SystemFaultState.msg +rosidl_generate_interfaces(${PROJECT_NAME} + "msg/BatteryStateArray.msg" + "msg/BehaviorFault.msg" + "msg/EStopStateArray.msg" + "msg/FootStateArray.msg" + "msg/LeaseArray.msg" + "msg/LeaseOwner.msg" + "msg/Metrics.msg" + "msg/SystemFault.msg" + "msg/WiFiState.msg" + "msg/BatteryState.msg" + "msg/BehaviorFaultState.msg" + "msg/EStopState.msg" + "msg/Feedback.msg" + "msg/FootState.msg" + "msg/Lease.msg" + "msg/LeaseResource.msg" + "msg/PowerState.msg" + "msg/SystemFaultState.msg" + DEPENDENCIES builtin_interfaces geometry_msgs std_msgs nav_msgs sensor_msgs ) -generate_messages( - DEPENDENCIES - std_msgs - geometry_msgs -) +ament_export_dependencies(rosidl_default_runtime) -catkin_package( - CATKIN_DEPENDS message_runtime -) - -include_directories( - ${catkin_INCLUDE_DIRS} -) +ament_package() diff --git a/spot_msgs/msg/BatteryState.msg b/spot_msgs/msg/BatteryState.msg index 9437500b..3da6a552 100644 --- a/spot_msgs/msg/BatteryState.msg +++ b/spot_msgs/msg/BatteryState.msg @@ -5,10 +5,10 @@ uint8 STATUS_CHARGING = 2 uint8 STATUS_DISCHARGING = 3 uint8 STATUS_BOOTING = 4 -Header header +std_msgs/Header header string identifier float64 charge_percentage -duration estimated_runtime +builtin_interfaces/Duration estimated_runtime float64 current float64 voltage float64[] temperatures diff --git a/spot_msgs/msg/BehaviorFault.msg b/spot_msgs/msg/BehaviorFault.msg index 0c209af1..6aa247bc 100644 --- a/spot_msgs/msg/BehaviorFault.msg +++ b/spot_msgs/msg/BehaviorFault.msg @@ -8,7 +8,7 @@ uint8 STATUS_UNKNOWN = 0 uint8 STATUS_CLEARABLE = 1 uint8 STATUS_UNCLEARABLE = 2 -Header header +std_msgs/Header header uint32 behavior_fault_id uint8 cause uint8 status diff --git a/spot_msgs/msg/EStopState.msg b/spot_msgs/msg/EStopState.msg index 3e527d0b..3de884b8 100644 --- a/spot_msgs/msg/EStopState.msg +++ b/spot_msgs/msg/EStopState.msg @@ -8,7 +8,7 @@ uint8 STATE_UNKNOWN = 0 uint8 STATE_ESTOPPED = 1 uint8 STATE_NOT_ESTOPPED = 2 -Header header +std_msgs/Header header string name uint8 type uint8 state diff --git a/spot_msgs/msg/Metrics.msg b/spot_msgs/msg/Metrics.msg index b699a09f..436d7da7 100644 --- a/spot_msgs/msg/Metrics.msg +++ b/spot_msgs/msg/Metrics.msg @@ -1,5 +1,5 @@ -Header header +std_msgs/Header header float32 distance int32 gait_cycles -duration time_moving -duration electric_power +builtin_interfaces/Duration time_moving +builtin_interfaces/Duration electric_power diff --git a/spot_msgs/msg/PowerState.msg b/spot_msgs/msg/PowerState.msg index 2f7285df..10040dfc 100644 --- a/spot_msgs/msg/PowerState.msg +++ b/spot_msgs/msg/PowerState.msg @@ -11,8 +11,8 @@ uint8 STATE_UNKNOWN_SHORE_POWER = 0 uint8 STATE_ON_SHORE_POWER = 1 uint8 STATE_OFF_SHORE_POWER = 2 -Header header +std_msgs/Header header uint8 motor_power_state uint8 shore_power_state float64 locomotion_charge_percentage -duration locomotion_estimated_runtime +builtin_interfaces/Duration locomotion_estimated_runtime diff --git a/spot_msgs/msg/SystemFault.msg b/spot_msgs/msg/SystemFault.msg index 25411024..a40fa9f2 100644 --- a/spot_msgs/msg/SystemFault.msg +++ b/spot_msgs/msg/SystemFault.msg @@ -4,9 +4,9 @@ uint8 SEVERITY_INFO = 1 uint8 SEVERITY_WARN = 2 uint8 SEVERITY_CRITICAL = 3 -Header header +std_msgs/Header header string name -duration duration +builtin_interfaces/Duration duration int32 code uint64 uid string error_message diff --git a/spot_msgs/package.xml b/spot_msgs/package.xml index b210d733..008878e2 100644 --- a/spot_msgs/package.xml +++ b/spot_msgs/package.xml @@ -1,25 +1,27 @@ - + + spot_msgs - 0.0.0 + 2.0.0 The spot_msgs package Dave Niewinski BSD - catkin - geometry_msgs - nav_msgs - sensor_msgs - std_msgs - geometry_msgs - nav_msgs - sensor_msgs - std_msgs + ament_cmake - message_generation - message_runtime + rclcpp + std_msgs + builtin_interfaces + rosidl_default_generators + geometry_msgs + nav_msgs + sensor_msgs + + rosidl_interface_packages + ament_cmake diff --git a/spot_ros/CHANGELOG.rst b/spot_ros/CHANGELOG.rst new file mode 100644 index 00000000..e69de29b diff --git a/spot_ros/CMakeLists.txt b/spot_ros/CMakeLists.txt new file mode 100644 index 00000000..b42b2a9b --- /dev/null +++ b/spot_ros/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.5) +project(spot_ros) + +if(NOT CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 14) +endif() + +find_package(ament_cmake REQUIRED) + +ament_package() \ No newline at end of file diff --git a/spot_ros/package.xml b/spot_ros/package.xml new file mode 100644 index 00000000..79afe3d0 --- /dev/null +++ b/spot_ros/package.xml @@ -0,0 +1,24 @@ + + + + spot_ros + 2.0.0 + + Spot ROS Driver + + Austin Deric + Dave Niewinski + Apache-2.0 + + ament_cmake + + spot_description + spot_driver + spot_msgs + spot_viz + + + ament_cmake + + + \ No newline at end of file diff --git a/spot_viz/CMakeLists.txt b/spot_viz/CMakeLists.txt index 717a21c4..e55e2c24 100644 --- a/spot_viz/CMakeLists.txt +++ b/spot_viz/CMakeLists.txt @@ -1,13 +1,9 @@ -cmake_minimum_required(VERSION 2.8.3) +cmake_minimum_required(VERSION 3.5) project(spot_viz) -find_package(catkin REQUIRED COMPONENTS) +find_package(ament_cmake REQUIRED) -catkin_package() +install(DIRECTORY launch DESTINATION share/${PROJECT_NAME}) +install(DIRECTORY rviz DESTINATION share/${PROJECT_NAME}) -include_directories( - ${catkin_INCLUDE_DIRS} -) - -install(DIRECTORY rviz DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}) -install(DIRECTORY launch DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}) +ament_package() \ No newline at end of file diff --git a/spot_viz/launch/view_model.launch b/spot_viz/launch/view_model.launch deleted file mode 100644 index 9488a254..00000000 --- a/spot_viz/launch/view_model.launch +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/spot_viz/launch/view_model.launch.py b/spot_viz/launch/view_model.launch.py new file mode 100644 index 00000000..c2399f5c --- /dev/null +++ b/spot_viz/launch/view_model.launch.py @@ -0,0 +1,37 @@ +from launch import LaunchDescription +from ament_index_python.packages import get_package_share_directory +from launch_ros.actions import Node +from launch.actions import IncludeLaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource + +import os + +def generate_launch_description(): + bringup_dir = get_package_share_directory('spot_viz') + return LaunchDescription([ + Node( + package='joint_state_publisher_gui', + namespace='joint_state_publisher_gui', + executable='joint_state_publisher_gui', + name='joint_state_publisher_gui', + remappings=[ + ('/joint_state_publisher_gui/joint_states', '/joint_states'), + ('/joint_state_publisher_gui/robot_description', '/robot_description'), + ('/joint_state_publisher_gui/parameter_events', '/parameter_events') + ] + ), + IncludeLaunchDescription( + PythonLaunchDescriptionSource( + os.path.join(get_package_share_directory('spot_description'), + 'launch', + 'description.launch.py') + ) + ), + Node( + package='rviz2', + namespace='rviz2', + executable='rviz2', + name='rviz2', + arguments=['-d', os.path.join(bringup_dir,'rviz', 'robot.rviz"')], + ) + ]) diff --git a/spot_viz/launch/view_robot.launch b/spot_viz/launch/view_robot.launch deleted file mode 100644 index d9facb1e..00000000 --- a/spot_viz/launch/view_robot.launch +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/spot_viz/package.xml b/spot_viz/package.xml index 1f077199..fa4785ed 100644 --- a/spot_viz/package.xml +++ b/spot_viz/package.xml @@ -1,19 +1,23 @@ - + + spot_viz - 0.0.0 + 2.0.0 The spot_viz package Dave Niewinski BSD - catkin + ament_cmake joint_state_publisher joint_state_publisher_gui rviz + ament_cmake +