Skip to content

Commit

Permalink
Merge branch 'hotfix/max-path-pose-for-active-control' into fr3-develop
Browse files Browse the repository at this point in the history
  • Loading branch information
BarisYazici committed Dec 5, 2023
2 parents 3e595a6 + 74745b9 commit 3fe9b08
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 8 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# CHANGELOG

## 0.13.2 - 2023-12-04

* Hotfix: (temporary-workaround) for max-path-pose-deviation in ExternalMode for active control.


## 0.13.1 - 2023-11-30

* Hotfix: (temporary-workaround) for max-path-pose-deviation in ExternalMode for callback based control.
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.4)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

set(libfranka_VERSION 0.13.1)
set(libfranka_VERSION 0.13.2)

project(libfranka
VERSION ${libfranka_VERSION}
Expand Down
27 changes: 21 additions & 6 deletions src/robot_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

#include "load_calculations.h"

#include <franka/lowpass_filter.h>
#include <franka/rate_limiting.h>

namespace franka {

namespace {
Expand Down Expand Up @@ -90,20 +93,32 @@ RobotState Robot::Impl::readOnce() {
research_interface::robot::RobotState robot_state;
while (network_->udpReceive<decltype(robot_state)>(&robot_state)) {
}

return convertRobotState(receiveRobotState());
current_state_ = convertRobotState(receiveRobotState());
return current_state_;
}

void Robot::Impl::writeOnce(const Torques& control_input) {
research_interface::robot::ControllerCommand control_command =
createControllerCommand(control_input);

research_interface::robot::MotionGeneratorCommand motion_command{};
motion_command.dq_c = {0, 0, 0, 0, 0, 0, 0};
research_interface::robot::MotionGeneratorCommand command{};
double cutoff_frequency{100.0};

// Temporary workaround for the max-path-pose-deviation bug[BFFTRAC-1639]
JointVelocities motion(current_state_.dq);
command.dq_c = motion.dq;
for (size_t i = 0; i < 7; i++) {
command.dq_c[i] =
lowpassFilter(kDeltaT, command.dq_c[i], current_state_.dq_d[i], cutoff_frequency);
}
command.dq_c =
limitRate(computeUpperLimitsJointVelocity(current_state_.q_d),
computeLowerLimitsJointVelocity(current_state_.q_d), kMaxJointAcceleration,
kMaxJointJerk, command.dq_c, current_state_.dq_d, current_state_.ddq_d);
checkFinite(command.dq_c);

network_->tcpThrowIfConnectionClosed();

sendRobotCommand(&motion_command, &control_command);
sendRobotCommand(&command, &control_command);
}

template <typename MotionGeneratorType>
Expand Down
2 changes: 2 additions & 0 deletions src/robot_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ class Robot::Impl : public RobotControl {
bool controllerRunning() const noexcept;

private:
RobotState current_state_;

template <typename MotionGeneratorType>
void writeOnce(const MotionGeneratorType& motion_generator_input);

Expand Down
1 change: 0 additions & 1 deletion test/robot_impl_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@ TEST(RobotImpl, CanStartExternalControllerMotion) {
server
.onReceiveRobotCommand([=](const RobotCommand& command) {
EXPECT_EQ(kMessageID, command.message_id);
testMotionGeneratorCommandsAreEqual(sent_command.motion, command.motion);
testControllerCommandsAreEqual(sent_command.control, command.control);
})
.spinOnce();
Expand Down

0 comments on commit 3fe9b08

Please sign in to comment.