libfranka  0.8.0
FCI C++ API
examples_common.h
Go to the documentation of this file.
1 // Copyright (c) 2017 Franka Emika GmbH
2 // Use of this source code is governed by the Apache-2.0 license, see LICENSE
3 #pragma once
4 
5 #include <array>
6 
7 #include <Eigen/Core>
8 
9 #include <franka/control_types.h>
10 #include <franka/duration.h>
11 #include <franka/robot.h>
12 #include <franka/robot_state.h>
13 
25 
32  public:
39  MotionGenerator(double speed_factor, const std::array<double, 7> q_goal);
40 
50 
51  private:
52  using Vector7d = Eigen::Matrix<double, 7, 1, Eigen::ColMajor>;
53  using Vector7i = Eigen::Matrix<int, 7, 1, Eigen::ColMajor>;
54 
55  bool calculateDesiredValues(double t, Vector7d* delta_q_d) const;
56  void calculateSynchronizedValues();
57 
58  static constexpr double kDeltaQMotionFinished = 1e-6;
59  const Vector7d q_goal_;
60 
61  Vector7d q_start_;
62  Vector7d delta_q_;
63 
64  Vector7d dq_max_sync_;
65  Vector7d t_1_sync_;
66  Vector7d t_2_sync_;
67  Vector7d t_f_sync_;
68  Vector7d q_1_;
69 
70  double time_ = 0.0;
71 
72  Vector7d dq_max_ = (Vector7d() << 2.0, 2.0, 2.0, 2.0, 2.5, 2.5, 2.5).finished();
73  Vector7d ddq_max_start_ = (Vector7d() << 5, 5, 5, 5, 5, 5, 5).finished();
74  Vector7d ddq_max_goal_ = (Vector7d() << 5, 5, 5, 5, 5, 5, 5).finished();
75 };
An example showing how to generate a joint pose motion to a goal position.
Definition: examples_common.h:31
Contains the franka::Robot type.
franka::JointPositions operator()(const franka::RobotState &robot_state, franka::Duration period)
Sends joint position calculations.
Definition: examples_common.cpp:114
Contains helper types for returning motion generation and joint-level torque commands.
Represents a duration with millisecond resolution.
Definition: duration.h:19
Contains the franka::RobotState types.
Contains the franka::Duration type.
MotionGenerator(double speed_factor, const std::array< double, 7 > q_goal)
Creates a new MotionGenerator instance for a target q.
Definition: examples_common.cpp:22
Stores values for joint position motion generation.
Definition: control_types.h:72
void setDefaultBehavior(franka::Robot &robot)
Sets a default collision behavior, joint impedance, Cartesian impedance, and filter frequency...
Definition: examples_common.cpp:12
Describes the robot state.
Definition: robot_state.h:35
Maintains a network connection to the robot, provides the current robot state, gives access to the mo...
Definition: robot.h:46