KukaJAVAdriver.hpp
Go to the documentation of this file.
1 #ifndef GRL_KUKA_JAVA_DRIVER
2 #define GRL_KUKA_JAVA_DRIVER
3 
4 #include <iostream>
5 #include <chrono>
6 #include <ratio>
7 #include <thread>
8 
9 #include <tuple>
10 #include <memory>
11 #include <thread>
12 #include <boost/asio.hpp>
13 #include <boost/circular_buffer.hpp>
14 #include <boost/exception/all.hpp>
15 #include <boost/config.hpp>
16 #include <boost/lexical_cast.hpp>
17 
18 #include <boost/range/algorithm/copy.hpp>
19 #include <boost/range/algorithm/transform.hpp>
20 #include <boost/chrono/include.hpp>
21 #include <boost/chrono/duration.hpp>
22 
23 #include <unistd.h>
24 #include <sys/types.h>
25 #include <sys/socket.h>
26 #include <sys/time.h>
27 #include <sys/select.h>
28 #include <netinet/in.h>
29 #include <netdb.h>
30 #include <errno.h>
31 
32 #ifdef BOOST_NO_CXX11_ATOMIC_SMART_PTR
33 #include <boost/thread.hpp>
34 #endif
35 
36 #include "grl/tags.hpp"
37 #include "grl/exception.hpp"
38 #include "grl/kuka/Kuka.hpp"
39 
43 
44 
45 /// @todo move elsewhere, because it will conflict with others' implementations of outputting vectors
46 template<typename T>
47 inline std::ostream& operator<<(std::ostream& out, std::vector<T>& v)
48 {
49  out << "[";
50  size_t last = v.size() - 1;
51  for(size_t i = 0; i < v.size(); ++i) {
52  out << v[i];
53  if (i != last)
54  out << ", ";
55  }
56  out << "]";
57  return out;
58 }
59 
60 
61 /// @todo move elsewhere, because it will conflict with others' implementations of outputting vectors
62 template<typename T, std::size_t U>
63 inline std::ostream& operator<<(std::ostream& out, boost::container::static_vector<T,U>& v)
64 {
65  out << "[";
66  size_t last = v.size() - 1;
67  for(size_t i = 0; i < v.size(); ++i) {
68  out << v[i];
69  if (i != last)
70  out << ", ";
71  }
72  out << "]";
73  return out;
74 }
75 
76 
77 namespace grl { namespace robot { namespace arm {
78 
79 
80  /**
81  *
82  * This class contains code to offer a simple communication layer between ROS and the KUKA LBR iiwa
83  *
84  * Initally:
85  *
86  *
87  * @todo make sure mutex is locked when appropriate
88  *
89  */
90  class KukaJAVAdriver : public std::enable_shared_from_this<KukaJAVAdriver> {
91  public:
92 
93  enum ParamIndex {
105  };
106 
107  typedef std::tuple<
108  std::string,
109  std::string,
110  std::string,
111  std::string,
112  std::string,
113  std::string,
114  std::string,
115  std::string,
116  std::string,
117  std::string,
118  std::string
120 
121 
122  static const Params defaultParams(){
123  return std::make_tuple(
124  "Robotiiwa" , // RobotName,
125  "KUKA_LBR_IIWA_14_R820" , // RobotModel (options are KUKA_LBR_IIWA_14_R820, KUKA_LBR_IIWA_7_R800)
126  "0.0.0.0" , // LocalUDPAddress
127  "30010" , // LocalUDPPort
128  "172.31.1.147" , // RemoteUDPAddress
129  "192.170.10.100" , // LocalHostKukaKoniUDPAddress,
130  "30200" , // LocalHostKukaKoniUDPPort,
131  "192.170.10.2" , // RemoteHostKukaKoniUDPAddress,
132  "30200" , // RemoteHostKukaKoniUDPPort
133  "JAVA" , // KukaCommandMode (options are FRI, JAVA)
134  "FRI" // KukaMonitorMode (options are FRI, JAVA)
135  );
136  }
137 
138 
139  /// unique tag type so State never
140  /// conflicts with a similar tuple
141  struct JointStateTag{};
142 
151  };
152 
153 
154  typedef std::vector<double> JointScalar;
155 
156  /// @see http://www.coppeliarobotics.com/helpFiles/en/apiFunctions.htm#simGetJointMatrix for data layout information
157  typedef std::array<double,12> TransformationMatrix;
158  typedef std::vector<TransformationMatrix> TransformationMatrices;
159 
160  typedef std::tuple<
161  JointScalar, // jointPosition
162  // JointScalar // JointVelocity // no velocity yet
163  JointScalar, // jointForce
164  JointScalar, // jointTargetPosition
165  JointScalar, // JointLowerPositionLimit
166  JointScalar, // JointUpperPositionLimit
167  TransformationMatrices, // jointTransformation
168  JointStateTag // JointStateTag unique identifying type so tuple doesn't conflict
169  > State;
170 
171 
173  : params_(params), armControlMode_(flatbuffer::ArmState::ArmState_NONE)
174  {}
175 
176  void construct(){ construct(params_); sequenceNumber = 0;}
177 
178  /// @todo create a function that calls simGetObjectHandle and throws an exception when it fails
179  /// @warning getting the ik group is optional, so it does not throw an exception
180  void construct(Params params) {
181 
182  params_ = params;
183 
184 
185  try {
186  BOOST_LOG_TRIVIAL(trace) << "KukaLBRiiwaRosPlugin: Connecting UDP Socket from " <<
187  std::get<LocalUDPAddress> (params_) << ":" << std::get<LocalUDPPort> (params_) << " to " <<
188  std::get<RemoteUDPAddress> (params_);
189 
190  /// @todo TODO(ahundt) switch from linux socket to boost::asio::ip::udp::socket, see Kuka.hpp and KukaFRIdriver.hpp for examples, and make use of KukaUDP class.
191  socket_local = socket(AF_INET, SOCK_DGRAM, 0);
192  if (socket_local < 0) {
193  BOOST_THROW_EXCEPTION(std::runtime_error("KukaJAVAdriver Error opening socket. Check that the port is available, and that all the cables are connected tightly. If you have no other options try restarting your computer."));
194  }
195 
196  port = boost::lexical_cast<int>( std::get<LocalUDPPort> (params_));
197  // convert the string to network presentation value
198  inet_pton(AF_INET, std::get<LocalUDPAddress>(params_).c_str(), &(local_sockaddr.sin_addr));
199  local_sockaddr.sin_family = AF_INET;
200  local_sockaddr.sin_port = htons(port);
201  // local_sockaddr.sin_addr.s_addr = INADDR_ANY;
202 
203  /// @todo TODO(ahundt) Consider switching to boost::asio synchronous calls (async has high latency)!
204  /// @todo TODO(ahundt) Need to switch back to an appropriate exception rather than exiting so VREP isn't taken down.
205  /// @todo TODO(ahundt) switch from linux socket to boost::asio::ip::udp::socket, see Kuka.hpp and KukaFRIdriver.hpp for examples, and make use of KukaUDP class.
206  if (bind(socket_local, (struct sockaddr *)&local_sockaddr, sizeof(local_sockaddr)) < 0) {
207  printf("Error binding sr_joint!\n");
208  BOOST_THROW_EXCEPTION(std::runtime_error("KukaJAVAdriver Error opening socket. Check that the port is available, and that all the cables are connected tightly. If you have no other options try restarting your computer."));
209  }
210 
211  FD_ZERO(&mask);
212  FD_ZERO(&dummy_mask);
213  FD_SET(socket_local, &mask);
214 
215 
216  } catch( boost::exception &e) {
217  e << errmsg_info("KukaLBRiiwaRosPlugin: Unable to connect to UDP Socket from " +
218  std::get<LocalUDPAddress> (params_) + " to " +
219  std::get<RemoteUDPAddress> (params_));
220  throw;
221  }
222  }
223 
224 
225 
226 
227  const Params & getParams(){
228  return params_;
229  }
230 
231  /// shuts down the arm
232  bool destruct(){
233  close(socket_local);
234  return true;
235  }
236 
238  /// @todo TODO(ahundt) switch to asio, remove destruct call from destructor
239  destruct();
240  }
241 
242 
243  /// @brief SEND COMMAND TO ARM. Call this often
244  /// Performs the main update spin once.
245  /// @todo ADD SUPPORT FOR READING ARM STATE OVER JAVA INTERFACE
246  bool run_one(){
247 
248  // @todo CHECK FOR REAL DATA BEFORE SENDING COMMANDS
249  //if(!m_haveReceivedRealDataCount) return;
250 
251  bool haveNewData = false;
252 
253  /// @todo make this handled by template driver implementations/extensions
254 
255 
256 
257 
258 
259  std::shared_ptr<flatbuffers::FlatBufferBuilder> fbbP;
260  fbbP = std::make_shared<flatbuffers::FlatBufferBuilder>();
261 
262  boost::lock_guard<boost::mutex> lock(jt_mutex);
263 
264  double duration = boost::chrono::high_resolution_clock::now().time_since_epoch().count();
265 
266  /// @todo is this the best string to pass for the full arm's name?
267  auto basename = std::get<RobotName>(params_);
268 
269  auto bns = fbbP->CreateString(basename);
270 
271  flatbuffers::Offset<flatbuffer::ArmControlState> controlState;
272 
273 
274  switch (armControlMode_) {
275 
277  controlState = flatbuffer::CreateArmControlState(*fbbP,bns,sequenceNumber++,duration,armControlMode_,flatbuffer::CreateStartArm(*fbbP).Union());
278  break;
279  }
281 
282  /// @todo when new
283  auto armPositionBuffer = fbbP->CreateVector(armState_.commandedPosition_goal.data(),armState_.commandedPosition_goal.size());
284  auto commandedTorque = fbbP->CreateVector(armState_.commandedTorque.data(),armState_.commandedTorque.size());
285  auto goalJointState = grl::flatbuffer::CreateJointState(*fbbP,armPositionBuffer,0/*no velocity*/,0/*no acceleration*/,commandedTorque);
286  auto moveArmJointServo = grl::flatbuffer::CreateMoveArmJointServo(*fbbP,goalJointState);
287  controlState = flatbuffer::CreateArmControlState(*fbbP,bns,sequenceNumber++,duration,armControlMode_,moveArmJointServo.Union());
288  std::cout << "\nKukaJAVAdriver sending armposition command:" <<armState_.commandedPosition_goal<<"\n";
289  break;
290  }
292  controlState = flatbuffer::CreateArmControlState(*fbbP,bns,sequenceNumber++,duration,armControlMode_,flatbuffer::CreateTeachArm(*fbbP).Union());
293  break;
294  }
296  controlState = flatbuffer::CreateArmControlState(*fbbP,bns,sequenceNumber++,duration,armControlMode_,flatbuffer::CreatePauseArm(*fbbP).Union());
297  break;
298  }
300  controlState = flatbuffer::CreateArmControlState(*fbbP,bns,sequenceNumber++,duration,armControlMode_,flatbuffer::CreateStopArm(*fbbP).Union());
301  break;
302  }
304  controlState = flatbuffer::CreateArmControlState(*fbbP,bns,sequenceNumber++,duration,armControlMode_,flatbuffer::CreateStopArm(*fbbP).Union());
305  break;
306  }
308  //std::cerr << "Waiting for interation mode... (currently NONE)\n";
309  break;
310  }
311  default:
312  std::cerr << "KukaJAVAdriver unsupported use case: " << armControlMode_ << "\n";
313  }
314 
315  auto name = fbbP->CreateString(std::get<RobotName>(params_));
316 
317  auto kukaiiwaArmConfiguration = flatbuffer::CreateKUKAiiwaArmConfiguration(*fbbP,name,commandInterface_,monitorInterface_);
318 
319  auto kukaiiwastate = flatbuffer::CreateKUKAiiwaState(*fbbP,0,0,0,0,1,controlState,1,kukaiiwaArmConfiguration);
320 
321  auto kukaiiwaStateVec = fbbP->CreateVector(&kukaiiwastate, 1);
322 
323  auto states = flatbuffer::CreateKUKAiiwaStates(*fbbP,kukaiiwaStateVec);
324 
326 
327  flatbuffers::Verifier verifier(fbbP->GetBufferPointer(),fbbP->GetSize());
328  BOOST_VERIFY(grl::flatbuffer::VerifyKUKAiiwaStatesBuffer(verifier));
329 
330 
332  {
333  auto states2 = flatbuffer::GetKUKAiiwaStates(fbbP->GetBufferPointer());
334  auto movearm = static_cast<const flatbuffer::MoveArmJointServo*>(states2->states()->Get(0)->armControlState()->state());
335  std::cout << "re-extracted " << movearm->goal()->position()->size() << " joint angles: ";
336  for(std::size_t i = 0; i < movearm->goal()->position()->size(); ++i)
337  {
338  std::cout << i << "=" << movearm->goal()->position()->Get(i) << ", ";
339  }
340  std::cout << "\n";
341  }
342 
343  int ret;
344  // Send UDP packet to Robot
345  ret = sendto(socket_local, fbbP->GetBufferPointer(), fbbP->GetSize(), 0, (struct sockaddr *)&dst_sockaddr, sizeof(dst_sockaddr));
346 
347  if (static_cast<long>(ret) != static_cast<long>(fbbP->GetSize())) printf("Error sending packet to KUKA iiwa: ret = %d, len = %u\n", ret, fbbP->GetSize());
348 
349 
350  // Receiving data from Sunrise
351 
352  int num;
353  temp_mask = mask;
354 
355  // tv is the time that you wait for a new message to arrive,
356  // since we don't wont to hinder the execution of each cycle, it is set to zero...
357  // (The FRI interface read rate is much higher than the data coming for the controller, so we don't wait for controller data)
358  struct timeval tv;
359  tv.tv_sec = 0;
360  tv.tv_usec = 0;
361 
362  // Check to see if any packets are available with waiting time of 0
363  // Please note that with this configuration some packets may be dropped.
364  /// @todo TODO(ahundt) eventually run this in a separate thread so we can receive packets asap and minimize dropping
365  num = select(FD_SETSIZE, &temp_mask, &dummy_mask, &dummy_mask, &tv);
366 
367  if (num > 0)
368  {
369  // packets are available, process them
370  if (FD_ISSET(socket_local, &temp_mask))
371  {
372  static const std::size_t udp_size = 1400;
373  unsigned char recbuf[udp_size];
374  static const int flags = 0;
375 
376  ret = recvfrom(socket_local, recbuf, sizeof(recbuf), flags, (struct sockaddr *)&dst_sockaddr, &dst_sockaddr_len);
377  if (ret <= 0) printf("Receive Error: ret = %d\n", ret);
378 
379  if (ret > 0){
380 
381  if(debug_) std::cout << "received message size: " << ret << "\n";
382 
383 
384  auto rbPstart = static_cast<const uint8_t *>(recbuf);
385 
386  auto verifier = flatbuffers::Verifier(rbPstart, ret);
387  auto bufOK = grl::flatbuffer::VerifyKUKAiiwaStatesBuffer(verifier);
388 
389  // Flatbuffer has been verified as valid
390  if (bufOK) {
391  // only reading the wrench data currently
392  auto bufff = static_cast<const void *>(rbPstart);
393  if(debug_) std::cout << "Succeeded in verification. " << "\n";
394 
395  auto fbKUKAiiwaStates = grl::flatbuffer::GetKUKAiiwaStates(bufff);
396  auto wrench = fbKUKAiiwaStates->states()->Get(0)->monitorState()->CartesianWrench();
397 
398  armState_.wrenchJava.clear();
399  armState_.wrenchJava.push_back(wrench->force().x());
400  armState_.wrenchJava.push_back(wrench->force().y());
401  armState_.wrenchJava.push_back(wrench->force().z());
402  armState_.wrenchJava.push_back(wrench->torque().x());
403  armState_.wrenchJava.push_back(wrench->torque().y());
404  armState_.wrenchJava.push_back(wrench->torque().z());
405 
406 
407  } else {
408  std::cout << "Failed verification. bufOk: " << bufOK << "\n";
409  }
410 
411 
412  }
413 
414  }
415  }
416 
417 
418  return haveNewData;
419  }
420 
421  volatile std::size_t m_haveReceivedRealDataCount = 0;
422  volatile std::size_t m_attemptedCommunicationCount = 0;
425 
426 
427  /**
428  * \brief Set the joint positions for the current interpolation step.
429  *
430  * This method is only effective when the robot is in a commanding state
431  * and the set time point for reaching the destination is in the future.
432  * This function sets the goal time point for a motion to the epoch, aka "time 0" (which is in the past) for safety.
433  *
434  *
435  * For position based motion to work, you must set both the position you want and the time you want it to get there.
436  * This is required because the robot can move extremely fast, so accidentally setting the velocity to the max is
437  * 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
438  * to make it, the robot will move at the max speed towards that position.
439  *
440  * @see KukaFRIdriver::set(TimePoint && time, time_point_command_tag) to set the destination time point in the future so the position motion can start.
441  *
442  * @param state Object which stores the current state of the robot, including the command to send next
443  * @param range Array with the new joint positions (in radians)
444  * @param tag identifier object indicating that revolute joint angle commands should be modified
445  */
446  template<typename Range>
448  boost::lock_guard<boost::mutex> lock(jt_mutex);
449  armState_.clearCommands();
450  boost::copy(range, std::back_inserter(armState_.commandedPosition));
451  boost::copy(range, std::back_inserter(armState_.commandedPosition_goal));
452  }
453 
454  /**
455  * @brief set the interface over which commands are sent (FRI interface, alternately SmartServo/DirectServo == JAVA interface, )
456  */
458  boost::lock_guard<boost::mutex> lock(jt_mutex);
459  commandInterface_ = cif;
460  }
461 
462  /**
463  * @brief set the interface over which state is monitored (FRI interface, alternately SmartServo/DirectServo == JAVA interface, )
464  */
466  boost::lock_guard<boost::mutex> lock(jt_mutex);
467  commandInterface_ = mif;
468  }
469 
470  /**
471  * @brief Set the time duration expected between new position commands
472  *
473  * The driver will likely be updated every so often, such as every 25ms, and the lowest level of the
474  * driver may update even more frequently, such as every 1ms. By providing as accurate an
475  * estimate between high level updates the low level driver can smooth out the motion through
476  * interpolation (the default), or another algorithm. See LowLevelStepAlgorithmType template parameter
477  * in the KukaFRIdriver class if you want to change out the low level algorithm.
478  *
479  * @see KukaFRIdriver::get(time_duration_command_tag)
480  *
481  * @param duration_to_goal_command std::chrono time format representing the time duration between updates
482  *
483  */
484  template<typename TimeDuration>
485  void set(TimeDuration && duration_to_goal_command, time_duration_command_tag) {
486  boost::lock_guard<boost::mutex> lock(jt_mutex);
487  armState_.goal_position_command_time_duration = duration_to_goal_command;
488  }
489 
490 
491 
492  /**
493  * @brief Get the timestamp of the most recent armState
494  *
495  *
496  *
497  * @see KukaFRIdriver::set(Range&& range, grl::revolute_joint_angle_open_chain_command_tag)
498  *
499  */
501  boost::lock_guard<boost::mutex> lock(jt_mutex);
502  return armState_.timestamp;
503  }
504 
505 
506 
507  /**
508  * \brief Set the applied joint torques for the current interpolation step.
509  *
510  * This method is only effective when the client is in a commanding state.
511  * The ControlMode of the robot has to be joint impedance control mode. The
512  * Client Command Mode has to be torque.
513  *
514  * @param state Object which stores the current state of the robot, including the command to send next
515  * @param torques Array with the applied torque values (in Nm)
516  * @param tag identifier object indicating that the torqe value command should be modified
517  */
518  template<typename Range>
520  boost::lock_guard<boost::mutex> lock(jt_mutex);
521  armState_.clearCommands();
522  boost::copy(range, armState_.commandedTorque);
523  }
524 
525 
526  /**
527  * \brief Set the applied wrench vector of the current interpolation step.
528  *
529  * The wrench vector consists of:
530  * [F_x, F_y, F_z, tau_A, tau_B, tau_C]
531  *
532  * F ... forces (in N) applied along the Cartesian axes of the
533  * currently used motion center.
534  * tau ... torques (in Nm) applied along the orientation angles
535  * (Euler angles A, B, C) of the currently used motion center.
536  *
537  * This method is only effective when the client is in a commanding state.
538  * The ControlMode of the robot has to be Cartesian impedance control mode. The
539  * Client Command Mode has to be wrench.
540  *
541  * @param state object storing the command data that will be sent to the physical device
542  * @param range wrench Applied Cartesian wrench vector, in x, y, z, roll, pitch, yaw force measurments.
543  * @param tag identifier object indicating that the wrench value command should be modified
544  *
545  * @todo perhaps support some specific more useful data layouts
546  */
547  template<typename Range>
548  void set(Range&& range, grl::cartesian_wrench_command_tag) {
549  boost::lock_guard<boost::mutex> lock(jt_mutex);
550  armState_.clearCommands();
551  std::copy(range,armState_.commandedCartesianWrenchFeedForward);
552  }
553 
554  /// @todo should this exist? is it written correctly?
555  void get(KukaState & state)
556  {
557  boost::lock_guard<boost::mutex> lock(jt_mutex);
558  state = armState_;
559  }
560 
561  void getWrench(KukaState & state)
562  { boost::lock_guard<boost::mutex> lock(jt_mutex);
563 
564  if (!armState_.wrenchJava.empty()) {
565  state.wrenchJava = armState_.wrenchJava;
566  }
567  }
568 
569  /// set the mode of the arm. Examples: Teach or MoveArmJointServo
570  /// @see grl::flatbuffer::ArmState in ArmControlState_generated.h
571  void set(const flatbuffer::ArmState& armControlMode)
572  {
573  armControlMode_ = armControlMode;
574  }
575 
576  private:
577 
578  int socket_local;
579  int port;
580  struct sockaddr_in dst_sockaddr;
581  socklen_t dst_sockaddr_len = sizeof(dst_sockaddr);
582  struct sockaddr_in local_sockaddr;
583  long dst_ip;
584  fd_set mask, temp_mask, dummy_mask;
585 
586  Params params_;
587  KukaState armState_;
588  // armControlMode is the current GRL_Driver.java configuration to which the arm is currently set.
589  // Options are:
590  // ArmState_NONE = 0,
591  // ArmState_StartArm = 1,
592  // ArmState_StopArm = 2,
593  // ArmState_PauseArm = 3,
594  // ArmState_ShutdownArm = 4,
595  // ArmState_TeachArm = 5,
596  // ArmState_MoveArmTrajectory = 6,
597  // ArmState_MoveArmJointServo = 7,
598  // ArmState_MoveArmCartesianServo = 8
599  flatbuffer::ArmState armControlMode_;
600  flatbuffer::KUKAiiwaInterface commandInterface_ = flatbuffer::KUKAiiwaInterface_SmartServo;// KUKAiiwaInterface_SmartServo;
602 // flatbuffers::FlatBufferBuilder builder_;
603 //
604 // flatbuffer::JointStateBuilder jointStateServoBuilder_;
605 // flatbuffer::MoveArmJointServoBuilder moveArmJointServoBuilder_;
606 // flatbuffer::TeachArmBuilder teachArmBuilder_;
607 // flatbuffer::ArmControlStateBuilder armControlStateBuilder_;
608 // flatbuffer::KUKAiiwaStateBuilder iiwaStateBuilder_;
609 // flatbuffer::KUKAiiwaStatesBuilder iiwaStatesBuilder_;
610 //
611 // flatbuffers::Offset<flatbuffer::KUKAiiwaState> iiwaState;
612 
613  boost::mutex jt_mutex;
614 
615  int64_t sequenceNumber;
616 
617  bool debug_ = false;
618 
619  };
620 
621 }}}// namespace grl::robot::arm
622 
623 #endif
cartesian_state wrenchJava
Definition: Kuka.hpp:53
flatbuffers::Offset< KUKAiiwaState > CreateKUKAiiwaState(flatbuffers::FlatBufferBuilder &_fbb, flatbuffers::Offset< flatbuffers::String > name=0, flatbuffers::Offset< flatbuffers::String > destination=0, flatbuffers::Offset< flatbuffers::String > source=0, double timestamp=0, uint8_t setArmControlState=0, flatbuffers::Offset< grl::flatbuffer::ArmControlState > armControlState=0, uint8_t setArmConfiguration=0, flatbuffers::Offset< KUKAiiwaArmConfiguration > armConfiguration=0, uint8_t hasMonitorState=0, flatbuffers::Offset< KUKAiiwaMonitorState > monitorState=0, uint8_t hasMonitorConfig=0, flatbuffers::Offset< KUKAiiwaMonitorConfiguration > monitorConfig=0)
std::tuple< JointScalar, JointScalar, JointScalar, JointScalar, JointScalar, TransformationMatrices, JointStateTag > State
volatile std::size_t m_attemptedCommunicationConsecutiveSuccessCount
std::vector< TransformationMatrix > TransformationMatrices
Internal implementation class for driver use only, stores all the kuka state data in a simple object...
Definition: Kuka.hpp:40
flatbuffers::Offset< StopArm > CreateStopArm(flatbuffers::FlatBufferBuilder &_fbb)
std::chrono::time_point< std::chrono::high_resolution_clock > time_point_type
Definition: Kuka.hpp:45
volatile std::size_t m_attemptedCommunicationCount
bool destruct()
shuts down the arm
void getWrench(KukaState &state)
OutputIterator copy(std::string model, OutputIterator it, grl::revolute_joint_velocity_open_chain_state_constraint_tag)
copy vector of joint velocity limits in radians/s
Definition: Kuka.hpp:131
std::vector< double > JointScalar
flatbuffers::Offset< MoveArmJointServo > CreateMoveArmJointServo(flatbuffers::FlatBufferBuilder &_fbb, flatbuffers::Offset< grl::flatbuffer::JointState > goal=0)
std::array< double, 12 > TransformationMatrix
defines tag dispatching types used throughout grl
data for changing a system&#39;s physical state, such as joint angles to be sent to a robot arm...
Definition: tags.hpp:35
bool VerifyKUKAiiwaStatesBuffer(flatbuffers::Verifier &verifier)
boost::error_info< struct tag_errmsg, std::string > errmsg_info
Definition: exception.hpp:7
the time duration over which a command should be completed
Definition: tags.hpp:73
KukaJAVAdriver(Params params=defaultParams())
volatile std::size_t m_attemptedCommunicationConsecutiveFailureCount
static const Params defaultParams()
flatbuffers::Offset< StartArm > CreateStartArm(flatbuffers::FlatBufferBuilder &_fbb)
std::tuple< std::string, std::string, std::string, std::string, std::string, std::string, std::string, std::string, std::string, std::string, std::string > Params
flatbuffers::Offset< ArmControlState > CreateArmControlState(flatbuffers::FlatBufferBuilder &_fbb, flatbuffers::Offset< flatbuffers::String > name=0, int64_t sequenceNumber=0, double timeStamp=0, ArmState state_type=ArmState_NONE, flatbuffers::Offset< void > state=0)
flatbuffers::Offset< KUKAiiwaStates > CreateKUKAiiwaStates(flatbuffers::FlatBufferBuilder &_fbb, flatbuffers::Offset< flatbuffers::Vector< flatbuffers::Offset< KUKAiiwaState >>> states=0)
void FinishKUKAiiwaStatesBuffer(flatbuffers::FlatBufferBuilder &fbb, flatbuffers::Offset< grl::flatbuffer::KUKAiiwaStates > root)
flatbuffers::Offset< PauseArm > CreatePauseArm(flatbuffers::FlatBufferBuilder &_fbb)
const grl::flatbuffer::KUKAiiwaStates * GetKUKAiiwaStates(const void *buf)
bool run_one()
SEND COMMAND TO ARM. Call this often Performs the main update spin once.
flatbuffers::Offset< TeachArm > CreateTeachArm(flatbuffers::FlatBufferBuilder &_fbb)
volatile std::size_t m_haveReceivedRealDataCount
identifies data representing the state of a sytem
Definition: tags.hpp:34
flatbuffers::Offset< JointState > CreateJointState(flatbuffers::FlatBufferBuilder &_fbb, flatbuffers::Offset< flatbuffers::Vector< double >> position=0, flatbuffers::Offset< flatbuffers::Vector< double >> velocity=0, flatbuffers::Offset< flatbuffers::Vector< double >> acceleration=0, flatbuffers::Offset< flatbuffers::Vector< double >> torque=0)
single point in time relative to some start point
Definition: tags.hpp:21
flatbuffers::Offset< KUKAiiwaArmConfiguration > CreateKUKAiiwaArmConfiguration(flatbuffers::FlatBufferBuilder &_fbb, flatbuffers::Offset< flatbuffers::String > name=0, KUKAiiwaInterface commandInterface=KUKAiiwaInterface_Disabled, KUKAiiwaInterface monitorInterface=KUKAiiwaInterface_Disabled, EClientCommandMode clientCommandMode=EClientCommandMode_NO_COMMAND_MODE, EOverlayType overlayType=EOverlayType_NO_OVERLAY, EControlMode controlMode=EControlMode_POSITION_CONTROL_MODE, flatbuffers::Offset< SmartServo > smartServoConfig=0, flatbuffers::Offset< FRI > FRIConfig=0, flatbuffers::Offset< flatbuffers::Vector< flatbuffers::Offset< grl::flatbuffer::LinkObject >>> tools=0, flatbuffers::Offset< flatbuffers::Vector< flatbuffers::Offset< ProcessData >>> processData=0, flatbuffers::Offset< flatbuffers::String > currentMotionCenter=0, uint8_t requestMonitorProcessData=0)