Skip to content

Conversation

@m3d
Copy link
Member

@m3d m3d commented Aug 21, 2025

This is a simple (i.e. not perfect) tool for listing OSGAR module inputs and outputs:

(osgar) md@md-ThinkPad-P50:~/git/osgar-apps/dtc-systems$ python -m osgar.tools.get_module_io doctor:Doctor
doctor:Doctor (['audio', 'h265_video', 'report_latlon', 'scanning_person'], ['report'])

(osgar) md@md-ThinkPad-P50:~/git/osgar-apps/dtc-systems$ python -m osgar.tools.get_module_io osgar.drivers.lora:LoRa
osgar.drivers.lora:LoRa (['artf', 'cmd', 'pose2d', 'pose3d', 'radio', 'raw'], ['raw'])

@m3d m3d requested a review from tajgr August 21, 2025 09:23
Copy link
Collaborator

@tajgr tajgr left a comment

Choose a reason for hiding this comment

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

I miss there some better description of what the code do and how to use it.
Can you add some comments (documentation) in the code?

@m3d
Copy link
Member Author

m3d commented Aug 21, 2025

ACK, this was actually experiment (or PoC - Proof of Concept), that it is possible ... originally coded in osgar-apps, but it has sense for all OSGAR users. If you consider it valuable I will later extend it and add argparse there. The original motivation were some renames, which surely broke my configuration, so this was the first step towards automatic config check (or fill in in & out optional fields). Thanks m.

@tajgr
Copy link
Collaborator

tajgr commented Aug 22, 2025

Automatic config check sounds good.

@m3d
Copy link
Member Author

m3d commented Aug 22, 2025

well, it is not perfect ... tested:

(osgar) md@md-ThinkPad-P50:~/git/osgar$ python -m osgar.tools.get_module_io --name osgar.go:Go
Module: osgar.go:Go
Inputs: ['emergency_stop', 'pose2d']
Outputs: ['desired_speed']

but I had to add try-except in order to overcome required config parameters. As long as they are AFTER register it is probably OK.

OTOH sensor modules are probably expected to fail:

(osgar) md@md-ThinkPad-P50:~/git/osgar$ python -m osgar.tools.get_module_io --name osgar.drivers.oak_camera:OakCamera
Module: osgar.drivers.oak_camera:OakCamera
Inputs: []
Outputs: ['depth:gz']

hmm, there will be some bug, mmt

@m3d
Copy link
Member Author

m3d commented Aug 22, 2025

OK, now it looks better:

osgar) md@md-ThinkPad-P50:~/git/osgar$ python -m osgar.tools.get_module_io --name osgar.go:Go
Module: osgar.go:Go
Inputs: ['emergency_stop', 'pose2d']
Outputs: ['desired_speed', 'desired_steering']
(osgar) md@md-ThinkPad-P50:~/git/osgar$ python -m osgar.tools.get_module_io --name osgar.drivers.oak_camera:OakCamera
Module: osgar.drivers.oak_camera:OakCamera
Inputs: []
Outputs: ['depth:gz', 'color', 'orientation_list', 'detections', 'left_im', 'right_im', 'depth_seq', 'color_seq', 'detections_seq', 'left_im_seq', 'right_im_seq', 'nn_mask:gz']

@tajgr
Copy link
Collaborator

tajgr commented Aug 23, 2025

This i got for imu:

$ python -m osgar.tools.get_module_io --name osgar.drivers.imu:IMU
Module: osgar.drivers.imu:IMU
Inputs: []
Outputs: ['orientation', 'rotation', 'data']

The on_ call is missing there.
This is for realsense:Multicam:

$ python -m osgar.tools.get_module_io --name osgar.drivers.realsense:Multicam
Module: osgar.drivers.realsense:Multicam
Traceback (most recent call last):
  File "/home/jakub/miniconda3/envs/osgar/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/jakub/miniconda3/envs/osgar/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/jakub/git/osgar/osgar/tools/get_module_io.py", line 32, in <module>
    i,o = get_module_io(args.name)
  File "/home/jakub/git/osgar/osgar/tools/get_module_io.py", line 17, in get_module_io
    klass(bus=bus, config={})
  File "/home/jakub/git/osgar/osgar/drivers/realsense.py", line 241, in __init__
    for device in self.devices:
TypeError: 'NoneType' object is not iterable

some drivers are not well standardized..

Copy link
Collaborator

@tajgr tajgr left a comment

Choose a reason for hiding this comment

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

I think it would be valuable in the future.

@m3d m3d merged commit 183f5b3 into master Aug 24, 2025
4 checks passed
@m3d m3d deleted the feature/get-module-io branch August 24, 2025 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants