Skip to content

[ros2interface] show "expanded" message definition - #524

Merged
audrow merged 10 commits into
masterfrom
audrow/show-expanded-interface-v2
Jun 5, 2020
Merged

audrow merged 10 commits into
masterfrom
audrow/show-expanded-interface-v2

Conversation

@audrow

@audrow audrow commented Jun 3, 2020

Copy link
Copy Markdown
Member

Fixes #348

@audrow audrow changed the title Audrow/show expanded interface v2 [ros2interface] show "expanded" message definition Jun 3, 2020
@audrow audrow added the enhancement New feature or request label Jun 3, 2020
@audrow

audrow commented Jun 3, 2020

Copy link
Copy Markdown
Member Author
  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@sloretz
sloretz self-requested a review June 3, 2020 20:46

@sloretz sloretz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Partial review.

While playing with it and the ROS 1 version, it seems like stripping comments and whitespace makes it a lot easier to read, which is what the ROS 1 version does.

Compare

$ ros2 interface show geometry_msgs/msg/TwistStamped
# A twist with reference coordinate frame and timestamp

std_msgs/Header header
	# Standard metadata for higher-level stamped data types.
	# This is generally used to communicate timestamped data
	# in a particular coordinate frame.

	# Two-integer timestamp that is expressed as seconds and nanoseconds.
	builtin_interfaces/Time stamp
		# Time indicates a specific point in time, relative to a clock's 0 point.

		# The seconds component, valid over all int32 values.
		int32 sec

		# The nanoseconds component, valid in the range [0, 10e9).
		uint32 nanosec

	# Transform frame with which this data is associated.
	string frame_id
Twist twist
	# This expresses velocity in free space broken into its linear and angular parts.

	Vector3  linear
		# This represents a vector in free space.

		# This is semantically different than a point.
		# A vector is always anchored at the origin.
		# When a transform is applied to a vector, only the rotational component is applied.

		float64 x
		float64 y
		float64 z
	Vector3  angular
		# This represents a vector in free space.

		# This is semantically different than a point.
		# A vector is always anchored at the origin.
		# When a transform is applied to a vector, only the rotational component is applied.

		float64 x
		float64 y
		float64 z

with (manually stripped)

$ ros2 interface show geometry_msgs/msg/TwistStamped
std_msgs/Header header
	builtin_interfaces/Time stamp
		int32 sec
		uint32 nanosec
	string frame_id
Twist twist
	Vector3  linear
		float64 x
		float64 y
		float64 z
	Vector3  angular
		float64 x
		float64 y
		float64 z

@sloretz

sloretz commented Jun 3, 2020

Copy link
Copy Markdown
Contributor

@audrow it looks like the DCO bot noticed some commits without sign offs. Clicking "Details" next to the failing check will show commands to fix it. Add the -s option when doing git commit to sign off future commits.

@audrow
audrow force-pushed the audrow/show-expanded-interface-v2 branch from 6ed1076 to e76dccb Compare June 3, 2020 22:48
@audrow

audrow commented Jun 3, 2020 •

Copy link
Copy Markdown
Member Author

@sloretz I added the sign offs; thanks for pointing that out

@audrow

audrow commented Jun 4, 2020

Copy link
Copy Markdown
Member Author

@sloretz I agree that it will be nice to remove whitespace and comments. I can extend the current version, or do this in another PR.

@audrow
audrow requested a review from sloretz June 4, 2020 19:16
@sloretz

sloretz commented Jun 4, 2020

Copy link
Copy Markdown
Contributor

I can extend the current version, or do this in another PR.

Another PR works for me. When you open it, I would recommend making the whitespace and comment removed version the default behavior since it feels a lot easier to understand the output.

@jacobperron since this repo has a foxy branch,is it ok to merge PRs onto master?

@sloretz sloretz left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with one nitpick, green CI, and confirmation from @jacobperron that it's ok to merge onto master.

Also, nice work with the recursive solution. It's a lot easier to understand.

@jacobperron

Copy link
Copy Markdown
Member

I've already created a foxy branch, so feel free to merge to master when you're ready.

@audrow

audrow commented Jun 5, 2020 •

Copy link
Copy Markdown
Member Author
  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@audrow
audrow marked this pull request as ready for review June 5, 2020 16:04
@audrow
audrow merged commit f7bebe0 into master Jun 5, 2020
@audrow
audrow deleted the audrow/show-expanded-interface-v2 branch June 5, 2020 17:23
craigh92 pushed a commit to craigh92/ros2cli that referenced this pull request Jun 11, 2020
* Expand interfaces with nesting in interface show

Signed-off-by: Audrow <[email protected]>

* Make show interface not print anything on empty lines

Signed-off-by: Audrow <[email protected]>

* Test nesting interface + update tests that used nested interfaces

Signed-off-by: Audrow <[email protected]>

* Minor refactoring

Signed-off-by: Audrow <[email protected]>

* Support arrays of expandable types

Signed-off-by: Audrow <[email protected]>

* Yield file lines and use stack to organize nesting

Signed-off-by: Audrow <[email protected]>

* Make member variable names and error text more consistent

Signed-off-by: Audrow <[email protected]>

* Use str function to make TextLineInterface usage clearer

Signed-off-by: Audrow <[email protected]>

* Simplify generator to get interface text lines

Signed-off-by: Audrow <[email protected]>

* Reformat to pass flake-8 tests

Signed-off-by: Audrow <[email protected]>
Signed-off-by: Craig <[email protected]>
craigh92 pushed a commit to craigh92/ros2cli that referenced this pull request Jun 11, 2020
* Expand interfaces with nesting in interface show

Signed-off-by: Audrow <[email protected]>

* Make show interface not print anything on empty lines

Signed-off-by: Audrow <[email protected]>

* Test nesting interface + update tests that used nested interfaces

Signed-off-by: Audrow <[email protected]>

* Minor refactoring

Signed-off-by: Audrow <[email protected]>

* Support arrays of expandable types

Signed-off-by: Audrow <[email protected]>

* Yield file lines and use stack to organize nesting

Signed-off-by: Audrow <[email protected]>

* Make member variable names and error text more consistent

Signed-off-by: Audrow <[email protected]>

* Use str function to make TextLineInterface usage clearer

Signed-off-by: Audrow <[email protected]>

* Simplify generator to get interface text lines

Signed-off-by: Audrow <[email protected]>

* Reformat to pass flake-8 tests

Signed-off-by: Audrow <[email protected]>
Signed-off-by: Craig <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ros2interface] does not show "expanded" message definition

3 participants