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

fixed load_dsdl problem #66

Merged
merged 1 commit into from
Aug 28, 2024
Merged

fixed load_dsdl problem #66

merged 1 commit into from
Aug 28, 2024

Conversation

FelixEL
Copy link

@FelixEL FelixEL commented Jul 21, 2024

load_dsdl overwrites dictionaries:

DATATYPES = {}
TYPENAMES = {}

this is described in: #65

this is very big problem when loading custom definitions of DSDL files. It loads files during initialization (works) but every consecutive execution of load_dsdl breaks previous link.

How to reproduce (minimal example):
Please note that "./external_dependencies/custom" contains uavcan definitions

import dronecan
from dronecan import uavcan

def main():
    node = dronecan.make_node(can_device_name="PCAN_USBBUS1",
                              node_id=127,
                              bitrate=125000)

    node_monitor = dronecan.app.node_monitor.NodeMonitor(node)

    node.add_handler(uavcan.protocol.NodeStatus, node_status_callback)
    allocator = dronecan.app.dynamic_node_id.CentralizedServer(
        node, node_monitor)

    while len(node_monitor.get_all_node_id()) < 1:
        print("waiting for nodes", node_monitor.get_all_node_id())
        node.spin(timeout=1)

    types = dronecan.load_dsdl(
        "./external_dependencies/custom")

    node.spin() 

Revert "fixed load_dsdl problem"

This reverts commit 3f63176.

fixed formatting
@FelixEL
Copy link
Author

FelixEL commented Jul 21, 2024

@tridge and @bugobliterator - It would be great if you could approve it and merge to master before next release to PyPI.
Before fix invocation of load_dsdl function was overwriting old subscribers without re-subscribing once again.

This is quite crucial bugfix as otherwise there is no way to add custom DSDL definitions using load_dsdl function.

@tridge tridge merged commit 7a1ef2f into dronecan:master Aug 28, 2024
@tridge
Copy link
Member

tridge commented Aug 28, 2024

sorry, needed to revert as it broke CI

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