Skip to content

Commit c0ea09b

Browse files
Merge pull request #9 from franzesegiovanni/ft-external-fk
Ft external fk
2 parents 69651ae + b80d43a commit c0ea09b

13 files changed

+1580
-19
lines changed

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@ find_package(catkin REQUIRED COMPONENTS
2020
realtime_tools
2121
roscpp
2222
rospy
23+
urdf
2324
)
2425

2526
find_package(Eigen3 REQUIRED)
2627
find_package(Franka 0.7.0 REQUIRED)
28+
find_package(pinocchio REQUIRED)
2729

2830
add_message_files(FILES
2931
JointTorqueComparison.msg
@@ -60,6 +62,7 @@ catkin_package(
6062
add_library(franka_human_friendly_controllers
6163
src/cartesian_variable_impedance_controller.cpp
6264
src/joint_variable_impedance_controller.cpp
65+
src/cartesian_variable_impedance_external_model_controller.cpp
6366
)
6467

6568
add_dependencies(franka_human_friendly_controllers
@@ -73,12 +76,14 @@ add_dependencies(franka_human_friendly_controllers
7376
target_link_libraries(franka_human_friendly_controllers PUBLIC
7477
${Franka_LIBRARIES}
7578
${catkin_LIBRARIES}
79+
pinocchio::pinocchio
7680
)
7781

7882
target_include_directories(franka_human_friendly_controllers SYSTEM PUBLIC
7983
${Franka_INCLUDE_DIRS}
8084
${EIGEN3_INCLUDE_DIRS}
8185
${catkin_INCLUDE_DIRS}
86+
${PINOCCHIO_INCLUDE_DIRS}
8287
)
8388
target_include_directories(franka_human_friendly_controllers PUBLIC
8489
include

cfg/compliance_param.cfg

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ gen = ParameterGenerator()
88
gen.add("translational_stiffness_X", double_t, 0, "Cartesian translational stiffness", 400, 0, 4000)
99
gen.add("translational_stiffness_Y", double_t, 0, "Cartesian translational stiffness", 400, 0, 4000)
1010
gen.add("translational_stiffness_Z", double_t, 0, "Cartesian translational stiffness", 400, 0, 4000)
11-
gen.add("rotational_stiffness_X", double_t, 0, "Cartesian rotational stiffness", 30, 0, 50)
12-
gen.add("rotational_stiffness_Y", double_t, 0, "Cartesian rotational stiffness", 30, 0, 50)
13-
gen.add("rotational_stiffness_Z", double_t, 0, "Cartesian rotational stiffness", 30, 0, 50)
11+
gen.add("rotational_stiffness_X", double_t, 0, "Cartesian rotational stiffness", 30, 0, 40)
12+
gen.add("rotational_stiffness_Y", double_t, 0, "Cartesian rotational stiffness", 30, 0, 40)
13+
gen.add("rotational_stiffness_Z", double_t, 0, "Cartesian rotational stiffness", 30, 0, 40)
1414

1515
gen.add("nullspace_stiffness", double_t, 0, "Stiffness of the joint space nullspace controller (the desired configuration is the one at startup)", 0, 0, 100)
1616

config/franka_human_friendly_controllers.yaml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,15 @@ joint_variable_impedance_controller:
1919
- panda_joint4
2020
- panda_joint5
2121
- panda_joint6
22-
- panda_joint7
22+
- panda_joint7
23+
cartesian_variable_impedance_external_model_controller:
24+
type: franka_human_friendly_controllers/CartesianVariableImpedanceExternalModelController
25+
arm_id: panda
26+
joint_names:
27+
- panda_joint1
28+
- panda_joint2
29+
- panda_joint3
30+
- panda_joint4
31+
- panda_joint5
32+
- panda_joint6
33+
- panda_joint7

config/latest_config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"mass":0.9,"centerOfMass":[-0.002,0,0.034],"transformation":[0.7071,-0.7071,0,0,0.7071,0.7071,0,0,0,0,1,0,0,0,0.1034,1],"inertia":[0.001,0,0,0,0.0025,0,0,0,0.0017],"collisionModel":{"pointA":[0.03535533905932738,0.03535533905932738,0.04,0.03535533905932738,0.03535533905932738,0.1,0,0,0],"pointB":[-0.03535533905932738,-0.03535533905932738,0.04,-0.03535533905932738,-0.03535533905932738,0.1,0,0,0],"radius":[0.04,0.02,0]}}

franka_human_friendly_controllers_plugin.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,9 @@
99
A controller that renders a spring damper system in joint space.
1010
</description>
1111
</class>
12+
<class name="franka_human_friendly_controllers/CartesianVariableImpedanceExternalModelController" type="franka_human_friendly_controllers::CartesianVariableImpedanceExternalModelController" base_class_type="controller_interface::ControllerBase">
13+
<description>
14+
A controller that renders a spring damper system in cartesian space using an external urdf file as a model for forward kinematics and jacobian computation.
15+
</description>
16+
</class>
1217
</library>

include/franka_human_friendly_controllers/cartesian_variable_impedance_controller.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class CartesianVariableImpedanceController : public controller_interface::MultiI
3737
bool init(hardware_interface::RobotHW* robot_hw, ros::NodeHandle& node_handle) override;
3838
void starting(const ros::Time&) override;
3939
void update(const ros::Time&, const ros::Duration& period) override;
40+
virtual void loadModel();
4041

4142
private:
4243
// Saturation
@@ -45,7 +46,8 @@ class CartesianVariableImpedanceController : public controller_interface::MultiI
4546
const Eigen::Matrix<double, 7, 1>& tau_J_d); // NOLINT (readability-identifier-naming)
4647

4748
double calculateTauJointLimit(double q_value, double threshold, double magnitude, double upper_bound, double lower_bound);
48-
49+
virtual std::array<double, 42> get_jacobian(franka::RobotState robot_state);
50+
virtual double* get_fk(franka::RobotState robot_state);
4951

5052

5153
std::unique_ptr<franka_hw::FrankaStateHandle> state_handle_;
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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 <franka_human_friendly_controllers/cartesian_variable_impedance_controller.h>
6+
7+
namespace franka_human_friendly_controllers {
8+
9+
class CartesianVariableImpedanceExternalModelController : public CartesianVariableImpedanceController {
10+
private:
11+
std::string urdf_path_;
12+
pinocchio::Model model_pin_;
13+
pinocchio::Data* data_pin_;
14+
std::string frame_name_;
15+
int frame_id_;
16+
17+
public:
18+
double* get_fk(franka::RobotState robot_state) override;
19+
std::array<double, 42> get_jacobian(franka::RobotState robot_state) override;
20+
void loadModel() override;
21+
};
22+
23+
} // namespace franka_human_friendly_controllers

0 commit comments

Comments
 (0)