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

Improving Conversion of Array-like Ros-Messages #1

Open
iml-dlux opened this issue Dec 11, 2018 · 3 comments
Open

Improving Conversion of Array-like Ros-Messages #1

iml-dlux opened this issue Dec 11, 2018 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@iml-dlux
Copy link

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.

@iml-dlux iml-dlux self-assigned this Dec 11, 2018
iml-dlux added a commit that referenced this issue Dec 11, 2018
@iml-dlux
Copy link
Author

Setting a Breakpoint on the added Lines in 332fe5a shows that the msgInstance is empty and the obj still contains content.

@iml-dlux
Copy link
Author

iml-dlux commented Jan 4, 2019

In commit e4093ce the Objects received from CB are parsed differently now. With the Object-Converter 'Type'-Information are saved on the CB, so that the parsing to a ROS-class can happen without prior knowledge about the actual ROS-class.

This parsing still needs to be tested..

( for linking)

@Luxxii Luxxii assigned Luxxii and unassigned iml-dlux Mar 6, 2019
@Luxxii Luxxii changed the title Error by Converting Array-like Ros-Messages Improving Conversion of Array-like Ros-Messages Jul 24, 2019
@Luxxii
Copy link

Luxxii commented Jul 24, 2019

In StackOverflow, the following (alternative) representation of arrays is shown:

Here the alternative representation:

"pressure": {
    "value": [720, 500],
    "type": "Integer"
}

Instead of using Integer, we should use standard json-DataTypes. In Addition to that, we should find more documentation about such a representation before Implementation.

@Luxxii Luxxii added the enhancement New feature or request label Sep 12, 2019
agonzat pushed a commit to agonzat/FIROS that referenced this issue Jun 23, 2023
closes iml130#1 . For iml130#3 tests have been added
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants