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

Added spawner colours to list_controllers depending upon active or inactive (backport #1409) #1424

Merged
merged 2 commits into from
Mar 1, 2024
Merged
Changes from 1 commit
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
13 changes: 13 additions & 0 deletions ros2controlcli/ros2controlcli/verb/list_controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

from controller_manager import list_controllers
from controller_manager.spawner import bcolors

from ros2cli.node.direct import add_arguments
from ros2cli.node.strategy import NodeStrategy
Expand All @@ -22,7 +23,19 @@


def print_controller_state(c, args):
<<<<<<< HEAD
print(f'{c.name:20s}[{c.type:20s}] {c.state:10s}')
=======
state_color = ""
if c.state == "active":
state_color = bcolors.OKGREEN
elif c.state == "inactive":
state_color = bcolors.OKCYAN
elif c.state == "unconfigured":
state_color = bcolors.WARNING

print(f"{c.name:20s}[{c.type:20s}] {state_color}{c.state:10s}{bcolors.ENDC}")
>>>>>>> 0711cd6 (Added spawner colours to `list_controllers` depending upon active or inactive (#1409))
christophfroehlich marked this conversation as resolved.
Show resolved Hide resolved
if args.claimed_interfaces or args.verbose:
print('\tclaimed interfaces:')
for claimed_interface in c.claimed_interfaces:
Expand Down
Loading