Skip to content

Commit

Permalink
Merge pull request #206 from roboticslab-uc3m/fix-testCuiAbsolute
Browse files Browse the repository at this point in the history
Fixed and updated: testCuiAbsolute app merged!
  • Loading branch information
Raúl de Santos authored Apr 5, 2019
2 parents f186748 + 3d78122 commit b1dc5a1
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions tests/testCuiAbsolute/testCuiAbsolute.cpp
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
#include "gtest/gtest.h"
#include "gtest/gtest.h"

#include <cstdlib>
#include <ios>
#include <string>
#include <sstream>
#include <map>

#include <yarp/os/Property.h>
#include <yarp/os/Time.h>
#include <yarp/os/all.h>
#include <yarp/dev/all.h>

#include <yarp/dev/PolyDriver.h>
#include <yarp/dev/ControlBoardInterfaces.h>
#include <yarp/dev/IControlLimits2.h>
#include <yarp/dev/CanBusInterface.h>

#include <ColorDebug.h>
#include "ColorDebug.h"

#include "ICanBusSharer.h"
#include "ICuiAbsolute.h"

#define CAN_ID 103 // ID of Cui Absolute encoder that you want to check...
#define CAN_ID 126 // ID of Cui Absolute encoder that you want to check...

namespace roboticslab
{
Expand All @@ -37,9 +32,9 @@ class CuiAbsoluteTest : public testing::Test // -- inherit the Test class (gtest
{
// -- code here will execute just before the test ensues

yarp::os::Property canDeviceConf("(device CanBusHico) (canDevice /dev/can0) (canBitrate 1000000)");
yarp::os::Property canDeviceConf("(device CanBusPeak) (canDevice /dev/pcan3) (canBitrate 1000000)");
bool ok = true;
ok &= canBusDevice.open(canDeviceConf); // -- we introduce the configuration properties defined in property object (p) and them, we stard the device (HicoCAN)
ok &= canBusDevice.open(canDeviceConf); // -- we introduce the configuration properties defined in property object (p) and them, we stard the device (CanBusPeak)
ok &= canBusDevice.view(iCanBus);
ok &= canBusDevice.view(iCanBufferFactory);

Expand All @@ -57,9 +52,11 @@ class CuiAbsoluteTest : public testing::Test // -- inherit the Test class (gtest
std::stringstream strconf;
strconf << "(device CuiAbsolute) (canId " << CAN_ID << ") (min 0) (max 0) (tr 1) (refAcceleration 0.0) (refSpeed 0.0)";
CD_DEBUG("%s\n",strconf.str().c_str());
yarp::os::Property CuiAbsoluteConf (strconf.str().c_str());

ok &= canNodeDevice.open( CuiAbsoluteConf ); // -- we introduce the configuration properties defined ........
yarp::os::Property cuiAbsoluteConf (strconf.str().c_str());
yarp::os::Value v(&iCanBufferFactory, sizeof(iCanBufferFactory));
cuiAbsoluteConf.put("canBufferFactory", v);
ok &= canNodeDevice.open( cuiAbsoluteConf ); // -- we introduce the configuration properties defined ........
if ( ! canNodeDevice.isValid() )
{
CD_ERROR("Bad device of CuiAbsolute :(\n");
Expand Down

0 comments on commit b1dc5a1

Please sign in to comment.