Skip to content

Commit 7c4d48a

Browse files
committed
style: format
1 parent 4e2d5a2 commit 7c4d48a

File tree

3 files changed

+22
-21
lines changed

3 files changed

+22
-21
lines changed

extensions/rcs_fr3/src/hw/Franka.cpp

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ void PInverse(const Eigen::MatrixXd &M, Eigen::MatrixXd &M_inv,
146146
S_inv.setZero();
147147
double damping = damping_factor * damping_factor;
148148
for (int i = 0; i < singular_vals.size(); i++) {
149-
S_inv(i, i) = singular_vals(i) /
150-
(singular_vals(i) * singular_vals(i) + damping);
149+
S_inv(i, i) =
150+
singular_vals(i) / (singular_vals(i) * singular_vals(i) + damping);
151151
}
152152
M_inv = Eigen::MatrixXd(svd.matrixV() * S_inv * svd.matrixU().transpose());
153153
}
@@ -193,15 +193,14 @@ void Franka::controller_set_joint_position(const common::Vector7d &desired_q) {
193193
throw std::runtime_error(
194194
"Desired joint configuration is too far from current configuration. "
195195
"Distance: " +
196-
std::to_string(joint_dist) +
197-
" rad, Limit: " + std::to_string(this->cfg.max_joint_dist.value()) +
198-
" rad.");
196+
std::to_string(joint_dist) + " rad, Limit: " +
197+
std::to_string(this->cfg.max_joint_dist.value()) + " rad.");
199198
}
200199
}
201200

202-
this->joint_interpolator.reset(
203-
this->controller_time, current_q, desired_q, policy_rate, traj_rate,
204-
traj_interpolation_time_fraction);
201+
this->joint_interpolator.reset(this->controller_time, current_q, desired_q,
202+
policy_rate, traj_rate,
203+
traj_interpolation_time_fraction);
205204

206205
// if not thread is running, then start
207206
if (this->running_controller == Controller::none) {
@@ -237,18 +236,18 @@ void Franka::osc_set_cartesian_position(
237236

238237
// Safety check for distance
239238
if (this->cfg.max_cartesian_pos_dist.has_value()) {
240-
double dist = (curr_pose.translation() -
241-
desired_pose_EE_in_base_frame.translation())
242-
.norm();
239+
double dist =
240+
(curr_pose.translation() - desired_pose_EE_in_base_frame.translation())
241+
.norm();
243242
if (dist > this->cfg.max_cartesian_pos_dist.value()) {
244243
if (this->running_controller == Controller::osc) {
245244
this->interpolator_mutex.unlock();
246245
}
247246
throw std::runtime_error(
248-
"Desired cartesian position is too far from current position (dist: " +
249-
std::to_string(dist) +
250-
"m, max: " + std::to_string(cfg.max_cartesian_pos_dist.value()) +
251-
"m)");
247+
"Desired cartesian position is too far from current position "
248+
"(dist: " +
249+
std::to_string(dist) + "m, max: " +
250+
std::to_string(cfg.max_cartesian_pos_dist.value()) + "m)");
252251
}
253252
}
254253
// Safety check for orientation
@@ -263,9 +262,8 @@ void Franka::osc_set_cartesian_position(
263262
throw std::runtime_error(
264263
"Desired cartesian orientation is too far from current orientation "
265264
"(dist: " +
266-
std::to_string(angle) +
267-
"rad, max: " + std::to_string(cfg.max_cartesian_ori_dist.value()) +
268-
"rad)");
265+
std::to_string(angle) + "rad, max: " +
266+
std::to_string(cfg.max_cartesian_ori_dist.value()) + "rad)");
269267
}
270268
}
271269

extensions/rcs_fr3/src/hw/Franka.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ struct FrankaConfig : common::RobotConfig {
4646
// Safety limits for rejecting distant targets
4747
std::optional<double> max_cartesian_pos_dist = 0.3; // in meters
4848
std::optional<double> max_cartesian_ori_dist = 1.57; // in radians (90 deg)
49-
std::optional<double> max_joint_dist = 1.5; // norm of joint vector in radians
49+
std::optional<double> max_joint_dist =
50+
1.5; // norm of joint vector in radians
5051
};
5152

5253
struct FR3Config : FrankaConfig {};

extensions/rcs_fr3/src/pybind/rcs.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,10 @@ PYBIND11_MODULE(_core, m) {
6767
&rcs::hw::FrankaConfig::nominal_end_effector_frame)
6868
.def_readwrite("world_to_robot", &rcs::hw::FrankaConfig::world_to_robot)
6969
.def_readwrite("async_control", &rcs::hw::FrankaConfig::async_control)
70-
.def_readwrite("max_cartesian_pos_dist", &rcs::hw::FrankaConfig::max_cartesian_pos_dist)
71-
.def_readwrite("max_cartesian_ori_dist", &rcs::hw::FrankaConfig::max_cartesian_ori_dist)
70+
.def_readwrite("max_cartesian_pos_dist",
71+
&rcs::hw::FrankaConfig::max_cartesian_pos_dist)
72+
.def_readwrite("max_cartesian_ori_dist",
73+
&rcs::hw::FrankaConfig::max_cartesian_ori_dist)
7274
.def_readwrite("max_joint_dist", &rcs::hw::FrankaConfig::max_joint_dist);
7375

7476
py::class_<rcs::hw::FR3Config, rcs::hw::FrankaConfig>(hw, "FR3Config")

0 commit comments

Comments
 (0)