Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ros2controlcli] Fix the missing exported state interface printing #1800

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions ros2controlcli/ros2controlcli/verb/list_controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import warnings
from controller_manager import list_controllers, bcolors

from ros2cli.node.direct import add_arguments
Expand Down Expand Up @@ -50,10 +51,14 @@ def print_controller_state(c, args, col_width_name, col_width_state, col_width_t
for connection in c.chain_connections:
for reference in connection.reference_interfaces:
print(f"\t\t{reference:20s}")
if args.reference_interfaces or args.verbose:
if args.reference_interfaces or args.exported_interfaces or args.verbose:
print("\texported reference interfaces:")
for reference_interfaces in c.reference_interfaces:
print(f"\t\t{reference_interfaces}")
for reference_interface in c.reference_interfaces:
print(f"\t\t{reference_interface}")
if args.reference_interfaces or args.exported_interfaces or args.verbose:
print("\texported state interfaces:")
for exported_state_interface in c.exported_state_interfaces:
print(f"\t\t{exported_state_interface}")


class ListControllersVerb(VerbExtension):
Expand Down Expand Up @@ -86,6 +91,11 @@ def add_arguments(self, parser, cli_name):
action="store_true",
help="List controller's exported references",
)
parser.add_argument(
"--exported-interfaces",
action="store_true",
help="List controller's exported state and reference interfaces",
)
parser.add_argument(
"--verbose",
"-v",
Expand All @@ -98,6 +108,13 @@ def main(self, *, args):
with NodeStrategy(args).direct_node as node:
response = list_controllers(node, args.controller_manager)

if args.reference_interfaces:
warnings.filterwarnings("always")
warnings.warn(
"The '--reference-interfaces' argument is deprecated and will be removed in future releases. Use '--exported-interfaces' instead.",
DeprecationWarning,
)

if not response.controller:
print("No controllers are currently loaded!")
return 0
Expand Down
Loading