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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ cmake_minimum_required(VERSION 3.12...3.28)

set(ROOT_PROJECT_NAME ICUB)
project(${ROOT_PROJECT_NAME} LANGUAGES C CXX
VERSION 2.6.3)
VERSION 2.7.0)

set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD 14)
Expand Down
7 changes: 7 additions & 0 deletions app/fakeRawDataPublisherTester/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Copyright: (C) 2024 iCub Facility - Istituto Italiano di Tecnologia
# Authors: Jacopo Losi
# CopyPolicy: Released under the terms of the GNU GPL v2.0.

set(appname fakeRawDataPublisherTester)
file(GLOB conf ${CMAKE_CURRENT_SOURCE_DIR}/conf/*.ini)
yarp_install(FILES ${conf} DESTINATION ${ICUB_CONTEXTS_INSTALL_DIR}/${appname})
4 changes: 4 additions & 0 deletions app/fakeRawDataPublisherTester/conf/config.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[GENERAL]
robotname fakedevicetest
period 1.0
portprefix /raw_data
36 changes: 36 additions & 0 deletions app/fakeRawDataPublisherTester/plotRawDataUpperArm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8" ?>
<portscope rows="1" columns="1" carrier="mcast">
<plot gridx="0"
gridy="0"
hspan="1"
vspan="1"
minval="-20"
maxval="256"
title="Raw Valeus Test Plot"
bgcolor="LightSlateGrey">
<graph remote="/fakedevicetest/raw_data/rawdata:o"
index="1"
color="purple"
title="raw value 1"
type="lines"
size="3" />
<graph remote="/fakedevicetest/raw_data/rawdata:o"
index="2"
color="pink"
title="raw value 2"
type="lines"
size="3" />
<graph remote="/fakedevicetest/raw_data/rawdata:o"
index="3"
color="green"
title="raw value 3"
type="lines"
size="3" />
<graph remote="/fakedevicetest/raw_data/rawdata:o"
index="4"
color="orange"
title="raw value 4"
type="lines"
size="3" />
</plot>
</portscope>
13 changes: 11 additions & 2 deletions src/libraries/iCubDev/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,17 @@

project(iCubDev)

# Add IDL files generation from thrift
set(idl_files include/iCub/rawValuesPublisher.thrift)
set(doc_files include/iCub/rawValuesPublisher.xml)

yarp_idl_to_dir(INPUT_FILES ${idl_files} OUTPUT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/autogenerated PLACEMENT MERGED)

# Find .cpp and .h files automatically. This is a bit lazy,
# and in principle it would be better to list these files manually.
FILE(GLOB folder_source src/*.cpp)
FILE(GLOB folder_header include/iCub/*.h)
FILE(GLOB folder_idlgen autogenerated/iCub/*)

# Declare groups of source and header files -- makes things pretty in MSVC.
SOURCE_GROUP("Source Files" FILES ${folder_source})
Expand All @@ -17,10 +24,11 @@ SOURCE_GROUP("Header Files" FILES ${folder_header})
include_directories(${PROJECT_SOURCE_DIR}/include)

# Create everything needed to build our executable.
add_library(${PROJECT_NAME} ${folder_source} ${folder_header})
add_library(${PROJECT_NAME} ${folder_source} ${folder_header} ${folder_idlgen})
add_library(ICUB::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
target_include_directories(${PROJECT_NAME} PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/autogenerated>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")
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

YARP::YARP_dev)
set_target_properties(${PROJECT_NAME} PROPERTIES
Expand All @@ -37,6 +45,7 @@ install(TARGETS ${PROJECT_NAME}
PUBLIC_HEADER
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/iCub")

install(FILES ${folder_idlgen} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/iCub")

icub_install_basic_package_files(${PROJECT_NAME}
DEPENDENCIES YARP_os
Expand Down
Loading