libfranka
0.14.1
FCI C++ API
Toggle main menu visibility
Loading...
Searching...
No Matches
examples
examples_common.h
Go to the documentation of this file.
1
// Copyright (c) 2023 Franka Robotics 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
18
24
void
setDefaultBehavior
(
franka::Robot
& robot);
25
31
class
MotionGenerator
{
32
public
:
39
MotionGenerator
(
double
speed_factor,
const
std::array<double, 7> q_goal);
40
49
franka::JointPositions
operator()
(
const
franka::RobotState
& robot_state,
franka::Duration
period);
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
};
MotionGenerator::MotionGenerator
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
MotionGenerator::operator()
franka::JointPositions operator()(const franka::RobotState &robot_state, franka::Duration period)
Sends joint position calculations.
Definition
examples_common.cpp:114
franka::Duration
Represents a duration with millisecond resolution.
Definition
duration.h:19
franka::JointPositions
Stores values for joint position motion generation.
Definition
control_types.h:72
franka::Robot
Maintains a network connection to the robot, provides the current robot state, gives access to the mo...
Definition
robot.h:68
control_types.h
Contains helper types for returning motion generation and joint-level torque commands.
duration.h
Contains the franka::Duration type.
setDefaultBehavior
void setDefaultBehavior(franka::Robot &robot)
Sets a default collision behavior, joint impedance and Cartesian impedance.
Definition
examples_common.cpp:12
robot.h
Contains the franka::Robot type.
robot_state.h
Contains the franka::RobotState types.
franka::RobotState
Describes the robot state.
Definition
robot_state.h:34
Generated by
1.17.0