-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
571abb9
commit 5e614f9
Showing
8 changed files
with
980 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
libraries/YarpPlugins/RealToSimControlboard/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Copyright: (C) 2019 Universidad Carlos III de Madrid | ||
# Author: Juan G. Victores | ||
|
||
yarp_prepare_plugin(RealToSimControlboard | ||
CATEGORY device | ||
TYPE roboticslab::RealToSimControlboard | ||
INCLUDE RealToSimControlboard.hpp | ||
DEFAULT ON) | ||
|
||
if(NOT SKIP_RealToSimControlboard) | ||
|
||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}) # yarp plugin builder needs this | ||
|
||
yarp_add_plugin(RealToSimControlboard RealToSimControlboard.hpp | ||
DeviceDriverImpl.cpp | ||
IEncodersTimedImpl.cpp | ||
IPositionControlImpl.cpp | ||
IVelocityControlImpl.cpp) | ||
|
||
target_link_libraries(RealToSimControlboard YARP::YARP_OS | ||
YARP::YARP_dev | ||
ROBOTICSLAB::ColorDebug) | ||
|
||
if(NOT YARP_VERSION_SHORT VERSION_LESS 3.2) | ||
yarp_install(TARGETS RealToSimControlboard | ||
LIBRARY DESTINATION ${ROBOTICSLAB-OPENRAVE-YARP-PLUGINS_DYNAMIC_PLUGINS_INSTALL_DIR} | ||
ARCHIVE DESTINATION ${ROBOTICSLAB-OPENRAVE-YARP-PLUGINS_STATIC_PLUGINS_INSTALL_DIR} | ||
YARP_INI DESTINATION ${ROBOTICSLAB-OPENRAVE-YARP-PLUGINS_PLUGIN_MANIFESTS_INSTALL_DIR}) | ||
else() | ||
yarp_install(TARGETS RealToSimControlboard | ||
LIBRARY DESTINATION ${ROBOTICSLAB-OPENRAVE-YARP-PLUGINS_DYNAMIC_PLUGINS_INSTALL_DIR} | ||
ARCHIVE DESTINATION ${ROBOTICSLAB-OPENRAVE-YARP-PLUGINS_STATIC_PLUGINS_INSTALL_DIR}) | ||
|
||
yarp_install(FILES RealToSimControlboard.ini | ||
DESTINATION ${ROBOTICSLAB-OPENRAVE-YARP-PLUGINS_PLUGIN_MANIFESTS_INSTALL_DIR}) | ||
endif() | ||
|
||
endif() |
27 changes: 27 additions & 0 deletions
27
libraries/YarpPlugins/RealToSimControlboard/DeviceDriverImpl.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*- | ||
|
||
#include "RealToSimControlboard.hpp" | ||
|
||
namespace roboticslab | ||
{ | ||
|
||
// ------------------- DeviceDriver Related ------------------------------------ | ||
|
||
bool RealToSimControlboard::open(yarp::os::Searchable& config) | ||
{ | ||
CD_DEBUG("config: %s\n",config.toString().c_str()); | ||
|
||
return true; | ||
} | ||
|
||
// ----------------------------------------------------------------------------- | ||
|
||
bool RealToSimControlboard::close() | ||
{ | ||
CD_INFO("\n"); | ||
return true; | ||
} | ||
|
||
// ----------------------------------------------------------------------------- | ||
|
||
} // namespace roboticslab |
115 changes: 115 additions & 0 deletions
115
libraries/YarpPlugins/RealToSimControlboard/IEncodersTimedImpl.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
// -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*- | ||
|
||
#include "RealToSimControlboard.hpp" | ||
|
||
// ------------------ IEncodersTimed Related ----------------------------------------- | ||
|
||
bool roboticslab::RealToSimControlboard::getEncodersTimed(double *encs, double *time) { | ||
//CD_INFO("\n"); //-- Way too verbose | ||
bool ok = true; | ||
for(unsigned int i=0; i < axes; i++) | ||
ok &= getEncoderTimed(i,&(encs[i]),&(time[i])); | ||
return ok; | ||
} | ||
|
||
// ----------------------------------------------------------------------------- | ||
|
||
bool roboticslab::RealToSimControlboard::getEncoderTimed(int j, double *encs, double *time) { | ||
//CD_INFO("(%d)\n",j); //-- Way too verbose | ||
|
||
getEncoder(j, encs); | ||
*time = yarp::os::Time::now(); | ||
|
||
return true; | ||
} | ||
|
||
// ----------------------------------------------------------------------------- | ||
|
||
bool roboticslab::RealToSimControlboard::resetEncoder(int j) { | ||
CD_INFO("\n"); | ||
if ((unsigned int)j>axes) return false; | ||
return setEncoder(j,0.0); | ||
} | ||
|
||
// ----------------------------------------------------------------------------- | ||
|
||
bool roboticslab::RealToSimControlboard::resetEncoders() { | ||
CD_INFO("\n"); | ||
bool ok = true; | ||
for(unsigned int i=0;i<axes;i++) | ||
ok &= resetEncoder(i); | ||
return ok; | ||
} | ||
|
||
// ----------------------------------------------------------------------------- | ||
|
||
bool roboticslab::RealToSimControlboard::setEncoder(int j, double val) { // encExposed = val; | ||
CD_INFO("\n"); | ||
return true; | ||
} | ||
|
||
// ----------------------------------------------------------------------------- | ||
|
||
bool roboticslab::RealToSimControlboard::setEncoders(const double *vals) { | ||
CD_INFO("\n"); | ||
bool ok = true; | ||
for(unsigned int i=0;i<axes;i++) | ||
ok &= setEncoder(i,vals[i]); | ||
return ok; | ||
} | ||
|
||
// ----------------------------------------------------------------------------- | ||
|
||
bool roboticslab::RealToSimControlboard::getEncoder(int j, double *v) { | ||
//CD_INFO("\n"); //-- Way too verbose | ||
//*v = radToDegIfNotPrismatic(j, vectorOfJointPtr[j]->GetValue(0) ); | ||
|
||
return true; | ||
} | ||
|
||
// ----------------------------------------------------------------------------- | ||
|
||
bool roboticslab::RealToSimControlboard::getEncoders(double *encs) { | ||
//CD_INFO("\n"); //-- Way too verbose | ||
bool ok = true; | ||
for(unsigned int i=0;i<axes;i++) | ||
ok &= getEncoder(i,&encs[i]); | ||
return ok; | ||
} | ||
|
||
// ----------------------------------------------------------------------------- | ||
|
||
bool roboticslab::RealToSimControlboard::getEncoderSpeed(int j, double *sp) { | ||
//CD_INFO("\n"); //-- Way too verbose | ||
// Make it easy, give the current reference speed. | ||
*sp = 0; // begins to look like we should use semaphores. | ||
return true; | ||
} | ||
|
||
// ----------------------------------------------------------------------------- | ||
|
||
bool roboticslab::RealToSimControlboard::getEncoderSpeeds(double *spds) { | ||
//CD_INFO("\n"); //-- Way too verbose | ||
bool ok = true; | ||
for(unsigned int i=0;i<axes;i++) | ||
ok &= getEncoderSpeed(i,&spds[i]); | ||
return ok; | ||
} | ||
|
||
// ----------------------------------------------------------------------------- | ||
|
||
bool roboticslab::RealToSimControlboard::getEncoderAcceleration(int j, double *spds) { | ||
//CD_INFO("\n"); //-- Way too verbose | ||
return false; | ||
} | ||
|
||
// ----------------------------------------------------------------------------- | ||
|
||
bool roboticslab::RealToSimControlboard::getEncoderAccelerations(double *accs) { | ||
//CD_INFO("\n"); //-- Way too verbose | ||
return false; | ||
} | ||
|
||
// ----------------------------------------------------------------------------- | ||
|
||
|
Oops, something went wrong.