raptor-ethz / raptor

ROS 2 workspace for handling communication and control with a mavlink-quadrotor-system using PX4.
1 stars 0 forks source link

Define and Implement Convention for package.xml files #7

Closed pstrauch closed 1 year ago

pstrauch commented 1 year ago

Improve readability of package.xml files by defining and implementing a structure convention (similar to CMakeLists.txt) for all packages.

This means especially that the dependencies are well structured and commented, e.g. all build dependencies at one place, then all ros default dependencies and ros custom rependencies etc.

Best to use similar dependency titles as in CMake. Suggestions:

Please create a new branch for development and create a pull-request for this issue so it can be review before merging into main! Take a look here: Working with Github Issues in Visual Studio Code

Consider the convention of CMakeLists.txt:

cmake_minimum_required(VERSION 3.13)

project(my_project)

# DEPENDENCIES
# ros default
find_package(ament_cmake REQUIRED)
# ros custom
find_package(custom_ros_package REQUIRED)
# external
find_package(external_package REQUIRED)

# Compiler options
# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
  set(CMAKE_CXX_STANDARD 14)
endif()
# Compile flags
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic)
endif()

# TARGETS
# my_target
add_executable(my_target src/my_target.cpp)
ament_target_dependencies(my_target 
  ros_package)
target_link_libraries(my_target external_package)

# another_target
add_executable(another_target src/another_target.cpp)

# INSTALLATION
install(TARGETS
  my_target
  another_target
  DESTINATION lib/${PROJECT_NAME})

ament_package()
mbloechli commented 1 year ago

@pstrauch What do you think about it?

There is an existing xml convention for ROS https://ros.org/reps/rep-0149.html

Example with depends divided into "ros dependencies", "custom ros dependencies" and "external dependencies":

<?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>TODO: Package name</name>
   <version>TODO: Version number format as MAJOR.MINOR.PATCH, eg. "1.5.3"</version>
   <description>TODO: Package description</description>
   <maintainer email="raptor@ethz.ch">RAPTOR</maintainer>
   <license>http://www.apache.org/licenses/LICENSE-2.0</license>
   <license file="LICENSE">Apache 2.0</license>

   <url type="website">https://raptor.ethz.ch/</url>
   <url type="repository">TODO: Link to repository</url>
   <url type="bugtracker">TODO: Link to issues of repository</url>
   <author>RAPTOR</author>
   <author email="raptor@ethz.ch">RAPTOR</author>

   <!-- ros dependencies -->
   <build_depend> TODO </build_depend>
   <build_export_depend> TODO </build_export_depend>
   <buildtool_depend> TODO </buildtool_depend>
   <buildtool_export_depend> TODO </buildtool_export_depend>
   <exec_depend> TODO </exec_depend>
   <depend> TODO </depend>
   <doc_depend> TODO </doc_depend>
   <test_depend> TODO </test_depend>
   <conflict> TODO </conflict>
   <replace> TODO </replace>

   <!-- custom ros dependencies -->
   <build_depend> TODO </build_depend>
   <build_export_depend> TODO </build_export_depend>
   <buildtool_depend> TODO </buildtool_depend>
   <buildtool_export_depend> TODO </buildtool_export_depend>
   <exec_depend> TODO </exec_depend>
   <depend> TODO </depend>
   <doc_depend> TODO </doc_depend>
   <test_depend> TODO </test_depend>
   <conflict> TODO </conflict>
   <replace> TODO </replace>

   <!-- external dependencies -->
   <build_depend> TODO </build_depend>
   <build_export_depend> TODO </build_export_depend>
   <buildtool_depend> TODO </buildtool_depend>
   <buildtool_export_depend> TODO </buildtool_export_depend>
   <exec_depend> TODO </exec_depend>
   <depend> TODO </depend>
   <doc_depend> TODO </doc_depend>
   <test_depend> TODO </test_depend>
   <conflict> TODO </conflict>
   <replace> TODO </replace>
</package>

Next to the xml file there must be a text file called LICENSE containing the following text.

Copyright 2023 RAPTOR

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.
pstrauch commented 1 year ago

Looks good!

mbloechli commented 1 year ago

@pstrauch I adjusted the xml files to follow the official ROS convention and added a License file to each package. I assume Apache 2.0 License is ok? It's an open-source license, which I think makes the most sense at the moment.

Please check if the package descriptions are correct. I filled them in with what I understood, but you have the better overview, of what the packages actually do.

pstrauch commented 1 year ago

@mbloechli Great! Could you create a pull request so I can briefly review the changes here?

I think (for now) such an open-source license is ok, but we should definitely discuss which license to use with the team. Let's do this in a separate issue.

mbloechli commented 1 year ago

We'll take the GNUv3 licencse