Skip to content
Snippets Groups Projects
Commit 6d203d3a authored by Raphael's avatar Raphael
Browse files

added basic structure and implementation for the new controller setup

parent 079328aa
No related branches found
No related tags found
No related merge requests found
Showing
with 946 additions and 2 deletions
......@@ -35,10 +35,11 @@ set(SLICE_FILES
units/UnitInterface.ice
units/ATINetFTUnit.ice
components/ViewSelectionInterface.ice
visualization/DebugDrawerInterface.ice
libraries/Controllers/LVL1Controller.ice
)
#core/RobotIK.ice
......
/*
* This file is part of ArmarX.
*
* ArmarX is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* ArmarX is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package RobotAPI::LVL1ControllerInterface
* @author Raphael Grimm ( raphael dot grimm at student dot kit dot edu )
* @date 2017
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
* GNU General Public License
*/
module armarx
{
class LVL1ControllerConfig
{
};
class LVL1ControllerInterface
{
};
};
add_subdirectory(core)
add_subdirectory(widgets)
add_subdirectory(Controllers)
armarx_component_set_name("Controllers")
armarx_set_target("Library: Controllers")
set(LIB_NAME Controllers)
#find_package(MyLib QUIET)
#armarx_build_if(MyLib_FOUND "MyLib not available")
#
# all include_directories must be guarded by if(Xyz_FOUND)
# for multiple libraries write: if(X_FOUND AND Y_FOUND)....
#if(MyLib_FOUND)
# include_directories(${MyLib_INCLUDE_DIRS})
#endif()
set(LIBS
ArmarXCoreInterfaces
ArmarXCore
RobotAPIInterfaces
)
set(LIB_FILES
SyntaxCheck.cpp
LVL0Controller.cpp
LVL1Controller.cpp
)
set(LIB_HEADERS
Constatnts.h
Targets/JointTargetBase.h
Targets/JointPositionTarget.h
Targets/JointVelocityTarget.h
Targets/JointPositionVelocityTarget.h
Targets/JointTorqueTarget.h
DataUnits/ForceTorqueDataUnit.h
DataUnits/HapticDataUnit.h
DataUnits/IMUDataUnit.h
DataUnits/KinematicDataUnit.h
DataUnits/PlatformDataUnit.h
LVL0Controller.h
LVL1Controller.h
)
armarx_add_library("${LIB_NAME}" "${LIB_FILES}" "${LIB_HEADERS}" "${LIBS}")
/*
* This file is part of ArmarX.
*
* ArmarX is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* ArmarX is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package RobotAPI
* @author Raphael ( ufdrv at student dot kit dot edu )
* @date 2017
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
* GNU General Public License
*/
#ifndef _ARMARX_LIB_RobotAPI_ControllerConstatns_H
#define _ARMARX_LIB_RobotAPI_ControllerConstatns_H
#include <cmath>
#include <string>
namespace armarx
{
namespace ControllerConstatns
{
const float ValueNotSetNaN = std::nanf(std::to_string((1 << 16) - 1).c_str());
}
}
#endif
/*
* This file is part of ArmarX.
*
* ArmarX is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* ArmarX is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package RobotAPI::ArmarXObjects::ForceTorqueDataUnit
* @author Raphael ( ufdrv at student dot kit dot edu )
* @date 2017
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
* GNU General Public License
*/
#ifndef _ARMARX_LIB_RobotAPI_ForceTorqueDataUnit_H
#define _ARMARX_LIB_RobotAPI_ForceTorqueDataUnit_H
namespace armarx
{
class ForceTorqueDataUnit
{
};
}
#endif
/*
* This file is part of ArmarX.
*
* ArmarX is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* ArmarX is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package RobotAPI::ArmarXObjects::HapticDataUnit
* @author Raphael ( ufdrv at student dot kit dot edu )
* @date 2017
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
* GNU General Public License
*/
#ifndef _ARMARX_LIB_RobotAPI_HapticDataUnit_H
#define _ARMARX_LIB_RobotAPI_HapticDataUnit_H
namespace armarx
{
class HapticDataUnit
{
};
}
#endif
/*
* This file is part of ArmarX.
*
* ArmarX is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* ArmarX is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package RobotAPI::ArmarXObjects::IMUDataUnit
* @author Raphael ( ufdrv at student dot kit dot edu )
* @date 2017
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
* GNU General Public License
*/
#ifndef _ARMARX_LIB_RobotAPI_IMUDataUnit_H
#define _ARMARX_LIB_RobotAPI_IMUDataUnit_H
namespace armarx
{
class IMUDataUnit
{
};
}
#endif
/*
* This file is part of ArmarX.
*
* ArmarX is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* ArmarX is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package RobotAPI::ArmarXObjects::KinematicDataUnit
* @author Raphael ( ufdrv at student dot kit dot edu )
* @date 2017
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
* GNU General Public License
*/
#ifndef _ARMARX_LIB_RobotAPI_KinematicDataUnit_H
#define _ARMARX_LIB_RobotAPI_KinematicDataUnit_H
#include <vector>
#include <string>
#include <unordered_map>
#include <algorithm>
#include "../Constatnts.h"
namespace armarx
{
class KinematicDataUnit
{
template<class T>
static std::unordered_map<T, std::size_t> toInexMap(const std::vector<T>& vec)
{
std::unordered_map<T, std::size_t> result;
result.reserve(vec.size());
for (std::size_t i = 0; i < vec.size(); ++i)
{
auto emplacement = result.emplace(vec.at(i), i).second;
if (!emplacement)
{
throw std::invalid_argument {"The given vector did not contain unique elements!"};
}
}
return result;
}
public:
KinematicDataUnit(const std::vector<std::string>& jointNames):
jointAngles(jointNames.size(), ControllerConstatns::ValueNotSetNaN),
jointVelocites(jointNames.size(), ControllerConstatns::ValueNotSetNaN),
jointTorques(jointNames.size(), ControllerConstatns::ValueNotSetNaN),
jointCurrents(jointNames.size(), ControllerConstatns::ValueNotSetNaN),
jointMotorTemperatures(jointNames.size(), ControllerConstatns::ValueNotSetNaN),
jointGearTempertures(jointNames.size(), ControllerConstatns::ValueNotSetNaN),
jointNames {jointNames},
jointIndices {toInexMap(jointNames)}
{}
KinematicDataUnit() = default;
KinematicDataUnit(const KinematicDataUnit&) = default;
const std::vector<std::string>& getJointNames() const
{
return jointNames;
}
std::size_t getJointIndex(const std::string& joint) const
{
return jointIndices.at(joint);
}
virtual std::vector<const float*> getJointAngles(const std::vector<std::string>& joints)const
{
return getPointers(joints, jointAngles);
}
virtual std::vector<const float*> getJointVelocities(const std::vector<std::string>& joints)const
{
return getPointers(joints, jointVelocites);
}
virtual std::vector<const float*> getJointTorques(const std::vector<std::string>& joints)const
{
return getPointers(joints, jointTorques);
}
virtual std::vector<const float*> getJointCurrents(const std::vector<std::string>& joints)const
{
return getPointers(joints, jointCurrents);
}
virtual std::vector<const float*> getJointMotorTemperatures(const std::vector<std::string>& joints)const
{
return getPointers(joints, jointMotorTemperatures);
}
virtual std::vector<const float*> getJointGearTemperatures(const std::vector<std::string>& joints)const
{
return getPointers(joints, jointGearTempertures);
}
protected:
std::vector<float> jointAngles;
std::vector<float> jointVelocites;
std::vector<float> jointTorques;
std::vector<float> jointCurrents;
std::vector<float> jointMotorTemperatures;
std::vector<float> jointGearTempertures;
private:
template<class T>
std::vector<const T*> getPointers(const std::vector<std::string>& joints, const std::vector<T>& targets) const
{
std::vector<const T*> result;
result.resize(joints.size());
std::transform(
joints.begin(), joints.end(), std::back_inserter(result),
[targets, this](const std::string & joint)
{
return &targets.at(getJointIndex(joint));
}
);
return result;
}
const std::vector<std::string> jointNames;
const std::unordered_map<std::string, std::size_t> jointIndices;
};
}
#endif
/*
* This file is part of ArmarX.
*
* ArmarX is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* ArmarX is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package RobotAPI::ArmarXObjects::PlatformDataUnit
* @author Raphael ( ufdrv at student dot kit dot edu )
* @date 2017
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
* GNU General Public License
*/
#ifndef _ARMARX_LIB_RobotAPI_PlatformDataUnit_H
#define _ARMARX_LIB_RobotAPI_PlatformDataUnit_H
#include "../Constatnts.h"
namespace armarx
{
class PlatformDataUnit
{
public:
const float* getPositionX() const
{
return &positionX;
}
const float* getPositionY() const
{
return &positionY;
}
const float* getRotation() const
{
return &rotation;
}
const float* getVelocityX() const
{
return &velocityX;
}
const float* getVelocityY() const
{
return &velocityY;
}
const float* getVelocityRotation() const
{
return &velocityRotation;
}
protected:
float positionX = ControllerConstatns::ValueNotSetNaN;
float positionY = ControllerConstatns::ValueNotSetNaN;
float rotation = ControllerConstatns::ValueNotSetNaN;
float velocityX = ControllerConstatns::ValueNotSetNaN;
float velocityY = ControllerConstatns::ValueNotSetNaN;
float velocityRotation = ControllerConstatns::ValueNotSetNaN;
};
}
#endif
/*
* This file is part of ArmarX.
*
* ArmarX is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* ArmarX is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package RobotAPI::ArmarXObjects::LVL0Controller
* @author Raphael ( ufdrv at student dot kit dot edu )
* @date 2017
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
* GNU General Public License
*/
#include "LVL0Controller.h"
using namespace armarx;
/*
* This file is part of ArmarX.
*
* ArmarX is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* ArmarX is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package RobotAPI::ArmarXObjects::LVL0Controller
* @author Raphael ( ufdrv at student dot kit dot edu )
* @date 2017
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
* GNU General Public License
*/
#ifndef _ARMARX_LIB_RobotAPI_LVL0Controller_H
#define _ARMARX_LIB_RobotAPI_LVL0Controller_H
#include <stdexcept>
namespace armarx
{
/**
* @defgroup Library-Controllers Controllers
* @ingroup RobotAPI
* A description of the library Controllers.
*
* @class LVL0Controller
* @ingroup Library-Controllers
* @brief Brief description of class LVL0Controller.
*
* Detailed description of class LVL0Controller.
*/
template<class TargetT>
class LVL0Controller
{
public:
using TargetType = TargetT;
LVL0Controller()
{
resetTarget();
}
TargetType* getTarget()
{
return target;
}
void resetTarget()
{
target.reset();
}
void run()
{
if (!target.valid())
{
throw std::logic_error {"LVL0 Controller failed! Target is invalid"};
}
writeTarget();
resetTarget();
}
/**
* @brief This function needs to be implemented for a LVL0Controller.
* It sends the command to the robot (or writes it in its send buffer).
*/
void writeTarget() = 0;
private:
TargetType target;
};
}
#endif
/*
* This file is part of ArmarX.
*
* ArmarX is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* ArmarX is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package RobotAPI::ArmarXObjects::LVL1Controller
* @author Raphael ( ufdrv at student dot kit dot edu )
* @date 2017
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
* GNU General Public License
*/
#include "LVL1Controller.h"
using namespace armarx;
/*
* This file is part of ArmarX.
*
* ArmarX is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* ArmarX is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package RobotAPI::ArmarXObjects::LVL1Controller
* @author Raphael ( ufdrv at student dot kit dot edu )
* @date 2017
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
* GNU General Public License
*/
#ifndef _ARMARX_LIB_RobotAPI_LVL1Controller_H
#define _ARMARX_LIB_RobotAPI_LVL1Controller_H
#include <map>
#include <RobotAPI/interface/units/KinematicUnitInterface.h>
#include "Targets/JointTargetBase.h"
namespace armarx
{
/**
* @defgroup Library-Controllers Controllers
* @ingroup RobotAPI
* A description of the library Controllers.
*
* @class LVL1Controller
* @ingroup Library-Controllers
* @brief Brief description of class LVL1Controller.
*
* Detailed description of class LVL1Controller.
*/
class LVL1Controller
{
public:
LVL1Controller(/*string instanceName, RobotUnitPtr robotUnit, ControllerConfig config*/);
virtual void run() = 0;
virtual std::map<std::string, ControlMode> getJointTargetDefinitions() = 0;
virtual void setJointTargetPtrs(std::vector<JointTargetBase*> ptrs) = 0;
};
}
#endif
/*
* This file is part of ArmarX.
*
* ArmarX is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* ArmarX is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package RobotAPI
* @author Raphael ( ufdrv at student dot kit dot edu )
* @date 2017
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
* GNU General Public License
*/
#include "Constatnts.h"
#include "LVL0Controller.h"
#include "LVL1Controller.h"
#include "DataUnits/ForceTorqueDataUnit.h"
#include "DataUnits/HapticDataUnit.h"
#include "DataUnits/IMUDataUnit.h"
#include "DataUnits/KinematicDataUnit.h"
#include "DataUnits/PlatformDataUnit.h"
#include "Targets/JointPositionTarget.h"
#include "Targets/JointPositionVelocityTarget.h"
#include "Targets/JointTargetBase.h"
#include "Targets/JointTorqueTarget.h"
#include "Targets/JointVelocityTarget.h"
/*
* This file is part of ArmarX.
*
* ArmarX is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* ArmarX is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package RobotAPI::ArmarXObjects::JointPositionTarget
* @author Raphael ( ufdrv at student dot kit dot edu )
* @date 2017
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
* GNU General Public License
*/
#ifndef _ARMARX_LIB_RobotAPI_JointPositionTarget_H
#define _ARMARX_LIB_RobotAPI_JointPositionTarget_H
#include "JointTargetBase.h"
namespace armarx
{
/**
* @defgroup Library-Controllers Controllers
* @ingroup RobotAPI
* A description of the library Controllers.
*
* @class JointPositionTarget
* @ingroup Library-Controllers
* @brief Brief description of class JointPositionTarget.
*
* Detailed description of class JointPositionTarget.
*/
class JointPositionTarget: public JointTargetBase
{
public:
float position = ControllerConstatns::ValueNotSetNaN;
virtual ControlMode getType() const override
{
return ePositionControl;
}
virtual void reset()
{
position = ControllerConstatns::ValueNotSetNaN;
}
bool isValid() const
{
return std::isfinite(position);
}
};
}
#endif
/*
* This file is part of ArmarX.
*
* ArmarX is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* ArmarX is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package RobotAPI::ArmarXObjects::JointPositionVelocityTarget
* @author Raphael ( ufdrv at student dot kit dot edu )
* @date 2017
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
* GNU General Public License
*/
#ifndef _ARMARX_LIB_RobotAPI_JointPositionVelocityTarget_H
#define _ARMARX_LIB_RobotAPI_JointPositionVelocityTarget_H
#include "JointTargetBase.h"
namespace armarx
{
/**
* @defgroup Library-Controllers Controllers
* @ingroup RobotAPI
* A description of the library Controllers.
*
* @class JointPositionVelocityTarget
* @ingroup Library-Controllers
* @brief Brief description of class JointPositionVelocityTarget.
*
* Detailed description of class JointPositionVelocityTarget.
*/
class JointPositionVelocityTarget: public JointTargetBase
{
public:
float position = ControllerConstatns::ValueNotSetNaN;
float velocity = ControllerConstatns::ValueNotSetNaN;
virtual ControlMode getType() const override
{
return ePositionVelocityControl;
}
virtual void reset()
{
position = ControllerConstatns::ValueNotSetNaN;
velocity = ControllerConstatns::ValueNotSetNaN;
}
bool isValid() const
{
return std::isfinite(position) && std::isfinite(velocity);
}
};
}
#endif
/*
* This file is part of ArmarX.
*
* ArmarX is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* ArmarX is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package RobotAPI::ArmarXObjects::JointTargetBase
* @author Raphael ( ufdrv at student dot kit dot edu )
* @date 2017
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
* GNU General Public License
*/
#ifndef _ARMARX_LIB_RobotAPI_JointTargetBase_H
#define _ARMARX_LIB_RobotAPI_JointTargetBase_H
#include <RobotAPI/interface/units/KinematicUnitInterface.h>
#include "../Constatnts.h"
namespace armarx
{
/**
* @defgroup Library-Controllers Controllers
* @ingroup RobotAPI
* A description of the library Controllers.
*
* @class JointTargetBase
* @ingroup Library-Controllers
* @brief Brief description of class JointTargetBase.
*
* Detailed description of class JointTargetBase.
*/
class JointTargetBase
{
public:
virtual ControlMode getType() const = 0;
};
}
#endif
/*
* This file is part of ArmarX.
*
* ArmarX is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* ArmarX is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package RobotAPI::ArmarXObjects::JointTorqueTarget
* @author Raphael ( ufdrv at student dot kit dot edu )
* @date 2017
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
* GNU General Public License
*/
#ifndef _ARMARX_LIB_RobotAPI_JointTorqueTarget_H
#define _ARMARX_LIB_RobotAPI_JointTorqueTarget_H
#include "JointTargetBase.h"
namespace armarx
{
/**
* @defgroup Library-Controllers Controllers
* @ingroup RobotAPI
* A description of the library Controllers.
*
* @class JointTorqueTarget
* @ingroup Library-Controllers
* @brief Brief description of class JointTorqueTarget.
*
* Detailed description of class JointTorqueTarget.
*/
class JointTorqueTarget: public JointTargetBase
{
public:
float torque = ControllerConstatns::ValueNotSetNaN;
virtual ControlMode getType() const override
{
return eTorqueControl;
}
virtual void reset()
{
torque = ControllerConstatns::ValueNotSetNaN;
}
bool isValid() const
{
return std::isfinite(torque);
}
};
}
#endif
/*
* This file is part of ArmarX.
*
* ArmarX is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* ArmarX is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package RobotAPI::ArmarXObjects::JointVelocityTarget
* @author Raphael ( ufdrv at student dot kit dot edu )
* @date 2017
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
* GNU General Public License
*/
#ifndef _ARMARX_LIB_RobotAPI_JointVelocityTarget_H
#define _ARMARX_LIB_RobotAPI_JointVelocityTarget_H
#include "JointTargetBase.h"
namespace armarx
{
/**
* @defgroup Library-Controllers Controllers
* @ingroup RobotAPI
* A description of the library Controllers.
*
* @class JointVelocityTarget
* @ingroup Library-Controllers
* @brief Brief description of class JointVelocityTarget.
*
* Detailed description of class JointVelocityTarget.
*/
class JointVelocityTarget: public JointTargetBase
{
public:
float velocity = ControllerConstatns::ValueNotSetNaN;
virtual ControlMode getType() const override
{
return eVelocityControl;
}
virtual void reset()
{
velocity = ControllerConstatns::ValueNotSetNaN;
}
bool isValid() const
{
return std::isfinite(velocity);
}
};
}
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment