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

Add rawValuesPublisherInterface and related nws and nwc to stream and save raw values #983

Merged
merged 3 commits into from
Oct 28, 2024

Conversation

MSECode
Copy link
Contributor

@MSECode MSECode commented Sep 18, 2024

This PR add the interface rawValuesPublisher and related network wrappers (client and server) to get the raw values and their metadata from the fw level (boards) and stream them to yarp ports so that they can be read on the port and be read by the telemetryDeviceDumper plugin so that a user can save them to a MATLAB file.
In this updates we have also modified iCubDev CMakeLists.txt to compile and installed the thrift generated files related to the new interface. (As already discussed with @Nicogene we need to revise these updates).
I've also add to the tools a module used initially for testing the whole pipeline without using the telemetryDeviceDumper.
This PR is, in fact, related to robotology/robometry#190
and as for that is still under review since it brings lots of changes and it's better to discuss some of the choices, such as the interface and its methods, to check if they have been designed as desired.

cc: @valegagge @Nicogene @traversaro

@MSECode MSECode marked this pull request as draft September 18, 2024 16:17
@MSECode MSECode self-assigned this Sep 18, 2024
@pattacini pattacini self-requested a review September 19, 2024 05:39
@traversaro
Copy link
Member

I am a bit afraid of depending on YARP 3.10 functionality until that is actually released, as this will prevent us to be able to release icub-main until YARP 3.10 is released. Do we have any specific plan to deal with this?

@valegagge
Copy link
Member

I am a bit afraid of depending on YARP 3.10 functionality until that is actually released, as this will prevent us to be able to release icub-main until YARP 3.10 is released. Do we have any specific plan to deal with this?

ugh no! When we discussed this activity this issue was not pointed out. 😢
Now, I'm going to find a solution to this. Any suggestions are welcome. 😸

@traversaro
Copy link
Member

ugh no! When we discussed this activity this issue was not pointed out. 😢

How did you tested the code? The master branch of superbuild and the conda package use YARP 3.9, so I guess you had to manually change something to be able to use the master branch of YARP (unless you were cloning and. compiling all the dependencies manually).

@traversaro
Copy link
Member

Now, I'm going to find a solution to this. Any suggestions are welcome. 😸

Depending on the timeline for this we can try to understand with Randaz if there is an expected release date of YARP 3.10.

@MSECode
Copy link
Contributor Author

MSECode commented Sep 20, 2024

ugh no! When we discussed this activity this issue was not pointed out. 😢

How did you tested the code? The master branch of superbuild and the conda package use YARP 3.9, so I guess you had to manually change something to be able to use the master branch of YARP (unless you were cloning and. compiling all the dependencies manually).

More or less you're right. Basically I've compiled the superbuild as unstable and then I've enabled the DEVEL mode for icub-main and YARP. And I was based on a stable branch on the master branch thus to use the paramParserGenerator.

@MSECode
Copy link
Contributor Author

MSECode commented Sep 23, 2024

Now, I'm going to find a solution to this. Any suggestions are welcome. 😸

Depending on the timeline for this we can try to understand with Randaz if there is an expected release date of YARP 3.10.

I've updated the code so that we can locally use the paramParserGenerator on the nws and nwc and then, once we have the generated files and pushed them on the repo, we can disable that plugin so that we can temporarily let icub-main being not dependent by yarp 3.10

@valegagge
Copy link
Member

valegagge commented Sep 27, 2024

Hi @MSECode ,
I added the comment with some suggestions. please check it.

I still need to check embObjMotioncontrol

@MSECode MSECode force-pushed the feature/rawValuesInterface branch 4 times, most recently from f45ae6f to a79fa4e Compare October 1, 2024 14:13
@MSECode MSECode force-pushed the feature/rawValuesInterface branch from 4aa8774 to f4f6953 Compare October 2, 2024 14:31
Copy link
Member

@valegagge valegagge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @MSECode , well done! you completed a very complex activity! 🚀

I request some changes that I can summarize in the following point:

  1. move in cpp all the includes that are not necessary in .h file in to avoid unuseful dependency.
  2. in EmbObJMotionControl add the function getBoardInfo() in the log prints in order to have an accurate log.
  3. REmove all debug code or put under a macro compilation if you think you still need in some cases.
  4. Verify if the client gets an error if it doesn't receive data for a configurable timeout.

thanks heap!

@MSECode MSECode force-pushed the feature/rawValuesInterface branch from 2acd90b to a8f5d19 Compare October 4, 2024 15:56
@valegagge
Copy link
Member

valegagge commented Oct 4, 2024

Hi @MSECode,
I think now all is ok except for:

  • a small improvement in embObjMotionControl.I suggest implementing the getRawDataMAp link in the FakeDevice relying on the getRawData_core function.
  • moving the header files from the .h to the implementation file of the client.
  • in the git stash you performed, you left a very huge commit message
    thanks

This feature allows to publisher raw data coming from the sensor boards
to yarp ports, so that they can be then collected by the TelemetryDeviceDumper
and added to a MATLAB file.
Together with the Interface we have the network wrappers server and client
and the fake device that can be used for testing of new raw data
Interface has been made exploiting thrift and wrappers use the paramparsergenerator
Regarding this for now the genrated files are pushed and their re-generation is disabled waiting for yarp 3.10
@MSECode MSECode force-pushed the feature/rawValuesInterface branch from a8f5d19 to 54a0125 Compare October 7, 2024 12:58
@MSECode
Copy link
Contributor Author

MSECode commented Oct 7, 2024

Hi @MSECode , well done! you completed a very complex activity! 🚀

I request some changes that I can summarize in the following point:

  1. move in cpp all the includes that are not necessary in .h file in to avoid unuseful dependency.
  2. in EmbObJMotionControl add the function getBoardInfo() in the log prints in order to have an accurate log.
  3. REmove all debug code or put under a macro compilation if you think you still need in some cases.
  4. Verify if the client gets an error if it doesn't receive data for a configurable timeout.

thanks heap!

Fixed all. I think now we can move the PR to ready. I'll double check everything but I suppose we are ok

@MSECode MSECode marked this pull request as ready for review October 8, 2024 13:51
@MSECode MSECode requested a review from valegagge October 9, 2024 09:07
@pattacini
Copy link
Member

pattacini commented Oct 9, 2024

Thanks for your contribution @MSECode 👍🏻
I'll do a shallow review in the next couple of days. I'll try to be quick.

Copy link
Member

@Nicogene Nicogene left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few prelimar comments, I will give a second look soon

"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/iCub>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/iCub>")
target_link_libraries(${PROJECT_NAME} YARP::YARP_os
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's see if @traversaro has a better solution for this one we found

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the problem is that the thrift classes do not have any namespace (that is true also for generated public classes that are just defined in the global namespace). Since robotology/yarp#2028, the include should be placed in include/<namespace>, so if we use the iCub namespace in thrift files we should be good to go and there will be no need to specifiy additional include directories as done here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's allowed by the automation, I'd like to segregate generated files in dedicated directories.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, in that case you just need to have two directories passed as BUILD_INTERFACE interface, and only one install (I am not a big fan of using thrift-generated files in public interfaces due to this), something like:

target_include_directories(${PROJECT_NAME} PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
                                                  "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/autogenerated/include>"
                                                  "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per discussion w/ @valegagge and @Nicogene I'm gonna fix the CMakeLists.txt as proposed by @traversaro. Thus also the generated files should not be together with the hand-coded ones.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks heaps!

Copy link
Contributor Author

@MSECode MSECode Oct 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one thing.
I tried to compile everything but without this line:
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/autogenerated>" in src/libraries/iCubDev/CMakeLists.txt
robometry compilation keeps failing with errors in finding the include:

[ 88%] Building CXX object src/telemetryDeviceDumper/CMakeFiles/yarp_telemetryDeviceDumper.dir/TelemetryDeviceDumper.cpp.o
In file included from /home/iiticublap258/Workspace/robometry/src/telemetryDeviceDumper/TelemetryDeviceDumper.h:22,
                 from /home/iiticublap258/Workspace/robometry/build/src/telemetryDeviceDumper/yarp_plugin_telemetryDeviceDumper.cpp:10:
/home/iiticublap258/Workspace/robotology-superbuild/build/install/include/iCub/IRawValuesPublisher.h:9:10: fatal error: iCub/rawValuesDataVectorsMap.h: No such file or directory
    9 | #include <iCub/rawValuesDataVectorsMap.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
[ 96%] Built target CB_to_matfile_example
make[2]: *** [src/telemetryDeviceDumper/CMakeFiles/yarp_telemetryDeviceDumper.dir/build.make:76: src/telemetryDeviceDumper/CMakeFiles/yarp_telemetryDeviceDumper.dir/yarp_plugin_telemetryDeviceDumper.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
In file included from /home/iiticublap258/Workspace/robometry/src/telemetryDeviceDumper/TelemetryDeviceDumper.h:22,
                 from /home/iiticublap258/Workspace/robometry/src/telemetryDeviceDumper/TelemetryDeviceDumper.cpp:8:
/home/iiticublap258/Workspace/robotology-superbuild/build/install/include/iCub/IRawValuesPublisher.h:9:10: fatal error: iCub/rawValuesDataVectorsMap.h: No such file or directory
    9 | #include <iCub/rawValuesDataVectorsMap.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [src/telemetryDeviceDumper/CMakeFiles/yarp_telemetryDeviceDumper.dir/build.make:90: src/telemetryDeviceDumper/CMakeFiles/yarp_telemetryDeviceDumper.dir/TelemetryDeviceDumper.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:236: src/telemetryDeviceDumper/CMakeFiles/yarp_telemetryDeviceDumper.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

src/libraries/iCubDev/include/iCub/IRawValuesPublisher.h Outdated Show resolved Hide resolved
@@ -170,7 +171,7 @@ eObool_t feat_manage_motioncontrol_addinfo_multienc(eOipv4addr_t ipv4, eOprotID3
{
multienc->update(id32, yarp::os::Time::now(), rxdata);
}

*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of commenting out, isn't better to remove it? There is a plan for re-enabling it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there might be a plan to re-enabling it, even though it is probably gonna be removed soon as part of this: #929
But there might be a moment in which we need to re-enable it before removing. I'm not 100% sure about that.
@valegagge, do u have a more clear idea about this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MSECode you are right. My idea is to leave the code in a comment and remove it when we remove the multienc device (#929 ) in order to make the work clean.

# CopyPolicy: Released under the terms of the GNU GPL v2.0.
#
# rawValuePublisher.thrift

Copy link
Member

@traversaro traversaro Oct 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
namespace yarp iCub

Adding a namespace here should ensure that all the classes are generated in the correct iCub namespace. See https://github.com/ami-iit/bipedal-locomotion-framework/blob/da3d948990fdab29daf8da9ccb90fb93a093804b/src/YarpUtilities/thrifts/BipedalLocomotion/YarpUtilities/VectorsCollection.thrift#L1 for an example of this (if you want more nested namespaces, you can nest them with iCub.debugLibrary.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I updated the comment for more details).

Copy link
Member

@pattacini pattacini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @MSECode

Well done 👍🏻

I've got two main concerns though:

  1. I don't think it's a good strategy to mix hand-coded files with generated files in the same directory. This happens for files located in iCubDev/include. Can you instead reserve a dedicated folder for generated files?
  2. The names of the plugins that include yarp_. It's way better to remove the prefix in my view.

src/libraries/iCubDev/CMakeLists.txt Outdated Show resolved Hide resolved
src/libraries/iCubDev/CMakeLists.txt Outdated Show resolved Hide resolved
src/libraries/iCubDev/CMakeLists.txt Outdated Show resolved Hide resolved
@MSECode
Copy link
Contributor Author

MSECode commented Oct 10, 2024

Hi @MSECode

Well done 👍🏻

I've got two main concerns though:

  1. I don't think it's a good strategy to mix hand-coded files with generated files in the same directory. This happens for files located in iCubDev/include. Can you instead reserve a dedicated folder for generated files?
  2. The names of the plugins that include yarp_. It's way better to remove the prefix in my view.

Hi @pattacini,
For point 1 --> I'll fix the struct of files and dir, let me know if its fine rn
For point 2 --> Sure, I'll remove that.

@MSECode MSECode force-pushed the feature/rawValuesInterface branch from 771458e to 054ebb5 Compare October 10, 2024 17:10
@pattacini
Copy link
Member

pattacini commented Oct 11, 2024

Thank you @MSECode 👍🏻
All is good with me.

The only point remaining is whether it is convenient or not to commit autogenerated files as per our T2T update, or maintain only the .thrift file.

@pattacini
Copy link
Member

Another quite important point to consider is robotology/robometry#190 (comment).

cc @MSECode

@pattacini
Copy link
Member

The only point remaining is whether it is convenient or not to commit autogenerated files as per our T2T update, or maintain only the .thrift file.

As discussed, it's ok to keep the autogenerated files committed to the repo 👍🏻

Copy link
Member

@pattacini pattacini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @MSECode

As discussed during today's meetup, two things have to be addressed before merging:

  • Increasing the minor number of icub-main release (major.minor.patch). I think minor is more appropriate than patch here.
  • Fixing the cmake installation of the generated headers in the correct path.

@MSECode
Copy link
Contributor Author

MSECode commented Oct 28, 2024

Yes that's correct.
Basically the output of the meeting can be summed up in the following points:

  • as things now we are going to release this new feature as it is by just adding a small update on the CmakeLists.txt for iCubDev (I can install the thrift generated files related to IRawValuesPublisher interface in the same folder as the one for iCubDev files ) and upgrading the minor version for icub-main.
  • In the future we are gonna generate a new repository, which can be called something as iCubTechDebugInterfaces or similar where we are gonna add this and other new interfaces that are gonna come, as well as the wrapper devices related to the rawValuesPublisher.
  • Doing so robometry won't need to depend on the whole icub-main repo that is quite heavy but just on a smaller repo since we decided that it won't make sense to move it to icub-main or somewhere else
  • As soon as we are going to have the new repo ready, with the support of @traversaro, for the cmake part we will make the modifications described.
  • As soon as yarp 3.10 will be released we are going to remove the workarounds done for compiling
  • What said goes to clarify also the points opened for robometry PR, so we can move to ready that too.

This should be all. If I missed something please add.

Cc: @pattacini @Nicogene @traversaro @valegagge @S-Dafarra

@pattacini
Copy link
Member

Pitch perfect 👍🏻

@MSECode
Copy link
Contributor Author

MSECode commented Oct 28, 2024

Pushed fixed requested and checked compilation on a clean container and behavior on a setup.

@MSECode MSECode requested a review from pattacini October 28, 2024 12:17
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.

5 participants