Skip to content
This repository was archived by the owner on Jan 8, 2024. It is now read-only.
This repository was archived by the owner on Jan 8, 2024. It is now read-only.

Improving Conversion of Array-like Ros-Messages  #1

Description

@iml-dlux

Firos currently cannot convert an object into the correct Ros-Message, which look like:

Header header

unit8[] x
float64[] y
MyVeryOwnMsg[] mvom

It looks like the implementation is missing for such cases in:

def obj2Ros(obj, msgInstance):
## \brief Map a dict to Ros Object
# \param dictionary
# \param Ros Object instance
if hasattr(msgInstance, '__slots__'):
for key in msgInstance.__slots__:
if hasattr(obj, key):
setattr(msgInstance, key, obj2Ros(getattr(obj, key), getattr(msgInstance, key)))
elif type(obj) is dict and key in obj:
setattr(msgInstance, key, obj2Ros(obj[key], getattr(msgInstance, key)))
# TODO DL Remove?
# if key in obj:
# setattr(msgInstance, key, obj2Ros(obj[key], getattr(msgInstance, key)))
else:
if type(obj) is dict:
raise Exception("Not a primitive")
msgInstance = obj
return msgInstance

Also the 'Definition file class' which is loaded on line

msg = instance["class"]()

might be errorneos in this case

Debugging to the Point, where the data of msg is replaced by the actual values (obj2Ros) shows, that the actual msg on that point is a empty list, but the obj still contains information.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions