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

Using custom ROS messages #8

Open
sandeepparameshwara opened this issue Jul 8, 2021 · 2 comments
Open

Using custom ROS messages #8

sandeepparameshwara opened this issue Jul 8, 2021 · 2 comments

Comments

@sandeepparameshwara
Copy link

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
Copy link
Collaborator

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
Copy link
Collaborator

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

Can I close this issue?

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

No branches or pull requests

2 participants