Public Types | Public Member Functions | Public Attributes | List of all members
grl::robot::arm::KukaFRIdriver< LowLevelStepAlgorithmType > Class Template Reference

Primary Kuka FRI driver, only talks over realtime network FRI KONI ethernet port. More...

#include <KukaFRIdriver.hpp>

+ Inheritance diagram for grl::robot::arm::KukaFRIdriver< LowLevelStepAlgorithmType >:
+ Collaboration diagram for grl::robot::arm::KukaFRIdriver< LowLevelStepAlgorithmType >:

Public Types

enum  ParamIndex
 
typedef std::tuple< std::string, std::string, std::string, std::string, std::string, ThreadingRunModeParams
 
enum  ThreadingRunMode
 
- Public Types inherited from grl::robot::arm::KukaUDP
enum  ParamIndex {
  RobotModel, localhost, localport, remotehost,
  remoteport, is_running_automatically
}
 
typedef std::tuple< std::string, std::string, std::string, std::string, std::string, ThreadingRunModeParams
 
enum  ThreadingRunMode { run_manually = 0, run_automatically = 1 }
 

Public Member Functions

void construct ()
 
void construct (Params params)
 
KukaState::time_point_type get (time_point_tag)
 Get the timestamp of the most recent armState. More...
 
void get (KukaState &state)
 
KukaState::joint_state getMaxVel ()
 
const ParamsgetParams ()
 
double getSecondsPerTick ()
 
 KukaFRIdriver (Params params=defaultParams())
 
bool run_one ()
 
template<typename Range >
void set (Range &&range, grl::revolute_joint_angle_open_chain_command_tag)
 Set the joint positions for the current interpolation step. More...
 
void set (double duration_to_goal_command, time_duration_command_tag)
 Set the time duration expected between new position commands in ms. More...
 
template<typename Range >
void set (Range &&range, grl::revolute_joint_torque_open_chain_command_tag)
 Set the applied joint torques for the current interpolation step. More...
 
template<typename Range >
void set (Range &&range, grl::cartesian_wrench_command_tag)
 Set the applied wrench vector of the current interpolation step. More...
 
 ~KukaFRIdriver ()
 

Public Attributes

boost::asio::io_service device_driver_io_service
 
std::unique_ptr< boost::asio::io_service::work > device_driver_workP_
 
std::unique_ptr< std::thread > driver_threadP
 
std::shared_ptr< grl::robot::arm::KukaFRIClientDataDriver< LowLevelStepAlgorithmType > > kukaFRIClientDataDriverP_
 
volatile std::size_t m_attemptedCommunicationConsecutiveFailureCount = 0
 
volatile std::size_t m_attemptedCommunicationConsecutiveSuccessCount = 0
 
volatile std::size_t m_attemptedCommunicationCount = 0
 
volatile std::size_t m_haveReceivedRealDataCount = 0
 

Additional Inherited Members

- Static Public Member Functions inherited from grl::robot::arm::KukaUDP
static void add_details_to_connection_error (boost::exception &e, Params &params)
 
template<typename T >
static boost::asio::ip::udp::socket connect (T &params, boost::asio::io_service &io_service_, boost::asio::ip::udp::endpoint &sender_endpoint)
 Advanced functionality, do not use without a great reason. More...
 
static const Params defaultParams ()
 

Detailed Description

template<typename LowLevelStepAlgorithmType = LinearInterpolation>
class grl::robot::arm::KukaFRIdriver< LowLevelStepAlgorithmType >

Primary Kuka FRI driver, only talks over realtime network FRI KONI ethernet port.

Note
If you aren't sure, see KukaDriver in KukaDriver.hpp.
If you want to change how the lowest level high rate updates are performed, make another version of this class.
See also
KukaFRIdriver

KukaFRIdriver is a low level driver at a slightly "higher level" than the the "lowest level" KukaFRIClientDataDriver to communicate. This is the class you will want to replace if you want to change how low level position updates are changed between FRI update steps, which occur at a configurable duration of 1-5 ms.

For position based motion to work, you must set both the position you want and the time you want it to get there. This is required because the robot can move extremely fast, so accidentally setting the velocity to the max is very dangerous. If the time point is in the past, the robot will not move. If the time point is too near in the future to make it, the robot will move at the max speed towards that position.

While velocity limits are not provided explicitly by KUKA in their low level C++ API, if you send a command that violates the velocity limits specified in KUKA's documenation the arm stops immediately with an error, even over FRI.

Todo:

support generic read/write

ensure commands stay within machine limits to avoid lockup

reset and resume if lockup occurs whenever possible

in classes that use this driver, make the use of this class templated so that the low level update algorithm can change.

add getter for number of milliseconds between fri updates (1-5) aka sync_period aka send_period aka ms per tick

Definition at line 870 of file KukaFRIdriver.hpp.

Member Typedef Documentation

§ Params

template<typename LowLevelStepAlgorithmType = LinearInterpolation>
typedef std::tuple<std::string, std::string, std::string, std::string, std::string, ThreadingRunMode> grl::robot::arm::KukaUDP::Params

Definition at line 207 of file Kuka.hpp.

Member Enumeration Documentation

§ ParamIndex

template<typename LowLevelStepAlgorithmType = LinearInterpolation>
enum grl::robot::arm::KukaUDP::ParamIndex

Definition at line 192 of file Kuka.hpp.

§ ThreadingRunMode

template<typename LowLevelStepAlgorithmType = LinearInterpolation>
enum grl::robot::arm::KukaUDP::ThreadingRunMode

Definition at line 203 of file Kuka.hpp.

Constructor & Destructor Documentation

§ KukaFRIdriver()

template<typename LowLevelStepAlgorithmType = LinearInterpolation>
grl::robot::arm::KukaFRIdriver< LowLevelStepAlgorithmType >::KukaFRIdriver ( Params  params = defaultParams())
inline

Definition at line 880 of file KukaFRIdriver.hpp.

§ ~KukaFRIdriver()

template<typename LowLevelStepAlgorithmType = LinearInterpolation>
grl::robot::arm::KukaFRIdriver< LowLevelStepAlgorithmType >::~KukaFRIdriver ( )
inline

Definition at line 919 of file KukaFRIdriver.hpp.

Member Function Documentation

§ construct() [1/2]

template<typename LowLevelStepAlgorithmType = LinearInterpolation>
void grl::robot::arm::KukaFRIdriver< LowLevelStepAlgorithmType >::construct ( )
inline

Definition at line 889 of file KukaFRIdriver.hpp.

§ construct() [2/2]

template<typename LowLevelStepAlgorithmType = LinearInterpolation>
void grl::robot::arm::KukaFRIdriver< LowLevelStepAlgorithmType >::construct ( Params  params)
inline
Todo:
create a function that calls simGetObjectHandle and throws an exception when it fails
Warning
getting the ik group is optional, so it does not throw an exception

Definition at line 895 of file KukaFRIdriver.hpp.

§ get() [1/2]

template<typename LowLevelStepAlgorithmType = LinearInterpolation>
KukaState::time_point_type grl::robot::arm::KukaFRIdriver< LowLevelStepAlgorithmType >::get ( time_point_tag  )
inline

Get the timestamp of the most recent armState.

See also
KukaFRIdriver::set(Range&& range, grl::revolute_joint_angle_open_chain_command_tag)

Definition at line 1172 of file KukaFRIdriver.hpp.

§ get() [2/2]

template<typename LowLevelStepAlgorithmType = LinearInterpolation>
void grl::robot::arm::KukaFRIdriver< LowLevelStepAlgorithmType >::get ( KukaState state)
inline
Todo:
should this exist? is it written correctly?

Definition at line 1230 of file KukaFRIdriver.hpp.

§ getMaxVel()

template<typename LowLevelStepAlgorithmType = LinearInterpolation>
KukaState::joint_state grl::robot::arm::KukaFRIdriver< LowLevelStepAlgorithmType >::getMaxVel ( )
inline
Todo:
make this configurable for different specific robots. Currently set for kuka lbr iiwa 14kg R820

get max velocity constraint parameter for this robot model

Definition at line 939 of file KukaFRIdriver.hpp.

§ getParams()

template<typename LowLevelStepAlgorithmType = LinearInterpolation>
const Params& grl::robot::arm::KukaFRIdriver< LowLevelStepAlgorithmType >::getParams ( )
inline

Definition at line 917 of file KukaFRIdriver.hpp.

§ getSecondsPerTick()

template<typename LowLevelStepAlgorithmType = LinearInterpolation>
double grl::robot::arm::KukaFRIdriver< LowLevelStepAlgorithmType >::getSecondsPerTick ( )
inline

gets the number of seconds in one message exchange "tick" aka "cycle", "time step"

Definition at line 930 of file KukaFRIdriver.hpp.

§ run_one()

template<typename LowLevelStepAlgorithmType = LinearInterpolation>
bool grl::robot::arm::KukaFRIdriver< LowLevelStepAlgorithmType >::run_one ( )
inline

spin once, this is what you call each time you synchronize the client with the robot over UDP it is expected to be called at least once per send_period_millisec, which is the time between each FRI udp packet.

Todo:
use runtime calculation of NUM_JOINTS instead of constant
Todo:
probably only need to set this once
Todo:
construct new low level command object and pass to KukaFRIClientDataDriver this is where we used to setup a new FRI command
         grl::robot::arm::copy(friData_->monitoringMsg,

std::back_inserter(armState.commandedPosition), grl::revolute_joint_angle_open_chain_command_tag());

         grl::robot::arm::copy(friData_->monitoringMsg,

std::back_inserter(armState.commandedTorque) , grl::revolute_joint_torque_open_chain_command_tag());

Todo:
should the results of getlatest state even be possible to call without receiving real data? should the library change?

Definition at line 963 of file KukaFRIdriver.hpp.

§ set() [1/4]

template<typename LowLevelStepAlgorithmType = LinearInterpolation>
template<typename Range >
void grl::robot::arm::KukaFRIdriver< LowLevelStepAlgorithmType >::set ( Range &&  range,
grl::revolute_joint_angle_open_chain_command_tag   
)
inline

Set the joint positions for the current interpolation step.

This method is only effective when the robot is in a commanding state and the set time point for reaching the destination is in the future. This function sets the goal time point for a motion to the epoch, aka "time 0" (which is in the past) for safety.

For position based motion to work, you must set both the position you want and the time you want it to get there. This is required because the robot can move extremely fast, so accidentally setting the velocity to the max is very dangerous. If the time point is in the past, the robot will not move. If the time point is too near in the future to make it, the robot will move at the max speed towards that position.

See also
KukaFRIdriver::set(TimePoint && time, time_point_command_tag) to set the destination time point in the future so the position motion can start.
Parameters
stateObject which stores the current state of the robot, including the command to send next
rangeArray with the new joint positions (in radians)
tagidentifier object indicating that revolute joint angle commands should be modified

Definition at line 1131 of file KukaFRIdriver.hpp.

§ set() [2/4]

template<typename LowLevelStepAlgorithmType = LinearInterpolation>
void grl::robot::arm::KukaFRIdriver< LowLevelStepAlgorithmType >::set ( double  duration_to_goal_command,
time_duration_command_tag   
)
inline

Set the time duration expected between new position commands in ms.

The driver will likely be updated every so often, such as every 25ms, and the lowest level of the driver may update even more frequently, such as every 1ms. By providing as accurate an estimate between high level updates the low level driver can smooth out the motion through interpolation (the default), or another algorithm. See LowLevelStepAlgorithmType template parameter in the KukaFRIdriver class if you want to change out the low level algorithm.

See also
KukaFRIdriver::get(time_duration_command_tag)
Parameters
duration_to_goal_commandstd::chrono time format representing the time duration between updates

Definition at line 1158 of file KukaFRIdriver.hpp.

§ set() [3/4]

template<typename LowLevelStepAlgorithmType = LinearInterpolation>
template<typename Range >
void grl::robot::arm::KukaFRIdriver< LowLevelStepAlgorithmType >::set ( Range &&  range,
grl::revolute_joint_torque_open_chain_command_tag   
)
inline

Set the applied joint torques for the current interpolation step.

This method is only effective when the client is in a commanding state. The ControlMode of the robot has to be joint impedance control mode. The Client Command Mode has to be torque.

Parameters
stateObject which stores the current state of the robot, including the command to send next
torquesArray with the applied torque values (in Nm)
tagidentifier object indicating that the torqe value command should be modified

Definition at line 1191 of file KukaFRIdriver.hpp.

§ set() [4/4]

template<typename LowLevelStepAlgorithmType = LinearInterpolation>
template<typename Range >
void grl::robot::arm::KukaFRIdriver< LowLevelStepAlgorithmType >::set ( Range &&  range,
grl::cartesian_wrench_command_tag   
)
inline

Set the applied wrench vector of the current interpolation step.

The wrench vector consists of: [F_x, F_y, F_z, tau_A, tau_B, tau_C]

F ... forces (in N) applied along the Cartesian axes of the currently used motion center. tau ... torques (in Nm) applied along the orientation angles (Euler angles A, B, C) of the currently used motion center.

This method is only effective when the client is in a commanding state. The ControlMode of the robot has to be Cartesian impedance control mode. The Client Command Mode has to be wrench.

Parameters
stateobject storing the command data that will be sent to the physical device
rangewrench Applied Cartesian wrench vector, in x, y, z, roll, pitch, yaw force measurments.
tagidentifier object indicating that the wrench value command should be modified
Todo:
perhaps support some specific more useful data layouts

Definition at line 1223 of file KukaFRIdriver.hpp.

Member Data Documentation

§ device_driver_io_service

template<typename LowLevelStepAlgorithmType = LinearInterpolation>
boost::asio::io_service grl::robot::arm::KukaFRIdriver< LowLevelStepAlgorithmType >::device_driver_io_service

Definition at line 1251 of file KukaFRIdriver.hpp.

§ device_driver_workP_

template<typename LowLevelStepAlgorithmType = LinearInterpolation>
std::unique_ptr<boost::asio::io_service::work> grl::robot::arm::KukaFRIdriver< LowLevelStepAlgorithmType >::device_driver_workP_

Definition at line 1252 of file KukaFRIdriver.hpp.

§ driver_threadP

template<typename LowLevelStepAlgorithmType = LinearInterpolation>
std::unique_ptr<std::thread> grl::robot::arm::KukaFRIdriver< LowLevelStepAlgorithmType >::driver_threadP

Definition at line 1253 of file KukaFRIdriver.hpp.

§ kukaFRIClientDataDriverP_

template<typename LowLevelStepAlgorithmType = LinearInterpolation>
std::shared_ptr< grl::robot::arm::KukaFRIClientDataDriver<LowLevelStepAlgorithmType> > grl::robot::arm::KukaFRIdriver< LowLevelStepAlgorithmType >::kukaFRIClientDataDriverP_

Definition at line 1256 of file KukaFRIdriver.hpp.

§ m_attemptedCommunicationConsecutiveFailureCount

template<typename LowLevelStepAlgorithmType = LinearInterpolation>
volatile std::size_t grl::robot::arm::KukaFRIdriver< LowLevelStepAlgorithmType >::m_attemptedCommunicationConsecutiveFailureCount = 0

Definition at line 1246 of file KukaFRIdriver.hpp.

§ m_attemptedCommunicationConsecutiveSuccessCount

template<typename LowLevelStepAlgorithmType = LinearInterpolation>
volatile std::size_t grl::robot::arm::KukaFRIdriver< LowLevelStepAlgorithmType >::m_attemptedCommunicationConsecutiveSuccessCount = 0

Definition at line 1249 of file KukaFRIdriver.hpp.

§ m_attemptedCommunicationCount

template<typename LowLevelStepAlgorithmType = LinearInterpolation>
volatile std::size_t grl::robot::arm::KukaFRIdriver< LowLevelStepAlgorithmType >::m_attemptedCommunicationCount = 0

Definition at line 1243 of file KukaFRIdriver.hpp.

§ m_haveReceivedRealDataCount

template<typename LowLevelStepAlgorithmType = LinearInterpolation>
volatile std::size_t grl::robot::arm::KukaFRIdriver< LowLevelStepAlgorithmType >::m_haveReceivedRealDataCount = 0

Definition at line 1238 of file KukaFRIdriver.hpp.


The documentation for this class was generated from the following file: