From f84f45efb39d2e440dd00d11590d6110b1944164 Mon Sep 17 00:00:00 2001 From: Martina Gloria Date: Wed, 17 Jan 2024 16:31:51 +0100 Subject: [PATCH] Change Options and PolyDriver names to more meaningful ones --- src/imu/imu.cpp | 48 ++++++++++++++++++++++++------------------------ src/imu/imu.h | 4 ++-- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/imu/imu.cpp b/src/imu/imu.cpp index b36bccc..a9307a0 100644 --- a/src/imu/imu.cpp +++ b/src/imu/imu.cpp @@ -33,15 +33,15 @@ bool Imu::setup(yarp::os::Property& property) { ROBOTTESTINGFRAMEWORK_TEST_REPORT("Running IMU test on "+robotName+"..."); - yarp::os::Property options1; - options1.put("device", "multipleanalogsensorsclient"); - options1.put("remote", portName); - options1.put("local", "/imuTest/"+portName); + yarp::os::Property MASclientOptions; + MASclientOptions.put("device", "multipleanalogsensorsclient"); + MASclientOptions.put("remote", portName); + MASclientOptions.put("local", "/imuTest/"+portName); - driver1 = new yarp::dev::PolyDriver(options1); + MASclientDriver = new yarp::dev::PolyDriver(MASclientOptions); - yarp::os::Property options2; - options2.put("device", "remotecontrolboardremapper"); + yarp::os::Property controlBoardOptions; + controlBoardOptions.put("device", "remotecontrolboardremapper"); yarp::os::Bottle axesNames; yarp::os::Bottle & axesList = axesNames.addList(); axesList.addString("neck_pitch"); @@ -59,7 +59,7 @@ bool Imu::setup(yarp::os::Property& property) { axesList.addString("r_shoulder_yaw"); axesList.addString("r_elbow"); - options2.put("axesNames", axesNames.get(0)); + controlBoardOptions.put("axesNames", axesNames.get(0)); yarp::os::Bottle remoteControlBoards; yarp::os::Bottle & remoteControlBoardsList = remoteControlBoards.addList(); @@ -67,17 +67,17 @@ bool Imu::setup(yarp::os::Property& property) { remoteControlBoardsList.addString("/"+robotName+"/head"); remoteControlBoardsList.addString("/"+robotName+"/left_arm"); remoteControlBoardsList.addString("/"+robotName+"/right_arm"); - options2.put("remoteControlBoards", remoteControlBoards.get(0)); - options2.put("localPortPrefix", "/test"); + controlBoardOptions.put("remoteControlBoards", remoteControlBoards.get(0)); + controlBoardOptions.put("localPortPrefix", "/test"); - driver2 = new yarp::dev::PolyDriver(options2); - ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_FALSE(driver1->isValid(), "Device driver cannot be opened"); - ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_FALSE(driver1->view(iorientation), "Unable to open orientation interface"); - ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_FALSE(driver2->isValid(), "Device driver cannot be opened"); - ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_FALSE(driver2->view(ipos), "Unable to open position control interface"); - ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_FALSE(driver2->view(ienc), "Unable to open encoder interface"); - ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_FALSE(driver2->view(iaxes), "Unable to open axes interface"); - ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_FALSE(driver2->view(ilim), "Unable to open limits interface"); + controlBoardDriver = new yarp::dev::PolyDriver(controlBoardOptions); + ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_FALSE(MASclientDriver->isValid(), "Device driver cannot be opened"); + ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_FALSE(MASclientDriver->view(iorientation), "Unable to open orientation interface"); + ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_FALSE(controlBoardDriver->isValid(), "Device driver cannot be opened"); + ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_FALSE(controlBoardDriver->view(ipos), "Unable to open position control interface"); + ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_FALSE(controlBoardDriver->view(ienc), "Unable to open encoder interface"); + ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_FALSE(controlBoardDriver->view(iaxes), "Unable to open axes interface"); + ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_FALSE(controlBoardDriver->view(ilim), "Unable to open limits interface"); outputPort.open("/test-imu/out"); @@ -136,16 +136,16 @@ void Imu::tearDown() { outputPort.interrupt(); outputPort.close(); - if(driver1) + if(MASclientDriver) { - delete driver1; - driver1 = 0; + delete MASclientDriver; + MASclientDriver = 0; } - if(driver2) + if(controlBoardDriver) { - delete driver2; - driver2 = 0; + delete controlBoardDriver; + controlBoardDriver = 0; } } diff --git a/src/imu/imu.h b/src/imu/imu.h index 1959007..f874f81 100644 --- a/src/imu/imu.h +++ b/src/imu/imu.h @@ -28,8 +28,8 @@ class Imu : public yarp::robottestingframework::TestCase { std::string frameName; std::string sensorName; - yarp::dev::PolyDriver *driver1; - yarp::dev::PolyDriver *driver2; + yarp::dev::PolyDriver *MASclientDriver; + yarp::dev::PolyDriver *controlBoardDriver; yarp::dev::IOrientationSensors* iorientation; yarp::dev::IPositionControl* ipos; yarp::dev::IEncoders* ienc;