boschresearch / fmi_adapter

Integrating functional mock-up units (FMUs) in ROS nodes
Apache License 2.0
46 stars 14 forks source link

Using custom ROS messages #8

Open sandeepparameshwara opened 3 years ago

sandeepparameshwara commented 3 years ago

Hello Mr.Lange,

I would like to know if there is a python wrapper available for the C++ FMIAdapter class. I want to publish to inputs of the FMU and subscribe to FMU outputs through my python code. If I understand correctly, the FMIAdapter class creates individual subscribers and publishers from vectorized signals of FMU. If I use the FMIAdapter class, I can only create individual subscribers and publishers right? So, when you say that "It allows to map the inputs and outputs of an FMU to complex message types and gives more control on the execution" in #4 , do you mean, that I can provide timestamps to the inputs through the setInputValue method? If there are a large number of inputs and outputs, that many subscribers and publishers are unavoidable right? In LibraryUsage step 3, can the subscriber read data from other message types instead of Float64? (By other message types, I mean, a custom message consisting of timestamp and multiple Float64 data fields). I basically want to group the data and publish, subscribe to them synchronously at the same time. By using the FMI adapter node, I have to do it one by one without any control over their timestamps.

Sorry for the inconvenience, I am a beginner in ROS and have little knowledge of C++. I would really appreciate it if you can give hints about these things.

Thank you Sandeep

ralph-lange commented 3 years ago

Hi Sandeep, just call me Ralph, please. Thank you for your interest in the fmi_adapter and your questions.

If I use the FMIAdapter class, I can only create individual subscribers and publishers right? So, when you say that "It allows to map the inputs and outputs of an FMU to complex message types and gives more control on the execution" in #4 , do you mean, that I can provide timestamps to the inputs through the setInputValue method? If there are a large number of inputs and outputs, that many subscribers and publishers are unavoidable right?

No, that’s avoidable. In the callback that triggers a computation (i.e. adapter->doSteps…) you can set as many input values as you want and read as many output values as you want. And, you can aggregate the output values in a complex message type. For example, you could read seven outputs and store and publish them in one ROS Pose message (point + quaternion) or the custom message type that you’ve mentioned. Whether this callback is triggered periodically by a timer (as exemplified in the README) or by a subscription is up to the developer.

Does this answer all your questions? Let me know if you require further information.

Best regards, Ralph

ralph-lange commented 1 year ago

Does this answer all your questions? Let me know if you require further information.

Can I close this issue?