Skip to content

Commit

Permalink
fix: cmake and yarp warnings (#160)
Browse files Browse the repository at this point in the history
* fix: cmake and yarp warnings fixes

* fix: cmake yarp OS -> os
  • Loading branch information
arrenglover authored May 9, 2022
1 parent f568734 commit fb9b9c4
Show file tree
Hide file tree
Showing 78 changed files with 334 additions and 319 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ set_package_properties(OpenCV PROPERTIES TYPE OPTIONAL)

if(OpenCV_FOUND)
set(OpenCV_dep OpenCV)
find_package(YARP COMPONENTS OS sig math dev cv REQUIRED)
find_package(YARP COMPONENTS os sig math dev cv REQUIRED)
else()
set(OpenCV_dep "")
find_package(YARP COMPONENTS OS sig math dev REQUIRED)
find_package(YARP COMPONENTS os sig math dev REQUIRED)
endif()
yarp_configure_external_installation(event-driven)

Expand Down Expand Up @@ -105,7 +105,7 @@ install_basic_package_files(${PROJECT_NAME}
COMPATIBILITY SameMajorVersion
LOWERCASE_FILENAMES
NAMESPACE ev::
DEPENDENCIES "YARP COMPONENTS OS sig"
DEPENDENCIES "YARP COMPONENTS os sig"
${OpenCV_dep}
INCLUDE_CONTENT "yarp_configure_external_installation(event-driven NO_PATH_D)")

Expand Down
2 changes: 1 addition & 1 deletion documentation/example-module-py/example-module.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def configure(self, rf):
# read flags and parameters
example_flag = rf.check("example_flag") and rf.check("example_flag", yarp.Value(True)).asBool()
default_value = 0.1
example_parameter = rf.check("example_parameter", yarp.Value(default_value)).asDouble()
example_parameter = rf.check("example_parameter", yarp.Value(default_value)).asFloat64()

# do any other set-up required here
# start the asynchronous and synchronous threads
Expand Down
4 changes: 2 additions & 2 deletions documentation/example-module/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ add_install_rpath_support(BIN_DIRS "${CMAKE_INSTALL_FULL_BINDIR}"



find_package(YARP COMPONENTS OS sig math dev REQUIRED)
find_package(YARP COMPONENTS os sig math dev REQUIRED)
find_package(event-driven REQUIRED)

#default the install location to that of event-driven

add_executable(${PROJECT_NAME} ${PROJECT_NAME}.cpp)

target_link_libraries(${PROJECT_NAME} PRIVATE YARP::YARP_OS
target_link_libraries(${PROJECT_NAME} PRIVATE YARP::YARP_os
YARP::YARP_init
ev::event-driven)

Expand Down
2 changes: 1 addition & 1 deletion documentation/example-module/example-module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class exampleModule : public RFModule, public Thread {
rf.check("example_flag", Value(true)).asBool();
double default_value = 0.1;
example_parameter = rf.check("example_parameter",
Value(default_value)).asDouble();
Value(default_value)).asFloat64();

//do any other set-up required here

Expand Down
6 changes: 3 additions & 3 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,14 @@ target_compile_definitions(${EVENTDRIVEN_LIBRARY} PRIVATE "${VLIB_CODEC_TYPE}"
CLOCK_PERIOD=${VLIB_CLOCK_PERIOD_NS}
TIMER_BITS=${VLIB_TIMER_BITS})

target_compile_options(${EVENTDRIVEN_LIBRARY} PRIVATE -Wall)
target_compile_options(${EVENTDRIVEN_LIBRARY} PRIVATE -Wall -fno-strict-aliasing)

if(OpenCV_FOUND)
target_link_libraries(${EVENTDRIVEN_LIBRARY} PUBLIC YARP::YARP_OS
target_link_libraries(${EVENTDRIVEN_LIBRARY} PUBLIC YARP::YARP_os
YARP::YARP_sig
${OpenCV_LIBRARIES})
else()
target_link_libraries(${EVENTDRIVEN_LIBRARY} PUBLIC YARP::YARP_OS
target_link_libraries(${EVENTDRIVEN_LIBRARY} PUBLIC YARP::YARP_os
YARP::YARP_sig)
endif()

Expand Down
6 changes: 3 additions & 3 deletions lib/include/event-driven/vBottle.h
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ class vBottle : public yarp::os::Bottle {
//you cannot use any of the following functions
void add();
void addDict();
void addDouble();
void addInt();
void addFloat64();
void addInt32();
void addList();
void addString();
void addVocab();
Expand Down Expand Up @@ -278,7 +278,7 @@ class vBottleMimic : public yarp::os::Portable {
header1.push_back(BOTTLE_TAG_STRING); //code for string
header1.push_back(2); // length of string
header2 = "AE";
header3.push_back(BOTTLE_TAG_LIST|BOTTLE_TAG_INT); // bottle code + specialisation with ints
header3.push_back(BOTTLE_TAG_LIST|BOTTLE_TAG_INT32); // bottle code + specialisation with ints
header3.push_back(0); // <- set the number of ints here (e.g. 2 * #v's)
elementINTS = 2;
elementBYTES = sizeof(std::int32_t) * elementINTS;
Expand Down
48 changes: 24 additions & 24 deletions lib/include/event-driven/vDrawSkin.h
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ class loadMap {
std :: cout << "Calibration data";
yarp::os::Bottle calibration_data = *(rf2.find("taxel2Repr").asList());
for (size_t i = 0; i < calibration_data.size(); i++){
taxel2Repr.push_back(calibration_data.get(i).asInt());
taxel2Repr.push_back(calibration_data.get(i).asInt32());
}
skin.initRepresentativeTaxels(taxel2Repr);
}
Expand All @@ -813,13 +813,13 @@ class loadMap {

//std::string type(sensorConfig.get(0).asString()); useless since forearm has always same type and hand has a precise numbering for palm and fingers.

int id=sensorConfig.get(1).asInt();
double x=sensorConfig.get(2).asDouble();
double y=sensorConfig.get(3).asDouble();
double orientation=sensorConfig.get(4).asDouble();
double gain=sensorConfig.get(5).asDouble();
int mirror=sensorConfig.get(6).asInt();
int layoutNum=sensorConfig.get(7).asInt();
int id=sensorConfig.get(1).asInt32();
double x=sensorConfig.get(2).asFloat64();
double y=sensorConfig.get(3).asFloat64();
double orientation=sensorConfig.get(4).asFloat64();
double gain=sensorConfig.get(5).asFloat64();
int mirror=sensorConfig.get(6).asInt32();
int layoutNum=sensorConfig.get(7).asInt32();

skin.get_data(id,x,y,orientation,gain,mirror,layoutNum);

Expand Down Expand Up @@ -865,7 +865,7 @@ class loadMap {
std :: cout << "Calibration data";
yarp::os::Bottle calibration_data = *(rf2.find("taxel2Repr").asList());
for (size_t i = 0; i < calibration_data.size(); i++){
taxel2Repr.push_back(calibration_data.get(i).asInt());
taxel2Repr.push_back(calibration_data.get(i).asInt32());
}
handR.initRepresentativeTaxels(taxel2Repr);
}
Expand All @@ -887,13 +887,13 @@ class loadMap {

//std::string type(sensorConfig.get(0).asString()); useless since forearm has always same type and hand has a precise numbering for palm and fingers.

int id=sensorConfig.get(1).asInt();
double x=sensorConfig.get(2).asDouble();
double y=sensorConfig.get(3).asDouble();
double orientation=sensorConfig.get(4).asDouble();
double gain=sensorConfig.get(5).asDouble();
int mirror=sensorConfig.get(6).asInt();
int layoutNum=sensorConfig.get(7).asInt();
int id=sensorConfig.get(1).asInt32();
double x=sensorConfig.get(2).asFloat64();
double y=sensorConfig.get(3).asFloat64();
double orientation=sensorConfig.get(4).asFloat64();
double gain=sensorConfig.get(5).asFloat64();
int mirror=sensorConfig.get(6).asInt32();
int layoutNum=sensorConfig.get(7).asInt32();

handR.get_data(id,x,y,orientation,gain,mirror,layoutNum);
}
Expand Down Expand Up @@ -937,7 +937,7 @@ class loadMap {
std :: cout << "Calibration data";
yarp::os::Bottle calibration_data = *(rf2.find("taxel2Repr").asList());
for (size_t i = 0; i < calibration_data.size(); i++){
taxel2Repr.push_back(calibration_data.get(i).asInt());
taxel2Repr.push_back(calibration_data.get(i).asInt32());
}
handL.initRepresentativeTaxels(taxel2Repr);
}
Expand All @@ -959,13 +959,13 @@ class loadMap {

//std::string type(sensorConfig.get(0).asString()); useless since forearm has always same type and hand has a precise numbering for palm and fingers.

int id=sensorConfig.get(1).asInt();
double x=sensorConfig.get(2).asDouble();
double y=sensorConfig.get(3).asDouble();
double orientation=sensorConfig.get(4).asDouble();
double gain=sensorConfig.get(5).asDouble();
int mirror=sensorConfig.get(6).asInt();
int layoutNum=sensorConfig.get(7).asInt();
int id=sensorConfig.get(1).asInt32();
double x=sensorConfig.get(2).asFloat64();
double y=sensorConfig.get(3).asFloat64();
double orientation=sensorConfig.get(4).asFloat64();
double gain=sensorConfig.get(5).asFloat64();
int mirror=sensorConfig.get(6).asInt32();
int layoutNum=sensorConfig.get(7).asInt32();

handL.get_data(id,x,y,orientation,gain,mirror,layoutNum);
}
Expand Down
14 changes: 7 additions & 7 deletions lib/include/event-driven/vPort.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class vPortableInterface : public Portable {
header1.push_back(BOTTLE_TAG_STRING); //code for string
header1.push_back(0); // length of string
header2 = "";
header3.push_back(BOTTLE_TAG_LIST|BOTTLE_TAG_INT); // bottle code + specialisation with ints
header3.push_back(BOTTLE_TAG_LIST|BOTTLE_TAG_INT32); // bottle code + specialisation with ints
header3.push_back(0); // <- set the number of ints here (e.g. 2 * #v's)
elementINTS = 0;
elementBYTES = sizeof(int32_t) * elementINTS;
Expand Down Expand Up @@ -189,22 +189,22 @@ class vPortableInterface : public Portable {
bool read(yarp::os::ConnectionReader& connection) {

//META DATA OF BOTTLE
if(connection.expectInt() != BOTTLE_TAG_LIST) //a list
if(connection.expectInt32() != BOTTLE_TAG_LIST) //a list
return false;
if(connection.expectInt() != 2) //of two internal bottles
if(connection.expectInt32() != 2) //of two internal bottles
return false;

//DATA OF FIRST INTERNAL BOTTLE (type of event)
if(connection.expectInt() != BOTTLE_TAG_STRING) // first of two
if(connection.expectInt32() != BOTTLE_TAG_STRING) // first of two
return false;
int str_len = connection.expectInt();
int str_len = connection.expectInt32();
event_type.resize(str_len);
connection.expectBlock((char *)event_type.data(), str_len);

//DATA OF SECOND INTERNAL BOTTLE (data of events)
if(connection.expectInt() != (BOTTLE_TAG_LIST|BOTTLE_TAG_INT32))
if(connection.expectInt32() != (BOTTLE_TAG_LIST|BOTTLE_TAG_INT32))
return false;
ints_to_read = (unsigned int)connection.expectInt(); //in integers!!
ints_to_read = (unsigned int)connection.expectInt32(); //in integers!!

if(ints_to_read > internaldata.size())
internaldata.resize(ints_to_read);
Expand Down
24 changes: 12 additions & 12 deletions lib/include/event-driven/vtsHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -351,15 +351,15 @@ class imuAdvHelper
yInfo() << "GYR_SKEW" << gs->toString();

for(int i = 0; i < 3; i++) {
calib.ab[i] = ab->get(i).asDouble();
calib.ag[i] = ag->get(i).asDouble();
calib.gb[i] = gb->get(i).asDouble();
calib.gg[i] = gg->get(i).asDouble();
calib.ab[i] = ab->get(i).asFloat64();
calib.ag[i] = ag->get(i).asFloat64();
calib.gb[i] = gb->get(i).asFloat64();
calib.gg[i] = gg->get(i).asFloat64();
}

for (int i = 0; i < 9; i++) {
calib.as[i] = as->get(i).asDouble();
calib.gs[i] = gs->get(i).asDouble();
calib.as[i] = as->get(i).asFloat64();
calib.gs[i] = gs->get(i).asFloat64();
}

return true;
Expand Down Expand Up @@ -415,12 +415,12 @@ class imuHelper {
yWarning() << "IMU config (6) incorrect size = " << config->size();
return false;
}
bias[ACC_X] = config->get(0).asDouble();
gain[ACC_X] = config->get(1).asDouble();
bias[ACC_Y] = config->get(2).asDouble();
gain[ACC_Y] = config->get(3).asDouble();
bias[ACC_Z] = config->get(4).asDouble();
gain[ACC_Z] = config->get(5).asDouble();
bias[ACC_X] = config->get(0).asFloat64();
gain[ACC_X] = config->get(1).asFloat64();
bias[ACC_Y] = config->get(2).asFloat64();
gain[ACC_Y] = config->get(3).asFloat64();
bias[ACC_Z] = config->get(4).asFloat64();
gain[ACC_Z] = config->get(5).asFloat64();

return true;
}
Expand Down
6 changes: 3 additions & 3 deletions lib/src/codecs/codec_AddressEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,21 +142,21 @@ bool AddressEvent::decode(const yarp::os::Bottle &packet, size_t &pos)
if (vEvent::decode(packet, pos) && pos + 1 <= packet.size())
{
#if defined CODEC_128x128
_bitorder128._coded_data = packet.get(pos++).asInt();
_bitorder128._coded_data = packet.get(pos++).asInt32();
polarity = _bitorder128.polarity;
x = _bitorder128.x;
y = _bitorder128.y;
channel = _bitorder128.channel;
#elif defined CODEC_304x240_20
_bitorder20._coded_data = packet.get(pos++).asInt();
_bitorder20._coded_data = packet.get(pos++).asInt32();
polarity = _bitorder20.polarity;
x = _bitorder20.x;
y = _bitorder20.y;
type = _bitorder20.type;
channel = _bitorder20.channel;
skin = _bitorder20.skin;
#else
_coded_data = packet.get(pos++).asInt();
_coded_data = packet.get(pos++).asInt32();
#endif
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/src/codecs/codec_CochleaEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ namespace ev {
bool CochleaEvent::decode(const yarp::os::Bottle &packet, size_t &pos) {
// check length
if (vEvent::decode(packet, pos) && pos + 1 <= packet.size()) {
_cochleaei = packet.get(pos++).asInt();
_cochleaei = packet.get(pos++).asInt32();
return true;
}
return false;
Expand Down
4 changes: 2 additions & 2 deletions lib/src/codecs/codec_FlowEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ bool FlowEvent::decode(const yarp::os::Bottle &packet, size_t &pos)
// check length
if (AddressEvent::decode(packet, pos) && pos + 2 <= packet.size())
{
_fei[0] = packet.get(pos++).asInt();
_fei[1] = packet.get(pos++).asInt();
_fei[0] = packet.get(pos++).asInt32();
_fei[1] = packet.get(pos++).asInt32();
return true;
}
return false;
Expand Down
6 changes: 3 additions & 3 deletions lib/src/codecs/codec_GaussianAE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ bool GaussianAE::decode(const yarp::os::Bottle &packet, size_t &pos)
if (LabelledAE::decode(packet, pos) && pos + 3 <= packet.size())
{

_gaei[0] = packet.get(pos++).asInt();
_gaei[1] = packet.get(pos++).asInt();
_gaei[2] = packet.get(pos++).asInt();
_gaei[0] = packet.get(pos++).asInt32();
_gaei[1] = packet.get(pos++).asInt32();
_gaei[2] = packet.get(pos++).asInt32();
return true;
}
return false;
Expand Down
2 changes: 1 addition & 1 deletion lib/src/codecs/codec_IMUEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ bool IMUevent::decode(const yarp::os::Bottle &packet, size_t &pos)
// check length
if (vEvent::decode(packet, pos) && pos + 1 <= packet.size())
{
_coded_data = packet.get(pos++).asInt();
_coded_data = packet.get(pos++).asInt32();
return true;
}
return false;
Expand Down
4 changes: 2 additions & 2 deletions lib/src/codecs/codec_LabelledAE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ event<> LabelledAE::clone()
void LabelledAE::encode(yarp::os::Bottle &b) const
{
AddressEvent::encode(b);
b.addInt(ID);
b.addInt32(ID);
}

void LabelledAE::encode(std::vector<int32_t> &b, unsigned int &pos) const
Expand All @@ -66,7 +66,7 @@ bool LabelledAE::decode(const yarp::os::Bottle &packet, size_t &pos)
{
if (AddressEvent::decode(packet, pos) && pos + 1 <= packet.size())
{
ID = packet.get(pos).asInt();
ID = packet.get(pos).asInt32();
pos+=1;
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/src/codecs/codec_NeuronEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ bool neuronEvent::decode(const yarp::os::Bottle &packet, size_t &pos)
// check length
if (vEvent::decode(packet, pos) && pos + 1 <= packet.size())
{
id = packet.get(pos++).asInt();
id = packet.get(pos++).asInt32();
return true;
}
return false;
Expand Down
2 changes: 1 addition & 1 deletion lib/src/codecs/codec_SkinEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ bool SkinEvent::decode(const yarp::os::Bottle &packet, size_t &pos)
// check length
if (vEvent::decode(packet, pos) && pos + 1 <= packet.size())
{
_skei = packet.get(pos++).asInt();
_skei = packet.get(pos++).asInt32();
return true;
}
return false;
Expand Down
4 changes: 2 additions & 2 deletions lib/src/codecs/codec_SkinSample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ bool SkinSample::decode(const yarp::os::Bottle &packet, size_t &pos)
// check length
if (SkinEvent::decode(packet, pos) && pos + 2 <= packet.size())
{
_ts = packet.get(pos++).asInt();
value = packet.get(pos++).asInt();
_ts = packet.get(pos++).asInt32();
value = packet.get(pos++).asInt32();
return true;
}
return false;
Expand Down
4 changes: 2 additions & 2 deletions lib/src/codecs/codec_vEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ event<> vEvent::clone()

void vEvent::encode(yarp::os::Bottle &b) const
{
b.addInt(stamp&vtsHelper::max_stamp);
b.addInt32(stamp&vtsHelper::max_stamp);
}

void vEvent::encode(std::vector<int32_t> &b, unsigned int &pos) const
Expand All @@ -49,7 +49,7 @@ void vEvent::encode(std::vector<int32_t> &b, unsigned int &pos) const
bool vEvent::decode(const yarp::os::Bottle &packet, size_t &pos)
{
if(pos + 1 <= packet.size()) {
stamp = packet.get(pos).asInt()&vtsHelper::max_stamp;
stamp = packet.get(pos).asInt32()&vtsHelper::max_stamp;
pos += 1;
return true;
}
Expand Down
Loading

0 comments on commit fb9b9c4

Please sign in to comment.