<|start_filename|>src/duration.cpp<|end_filename|>
// Copyright (c) 2017 Franka Emika GmbH
// Use of this source code is governed by the Apache-2.0 license, see LICENSE
#include <franka/duration.h>

namespace franka {

Duration::Duration() noexcept : duration_{0u} {}

Duration::Duration(std::chrono::duration<uint64_t, std::milli> duration) noexcept
    : duration_{duration} {}

Duration::Duration(uint64_t milliseconds) noexcept : duration_{milliseconds} {}

Duration::operator std::chrono::duration<uint64_t, std::milli>() const noexcept {
  return duration_;
}

double Duration::toSec() const noexcept {
  return std::chrono::duration_cast<std::chrono::duration<double>>(duration_).count();
}

uint64_t Duration::toMSec() const noexcept {
  return duration_.count();
}

Duration Duration::operator+(const Duration& rhs) const noexcept {
  return duration_ + rhs.duration_;
}

Duration& Duration::operator+=(const Duration& rhs) noexcept {
  duration_ += rhs.duration_;
  return *this;
}

Duration Duration::operator-(const Duration& rhs) const noexcept {
  return duration_ - rhs.duration_;
}

Duration& Duration::operator-=(const Duration& rhs) noexcept {
  duration_ -= rhs.duration_;
  return *this;
}

Duration Duration::operator*(uint64_t rhs) const noexcept {
  return duration_ * rhs;
}

Duration& Duration::operator*=(uint64_t rhs) noexcept {
  duration_ *= rhs;
  return *this;
}

uint64_t Duration::operator/(const Duration& rhs) const noexcept {
  return duration_ / rhs.duration_;
}

Duration Duration::operator/(uint64_t rhs) const noexcept {
  return duration_ / rhs;
}

Duration& Duration::operator/=(uint64_t rhs) noexcept {
  duration_ /= rhs;
  return *this;
}

Duration Duration::operator%(const Duration& rhs) const noexcept {
  return duration_ % rhs.duration_;
}

Duration Duration::operator%(uint64_t rhs) const noexcept {
  return duration_ % rhs;
}

Duration& Duration::operator%=(const Duration& rhs) noexcept {
  duration_ %= rhs.duration_;
  return *this;
}

Duration& Duration::operator%=(uint64_t rhs) noexcept {
  duration_ %= rhs;
  return *this;
}

bool Duration::operator==(const Duration& rhs) const noexcept {
  return duration_ == rhs.duration_;
}

bool Duration::operator!=(const Duration& rhs) const noexcept {
  return duration_ != rhs.duration_;
}

bool Duration::operator<(const Duration& rhs) const noexcept {
  return duration_ < rhs.duration_;
}

bool Duration::operator<=(const Duration& rhs) const noexcept {
  return duration_ <= rhs.duration_;
}

bool Duration::operator>(const Duration& rhs) const noexcept {
  return duration_ > rhs.duration_;
}

bool Duration::operator>=(const Duration& rhs) const noexcept {
  return duration_ >= rhs.duration_;
}

Duration operator*(uint64_t lhs, const Duration& rhs) noexcept {
  return rhs * lhs;
}

}  // namespace franka


<|start_filename|>test/duration_tests.cpp<|end_filename|>
// Copyright (c) 2017 <NAME> GmbH
// Use of this source code is governed by the Apache-2.0 license, see LICENSE
#include <utility>

#include <gtest/gtest.h>

#include <franka/duration.h>

using franka::Duration;

TEST(Duration, CanDefaultConstruct) {
  Duration d;
  EXPECT_EQ(0u, d.toMSec());
  EXPECT_EQ(0.0, d.toSec());
}

TEST(Duration, CanConstructFromMilliseconds) {
  Duration d(12345u);
  EXPECT_EQ(12345u, d.toMSec());
  EXPECT_EQ(12.345, d.toSec());
}

TEST(Duration, CanConstructFromChrono) {
  std::chrono::duration<uint64_t, std::milli> chrono_duration(12345u);
  Duration d(chrono_duration);
  EXPECT_EQ(12345u, d.toMSec());
  EXPECT_EQ(12.345, d.toSec());
}

TEST(Duration, CanConvertToChrono) {
  Duration d(12345u);
  std::chrono::duration<uint64_t, std::milli> chrono_duration = d;
  EXPECT_EQ(12345u, chrono_duration.count());
}

TEST(Duration, CanCopy) {
  Duration d(12345u);
  Duration d2(d);
  EXPECT_EQ(12345u, d2.toMSec());

  Duration d3;
  d3 = d;
  EXPECT_EQ(12345u, d2.toMSec());
}

TEST(Duration, CanMove) {
  Duration d(12345u);
  Duration d2(std::move(d));
  EXPECT_EQ(12345u, d2.toMSec());

  Duration d3;
  d3 = std::move(d);
  EXPECT_EQ(12345u, d2.toMSec());
}

TEST(Duration, CanUseArithmeticOperations) {
  Duration d1(4u);
  Duration d2(3u);

  EXPECT_EQ(7u, (d1 + d2).toMSec());
  EXPECT_EQ(7u, (d2 + d1).toMSec());

  EXPECT_EQ(1u, (d1 - d2).toMSec());

  EXPECT_EQ(8u, (d1 * 2).toMSec());
  EXPECT_EQ(8u, (2 * d1).toMSec());

  EXPECT_EQ(2u, (d1 / 2).toMSec());
  EXPECT_EQ(1u, d1 / d2);

  EXPECT_EQ(1u, (d1 % d2).toMSec());
  EXPECT_EQ(1u, (d1 % 3u).toMSec());

  d1 += d2;
  EXPECT_EQ(7u, d1.toMSec());

  d1 -= d2;
  EXPECT_EQ(4u, d1.toMSec());

  d1 *= 2;
  EXPECT_EQ(8u, d1.toMSec());

  d1 /= 2;
  EXPECT_EQ(4u, d1.toMSec());

  d1 %= 3;
  EXPECT_EQ(1u, d1.toMSec());

  d1 *= 4;
  d1 %= d2;
  EXPECT_EQ(1u, d1.toMSec());
}

TEST(Duration, CanCompare) {
  EXPECT_TRUE(Duration(1) == Duration(1));
  EXPECT_FALSE(Duration(1) == Duration(2));
  EXPECT_FALSE(Duration(2) == Duration(1));

  EXPECT_FALSE(Duration(1) != Duration(1));
  EXPECT_TRUE(Duration(1) != Duration(2));
  EXPECT_TRUE(Duration(2) != Duration(1));

  EXPECT_TRUE(Duration(1) < Duration(2));
  EXPECT_FALSE(Duration(2) < Duration(1));
  EXPECT_FALSE(Duration(2) < Duration(2));

  EXPECT_FALSE(Duration(1) > Duration(2));
  EXPECT_TRUE(Duration(2) > Duration(1));
  EXPECT_FALSE(Duration(2) > Duration(2));

  EXPECT_TRUE(Duration(1) <= Duration(2));
  EXPECT_FALSE(Duration(2) <= Duration(1));
  EXPECT_TRUE(Duration(2) <= Duration(2));

  EXPECT_FALSE(Duration(1) >= Duration(2));
  EXPECT_TRUE(Duration(2) >= Duration(1));
  EXPECT_TRUE(Duration(2) >= Duration(2));
}


<|start_filename|>test/calculations_tests.cpp<|end_filename|>
// Copyright (c) 2017 Franka Emika GmbH
// Use of this source code is governed by the Apache-2.0 license, see LICENSE

#include <gtest/gtest.h>

#include "load_calculations.h"

TEST(CalculationTest, CombineCenterOfMassZeroMassInput) {
  double m_ee = 0;
  double m_load = 0;
  std::array<double, 3> F_x_Ctotal =
      franka::combineCenterOfMass(m_ee, std::array<double, 3>{}, m_load, std::array<double, 3>{});

  std::array<double, 3> expected{};
  EXPECT_EQ(expected, F_x_Ctotal);
}

TEST(CalculationTest, CombineCenterOfMassEEWithZeroLoad) {
  double m_ee = 0.73;
  std::array<double, 3> F_x_Cee{-0.01, 0, 0.03};
  double m_load = 0.0;
  std::array<double, 3> F_x_Cload{};

  std::array<double, 3> F_x_Ctotal = franka::combineCenterOfMass(m_ee, F_x_Cee, m_load, F_x_Cload);

  EXPECT_EQ(F_x_Cee, F_x_Ctotal);
}

TEST(CalculationTest, CombineCenterOfMassLoadWithZeroEE) {
  double m_ee = 0.0;
  std::array<double, 3> F_x_Cee{};
  double m_load = 0.73;
  std::array<double, 3> F_x_Cload{-0.01, 0, 0.03};
  std::array<double, 3> F_x_Ctotal = franka::combineCenterOfMass(m_ee, F_x_Cee, m_load, F_x_Cload);

  EXPECT_EQ(F_x_Cload, F_x_Ctotal);
}

TEST(CalculationTest, CombineCenterOfMassEEWithLoad) {
  double m_ee = 0.73;
  std::array<double, 3> F_x_Cee{-0.01, 0, -0.03};
  double m_load = 0.5;
  std::array<double, 3> F_x_Cload{0.01, -0.2, 0.03};
  std::array<double, 3> F_x_Ctotal = franka::combineCenterOfMass(m_ee, F_x_Cee, m_load, F_x_Cload);

  std::array<double, 3> expected{-0.00186991869918699, -0.08130081300813009, -0.00560975609756098};
  for (int i = 0; i < 3; i++) {
    EXPECT_NEAR(expected[i], F_x_Ctotal[i], 1e-17);
  }
}

TEST(CalculationTest, CombineInertiaTensorZeroMassInput) {
  double m_ee = 0.0;
  std::array<double, 3> F_x_Cee{-0.01, 0, -0.03};
  std::array<double, 9> I_ee{0.001, 0.0, 0.0, 0.0, 0.0025, 0.0, 0.0, 0.0, 0.0017};
  double m_load = 0.0;
  std::array<double, 3> F_x_Cload{0.01, -0.2, 0.03};
  std::array<double, 9> I_load{};
  double m_total = m_ee + m_load;
  std::array<double, 3> F_x_Ctotal = franka::combineCenterOfMass(m_ee, F_x_Cee, m_load, F_x_Cload);

  std::array<double, 9> I_total = franka::combineInertiaTensor(
      m_ee, F_x_Cee, I_ee, m_load, F_x_Cload, I_load, m_total, F_x_Ctotal);

  std::array<double, 9> expected{};
  for (int i = 0; i < 3; i++) {
    EXPECT_NEAR(expected[i], I_total[i], 1e-17);
  }
}

TEST(CalculationTest, CombineInertiaTensorLoadWithZeroEE) {
  double m_ee = 0.0;
  std::array<double, 3> F_x_Cee{-0.01, 0, -0.03};
  std::array<double, 9> I_ee{0.001, 0.0, 0.0, 0.0, 0.0025, 0.0, 0.0, 0.0, 0.0017};
  double m_load = 0.5;
  std::array<double, 3> F_x_Cload{0.01, -0.2, 0.03};
  std::array<double, 9> I_load{0.001, 0.0, 0.0, 0.0, 0.025, 0.0, 0.0, 0.0, 0.3};
  double m_total = m_ee + m_load;
  std::array<double, 3> F_x_Ctotal = franka::combineCenterOfMass(m_ee, F_x_Cee, m_load, F_x_Cload);

  std::array<double, 9> I_total = franka::combineInertiaTensor(
      m_ee, F_x_Cee, I_ee, m_load, F_x_Cload, I_load, m_total, F_x_Ctotal);

  std::array<double, 9> expected = I_load;
  for (int i = 0; i < 3; i++) {
    EXPECT_NEAR(expected[i], I_total[i], 1e-17);
  }
}

TEST(CalculationTest, CombineInertiaTensorEEWithZeroLoad) {
  double m_ee = 0.73;
  std::array<double, 3> F_x_Cee{-0.01, 0, -0.03};
  std::array<double, 9> I_ee{0.001, 0.0, 0.0, 0.0, 0.0025, 0.0, 0.0, 0.0, 0.0017};
  double m_load = 0.0;
  std::array<double, 3> F_x_Cload{0.01, -0.2, 0.03};
  std::array<double, 9> I_load{0.001, 0.0, 0.0, 0.0, 0.025, 0.0, 0.0, 0.0, 0.3};
  double m_total = m_ee + m_load;
  std::array<double, 3> F_x_Ctotal = franka::combineCenterOfMass(m_ee, F_x_Cee, m_load, F_x_Cload);

  std::array<double, 9> I_total = franka::combineInertiaTensor(
      m_ee, F_x_Cee, I_ee, m_load, F_x_Cload, I_load, m_total, F_x_Ctotal);

  std::array<double, 9> expected = I_ee;
  for (int i = 0; i < 3; i++) {
    EXPECT_NEAR(expected[i], I_total[i], 1e-17);
  }
}

TEST(CalculationTest, CombineInertiaTensorEEWithLoad) {
  double m_ee = 0.73;
  std::array<double, 3> F_x_Cee{-0.01, 0, -0.03};
  std::array<double, 9> I_ee{0.001, 0.0, 0.0, 0.0, 0.0025, 0.0, 0.0, 0.0, 0.0017};
  double m_load = 0.5;
  std::array<double, 3> F_x_Cload{0.01, -0.2, 0.03};
  std::array<double, 9> I_load{0.001, 0.0, 0.0, 0.0, 0.025, 0.0, 0.0, 0.0, 0.3};
  double m_total = m_ee + m_load;
  std::array<double, 3> F_x_Ctotal = franka::combineCenterOfMass(m_ee, F_x_Cee, m_load, F_x_Cload);

  std::array<double, 9> I_total = franka::combineInertiaTensor(
      m_ee, F_x_Cee, I_ee, m_load, F_x_Cload, I_load, m_total, F_x_Ctotal);

  std::array<double, 9> expected{1.49382113821138e-02,  1.18699186991870e-03, -3.56097560975610e-04,
                                 1.18699186991870e-03,  2.36869918699187e-02, 3.56097560975610e-03,
                                 -3.56097560975610e-04, 3.56097560975610e-03, 3.13688617886179e-01};
  for (int i = 0; i < 3; i++) {
    EXPECT_NEAR(expected[i], I_total[i], 1e-14);
  }
}

<|start_filename|>cmake/SetupGoogleTest.cmake<|end_filename|>
configure_file(${CMAKE_CURRENT_LIST_DIR}/GoogleTest-CMakeLists.txt.in
               ${CMAKE_BINARY_DIR}/googletest-download/CMakeLists.txt)
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
  RESULT_VARIABLE result
  WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/googletest-download
)
if(result)
  message(FATAL_ERROR "Running CMake for Google Test failed: ${result}")
endif()

execute_process(COMMAND ${CMAKE_COMMAND} --build .
  RESULT_VARIABLE result
  WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/googletest-download
)
if(result)
  message(FATAL_ERROR "Downloading Google Test failed: ${result}")
endif()

# Prevent overriding the parent project's compiler/linker
# settings on Windows
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)

add_subdirectory(${GTEST_SOURCE_DIR}/googlemock ${GTEST_BINARY_DIR} EXCLUDE_FROM_ALL)
mark_as_advanced(FORCE
                 BUILD_SHARED_LIBS
                 gmock_build_tests
                 gtest_build_samples
                 gtest_build_tests
                 gtest_disable_pthreads
                 gtest_force_shared_crt
                 gtest_hide_internal_symbols)


<|start_filename|>src/libfcimodels.h<|end_filename|>
// Copyright (c) 2017 <NAME> GmbH
// Use of this source code is governed by the Apache-2.0 license, see LICENSE
#pragma once

extern "C" {

void Ji_J_J1(double b_Ji_J_J1[42]);
void Ji_J_J2(const double q[7], double b_Ji_J_J2[42]);
void Ji_J_J3(const double q[7], double b_Ji_J_J3[42]);
void Ji_J_J4(const double q[7], double b_Ji_J_J4[42]);
void Ji_J_J5(const double q[7], double b_Ji_J_J5[42]);
void Ji_J_J6(const double q[7], double b_Ji_J_J6[42]);
void Ji_J_J7(const double q[7], double b_Ji_J_J7[42]);
void Ji_J_J8(const double q[7], double b_Ji_J_J8[42]);
void Ji_J_J9(const double q[7], const double F_T_EE[16], double b_Ji_J_J9[42]);

void M_NE(const double q[7],
          const double I_load[9],
          double m_load,
          const double F_x_Cload[3],
          double M_NE[49]);

void O_J_J1(double b_O_J_J1[42]);
void O_J_J2(const double q[7], double b_O_J_J2[42]);
void O_J_J3(const double q[7], double b_O_J_J3[42]);
void O_J_J4(const double q[7], double b_O_J_J4[42]);
void O_J_J5(const double q[7], double b_O_J_J5[42]);
void O_J_J6(const double q[7], double b_O_J_J6[42]);
void O_J_J7(const double q[7], double b_O_J_J7[42]);
void O_J_J8(const double q[7], double b_O_J_J8[42]);
void O_J_J9(const double q[7], const double F_T_EE[16], double b_O_J_J9[42]);

void O_T_J1(const double q[7], double b_O_T_J1[16]);
void O_T_J2(const double q[7], double b_O_T_J2[16]);
void O_T_J3(const double q[7], double b_O_T_J3[16]);
void O_T_J4(const double q[7], double b_O_T_J4[16]);
void O_T_J5(const double q[7], double b_O_T_J5[16]);
void O_T_J6(const double q[7], double b_O_T_J6[16]);
void O_T_J7(const double q[7], double b_O_T_J7[16]);
void O_T_J8(const double q[7], double b_O_T_J8[16]);
void O_T_J9(const double q[7], const double F_T_EE[16], double b_O_T_J9[16]);

void c_NE(const double q[7],
          const double dq[7],
          const double I_load[9],
          double m_load,
          const double F_x_Cload[3],
          double c_NE[7]);

void g_NE(const double q[7],
          const double g_earth[3],
          double m_load,
          const double F_x_Cload[3],
          double g_NE[7]);
}


<|start_filename|>src/model_library.h<|end_filename|>
// Copyright (c) 2017 Franka Emika GmbH
// Use of this source code is governed by the Apache-2.0 license, see LICENSE
#pragma once

#include <functional>

#include "libfcimodels.h"
#include "library_loader.h"
#include "network.h"

namespace franka {

class ModelLibrary {
 public:
  ModelLibrary(Network& network);

 private:
  LibraryLoader loader_;

 public:
  const std::function<decltype(Ji_J_J1)> body_jacobian_joint1;
  const std::function<decltype(Ji_J_J2)> body_jacobian_joint2;
  const std::function<decltype(Ji_J_J3)> body_jacobian_joint3;
  const std::function<decltype(Ji_J_J4)> body_jacobian_joint4;
  const std::function<decltype(Ji_J_J5)> body_jacobian_joint5;
  const std::function<decltype(Ji_J_J6)> body_jacobian_joint6;
  const std::function<decltype(Ji_J_J7)> body_jacobian_joint7;
  const std::function<decltype(Ji_J_J8)> body_jacobian_flange;
  const std::function<decltype(Ji_J_J9)> body_jacobian_ee;

  const std::function<decltype(M_NE)> mass;

  const std::function<decltype(O_J_J1)> zero_jacobian_joint1;
  const std::function<decltype(O_J_J2)> zero_jacobian_joint2;
  const std::function<decltype(O_J_J3)> zero_jacobian_joint3;
  const std::function<decltype(O_J_J4)> zero_jacobian_joint4;
  const std::function<decltype(O_J_J5)> zero_jacobian_joint5;
  const std::function<decltype(O_J_J6)> zero_jacobian_joint6;
  const std::function<decltype(O_J_J7)> zero_jacobian_joint7;
  const std::function<decltype(O_J_J8)> zero_jacobian_flange;
  const std::function<decltype(O_J_J9)> zero_jacobian_ee;

  const std::function<decltype(O_T_J1)> joint1;
  const std::function<decltype(O_T_J2)> joint2;
  const std::function<decltype(O_T_J3)> joint3;
  const std::function<decltype(O_T_J4)> joint4;
  const std::function<decltype(O_T_J5)> joint5;
  const std::function<decltype(O_T_J6)> joint6;
  const std::function<decltype(O_T_J7)> joint7;
  const std::function<decltype(O_T_J8)> flange;
  const std::function<decltype(O_T_J9)> ee;

  const std::function<decltype(c_NE)> coriolis;
  const std::function<decltype(g_NE)> gravity;
};

}  // namespace franka


<|start_filename|>test/errors_tests.cpp<|end_filename|>
// Copyright (c) 2017 <NAME> GmbH
// Use of this source code is governed by the Apache-2.0 license, see LICENSE
#include <gtest/gtest.h>

#include <franka/errors.h>
#include <research_interface/robot/error.h>
#include <research_interface/robot/rbk_types.h>

#include "helpers.h"

TEST(Errors, IsInitializedToNoErrors) {
  franka::Errors errors;

  EXPECT_FALSE(errors);
}

TEST(Errors, EvaluatedToTrueOnError) {
  std::array<bool, sizeof(research_interface::robot::RobotState::errors)> error_flags{};
  error_flags[rand() % error_flags.size()] = true;

  franka::Errors errors(error_flags);

  EXPECT_TRUE(errors);
}

TEST(Errors, CanGetNamesOfErrors) {
  std::array<bool, sizeof(research_interface::robot::RobotState::errors)> error_flags{};
  std::fill(error_flags.begin(), error_flags.end(), false);
  error_flags[static_cast<size_t>(
      research_interface::robot::Error::kJointPositionLimitsViolation)] = true;
  error_flags[static_cast<size_t>(
      research_interface::robot::Error::kSelfcollisionAvoidanceViolation)] = true;

  franka::Errors errors(error_flags);

  std::string expected =
      R"(["joint_position_limits_violation", "self_collision_avoidance_violation"])";
  EXPECT_EQ(expected, static_cast<std::string>(errors));
}

TEST(Errors, CanBeStreamed) {
  franka::Errors errors;

  std::stringstream ss;
  ss << errors;
  std::string output(ss.str());

  EXPECT_EQ("[]", output);
}


<|start_filename|>src/motion_generator_traits.h<|end_filename|>
// Copyright (c) 2017 <NAME> GmbH
// Use of this source code is governed by the Apache-2.0 license, see LICENSE
#pragma once

#include <franka/control_types.h>
#include <research_interface/robot/service_types.h>

namespace franka {

template <typename T>
struct MotionGeneratorTraits {};

template <>
struct MotionGeneratorTraits<JointPositions> {
  static constexpr auto kMotionGeneratorMode =
      research_interface::robot::Move::MotionGeneratorMode::kJointPosition;
};

template <>
struct MotionGeneratorTraits<JointVelocities> {
  static constexpr auto kMotionGeneratorMode =
      research_interface::robot::Move::MotionGeneratorMode::kJointVelocity;
};

template <>
struct MotionGeneratorTraits<CartesianPose> {
  static constexpr auto kMotionGeneratorMode =
      research_interface::robot::Move::MotionGeneratorMode::kCartesianPosition;
};

template <>
struct MotionGeneratorTraits<CartesianVelocities> {
  static constexpr auto kMotionGeneratorMode =
      research_interface::robot::Move::MotionGeneratorMode::kCartesianVelocity;
};

}  // namespace franka


<|start_filename|>src/library_loader.h<|end_filename|>
// Copyright (c) 2017 <NAME> GmbH
// Use of this source code is governed by the Apache-2.0 license, see LICENSE
#pragma once

#include <Poco/SharedLibrary.h>

namespace franka {

/*
 * Wraps library loading and unloading with RAII.
 */
class LibraryLoader {
 public:
  LibraryLoader(const std::string& filepath);
  ~LibraryLoader();

  void* getSymbol(const std::string& symbol_name);

 private:
  Poco::SharedLibrary library_;
};

}  // namespace franka


<|start_filename|>test/mock_robot_control.h<|end_filename|>
// Copyright (c) 2017 Franka Emika GmbH
// Use of this source code is governed by the Apache-2.0 license, see LICENSE
#pragma once

#include <franka/robot_state.h>

#include "robot_control.h"

class MockRobotControl : public franka::RobotControl {
 public:
  MOCK_METHOD4(
      startMotion,
      uint32_t(research_interface::robot::Move::ControllerMode controller_mode,
               research_interface::robot::Move::MotionGeneratorMode motion_generator_mode,
               const research_interface::robot::Move::Deviation& maximum_path_deviation,
               const research_interface::robot::Move::Deviation& maximum_goal_pose_deviation));
  MOCK_METHOD3(finishMotion,
               void(uint32_t motion_id,
                    const research_interface::robot::MotionGeneratorCommand* motion_command,
                    const research_interface::robot::ControllerCommand* control_command));
  MOCK_METHOD1(cancelMotion, void(uint32_t motion_id));

  MOCK_METHOD2(
      update,
      franka::RobotState(const research_interface::robot::MotionGeneratorCommand* motion_command,
                         const research_interface::robot::ControllerCommand* control_command));

  MOCK_METHOD2(throwOnMotionError, void(const franka::RobotState& robot_state, uint32_t motion_id));

  franka::RealtimeConfig realtimeConfig() const noexcept override {
    return franka::RealtimeConfig::kIgnore;
  }
};


<|start_filename|>include/franka/command_types.h<|end_filename|>
// Copyright (c) 2017 Franka Emika GmbH
// Use of this source code is governed by the Apache-2.0 license, see LICENSE
#pragma once

#include <array>
#include <cstdint>

/**
 * @file command_types.h
 * Contains types for the commands that can be sent from franka::Robot.
 */

namespace franka {

/**
 * Parameters of a cuboid used as virtual wall.
 *
 * @see Robot::getVirtualWall
 */
struct VirtualWallCuboid {
  /**
   * ID of the virtual wall.
   */
  int32_t id;

  /**
   * Corner point of the cuboid in world frame in \f$[m]\f$.
   */
  std::array<double, 3> object_world_size;

  /**
   * 4x4 transformation matrix, column-major.
   */
  std::array<double, 16> p_frame;

  /**
   * True if this Cartesian limit is active, false otherwise.
   */
  bool active;
};

}  // namespace franka
