cmu-rss-lab / roswire

A library for static and dynamic analysis of ROS applications via Docker 🔌
http://christimperley.co.uk/roswire
Apache License 2.0
8 stars 0 forks source link

Add complete support for ROS2 interface definition #420

Open ChrisTimperley opened 4 years ago

ChrisTimperley commented 4 years ago

The current message file parser doesn't recognise this, and so it crashes on any message fields that include optional default values. This feature appears to have been introduced in ROS2.

https://design.ros2.org/articles/legacy_interface_definition.html

An example of such a message file for rcl_interfaces/ParameterDescriptor:

# This is the message to communicate a parameter's descriptor.

string name

# Enum values are defined in the `ParameterType.msg` message.
uint8 type

# Description of the parameter, visible from introspection tools.
string description

# Parameter constraints

# Plain English description of additional constraints which cannot be expressed
# with the available constraints, e.g. "only prime numbers".
# By convention, this should only be used to clarify constraints which cannot
# be completely expressed with the parameter constraints below.
string additional_constraints

# If 'true' then the value cannot change after it has been initialized.
bool read_only false

# If any of the following sequences are not empty, then the constraint inside of
# them apply to this parameter.

# FloatingPointRange consists of a from_value, a to_value, and a step.
# FloatingPointRange and IntegerRange are mutually exclusive.
FloatingPointRange[<=1] floating_point_range

# IntegerRange consists of a from_value, a to_value, and a step.
# FloatingPointRange and IntegerRange are mutually exclusive.
IntegerRange[<=1] integer_range
schmerl commented 3 years ago

To get a start on this, I think we need to:

  1. [x] Refactor common/package.py to make Package an interface
  2. [x] Move the current implementation into ROS1Package
  3. [x] Hook them into ROS1Package
  4. [x] ActionFormat into interface and ROS1 / ROS2 instances.
  5. [x] SrvFormat into interface and ROS1 / ROS2 instances.
  6. [x] Split MsgFromat into interface and ROS1 / ROS2 instances.
  7. [ ] Hook this in
  8. [x] Create ROS2Package that uses the new formats
  9. [x] Hook this into the ROS2 specific stuff
schmerl commented 3 years ago

Look at: https://github.com/ros2/rosidl/blob/master/rosidl_adapter/rosidl_adapter/parser.py

schmerl commented 3 years ago

https://index.ros.org/doc/ros2/Concepts/About-ROS-Interfaces/

schmerl commented 3 years ago

394