Skip to content

Commit

Permalink
First draft of rawValuesPublisher
Browse files Browse the repository at this point in the history
Write methods of NWS for rawValuePublisher and fix interface name as standard
Add thrift and fake device
Update server and fake device files and start to define stuff for client
Reorganized projects are standards for plugins and redefines CMakelists.txt files. ParamParser now disabled since generate error in finding #include <rawValuesDataStruct.h> during compilation
Update CMakeFiles with the ParamParser generated files and fix compilation for all project
add getRawValue with IRawValuesPublisher interface to embObjMotionControl
Update IRawValuesPublisher interface defining map of vectors for storing raw data
Update server and embObjMC with new version of raw values interface
Add client and tester module to check whole process
Update CMakeLists iCubDev
Add temporary modification to build icub-main and rawvalues devices using yarp 3.9.0. Need to have generated files already pushed on the repo
Add MACRO for enabling/disabling debug lines and move to NOT_YET_IMPLEMENTED Client getKeys waiting for RPC call impl
Removed tester module from CMakeLists.txt
Add note for commented lines and removed useless stuff
  • Loading branch information
valegagge authored and MSECode committed Oct 2, 2024
1 parent fb23d1d commit f4f6953
Show file tree
Hide file tree
Showing 44 changed files with 3,500 additions and 13 deletions.
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
54 changes: 54 additions & 0 deletions app/fakeRawDataPublisherTester/plotRawDataUpperArm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8" ?>
<portscope rows="1" columns="1" carrier="mcast">
<plot gridx="0"
gridy="0"
hspan="1"
vspan="1"
minval="-10"
maxval="50"
title="Motor temperature Plot"
bgcolor="LightSlateGrey">
<graph remote="/upper_arm/motor_temperatures:o"
index="1"
color="purple"
title="temperature pitch"
type="lines"
size="3" />
<graph remote="/upper_arm/motor_temperatures:o"
index="5"
color="darkgreen"
title="temperature yaw"
type="lines"
size="3" />
<graph remote="/upper_arm/motor_temperatures:o"
index="7"
color="orange"
title="temperature elbow"
type="lines"
size="3" />
<graph remote="/ergocub2S/upper_arm/stateExt:o/split16:o"
index="0"
color="red"
title="current pitch"
type="lines"
size="3" />
<graph remote="/ergocub2S/upper_arm/stateExt:o/split16:o"
index="1"
color="blue"
title="current roll"
type="lines"
size="3" />
<graph remote="/ergocub2S/upper_arm/stateExt:o/split16:o"
index="2"
color="green"
title="current yaw"
type="lines"
size="3" />
<graph remote="/ergocub2S/upper_arm/stateExt:o/split16:o"
index="3"
color="yellow"
title="current elbow"
type="lines"
size="3" />
</plot>
</portscope>
14 changes: 12 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_add_idl(IDL_GEN_FILES ${idl_files})
yarp_idl_to_dir(INPUT_FILES ${idl_files} OUTPUT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include/iCub 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 include/iCub/*.cpp)

# Declare groups of source and header files -- makes things pretty in MSVC.
SOURCE_GROUP("Source Files" FILES ${folder_source})
Expand All @@ -17,10 +24,12 @@ 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})#${IDL_GEN_FILES})
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}/include/iCub>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/iCub>")
target_link_libraries(${PROJECT_NAME} YARP::YARP_os
YARP::YARP_dev)
set_target_properties(${PROJECT_NAME} PROPERTIES
Expand All @@ -37,6 +46,7 @@ install(TARGETS ${PROJECT_NAME}
PUBLIC_HEADER
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/iCub")

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

icub_install_basic_package_files(${PROJECT_NAME}
DEPENDENCIES YARP_os
Expand Down
65 changes: 65 additions & 0 deletions src/libraries/iCubDev/include/iCub/IRawValuesPublisher.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* SPDX-FileCopyrightText: 2006-2024 Istituto Italiano di Tecnologia (IIT)
* SPDX-License-Identifier: BSD-3-Clause
*/

#ifndef _ICUB_IRAWVALUESPUBLISHER_H_
#define _ICUB_IRAWVALUESPUBLISHER_H_

#include "rawValuesDataVectorsMap.h"
#include "rawValuesKeyMetadata.h"
#include "rawValuesKeyMetadataMap.h"
#include "RawValuesPublisherMetadata.h"

namespace iCub
{
namespace debugLibrary
{
class IRawValuesPublisher
{
public:
/* Fill the passed map with the raw values coming from the low level
* @param map for raw values
* @return true if the local raw value can be taken otherwise false
*/
virtual bool getRawDataMap(std::map<std::string, std::vector<std::int32_t>> &map) = 0;

/* Fill the passed vector with the raw values coming from the low level
* given the specific key associated to a vector of raw data
* @param key to be found in the local map of metadata
* @param data vector of raw values to be filled
* @return true if the key exists in the local metadata map and if the raw values can be found
* otherwise false
*/
virtual bool getRawData(std::string key, std::vector<std::int32_t> &data) = 0;

/* Fill the passed vector with the keys saved in the local map of metadata
* @param keys vector of strings which will be filled with the keys of the metadata map
* @return true if there's no error in pushing back the keys in the vector
*/
virtual bool getKeys(std::vector<std::string> &keys) = 0;

/* @return the number of keys, i.e. entries, saved in the local map of metadata
*/
virtual int getNumberOfKeys() = 0;

/* Copy the local map of metadata to the one passed as argument
* @param metamap map of metadata to be filled
* @return true if the local map is not empty and if the copy ends correctly
* otherwise return false
*/
virtual bool getMetadataMAP(rawValuesKeyMetadataMap &metamap) = 0;

/* Given the key of a specific entry fill the metadata with the one
* present at the requested entry of the local map
* @param key for getting the specific entry in the local map
* @param meta the metadata to be filled with the data and the requested entry
* @return true if the find and copy ends fine otherwise false
*/
virtual bool getKeyMetadata(std::string key, rawValuesKeyMetadata &meta) = 0;
};
}
}

#endif //_ICUB_IRAWVALUESPUBLISHER_H_

Loading

0 comments on commit f4f6953

Please sign in to comment.