Skip to content

Commit 260816d

Browse files
committed
style: cpp format
1 parent d61db2a commit 260816d

5 files changed

Lines changed: 22 additions & 16 deletions

File tree

extensions/rcs_fr3/src/hw/Franka.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
namespace rcs {
2121
namespace hw {
2222
Franka::Franka(const std::string &ip,
23-
std::optional<std::shared_ptr<common::Kinematics>> ik,
24-
const std::optional<FrankaConfig> &cfg)
23+
std::optional<std::shared_ptr<common::Kinematics>> ik,
24+
const std::optional<FrankaConfig> &cfg)
2525
: robot(ip), m_ik(ik) {
2626
// set collision behavior and impedance
2727
this->set_default_robot_behavior();
@@ -123,7 +123,7 @@ common::VectorXd Franka::get_joint_position() {
123123
}
124124

125125
void Franka::set_guiding_mode(bool x, bool y, bool z, bool roll, bool pitch,
126-
bool yaw, bool elbow) {
126+
bool yaw, bool elbow) {
127127
std::array<bool, 6> activated = {x, y, z, roll, pitch, yaw};
128128
this->robot.setGuidingMode(activated, elbow);
129129
}
@@ -586,7 +586,9 @@ void Franka::move_home() {
586586
this->robot.control(motion_generator);
587587
}
588588

589-
void Franka::automatic_error_recovery() { this->robot.automaticErrorRecovery(); }
589+
void Franka::automatic_error_recovery() {
590+
this->robot.automaticErrorRecovery();
591+
}
590592

591593
void Franka::reset() {
592594
this->stop_control_thread();
@@ -707,9 +709,9 @@ common::Pose Franka::get_base_pose_in_world_coordinates() {
707709
}
708710

709711
void Franka::set_cartesian_position_internal(const common::Pose &pose,
710-
double max_time,
711-
std::optional<double> elbow,
712-
std::optional<double> max_force) {
712+
double max_time,
713+
std::optional<double> elbow,
714+
std::optional<double> max_force) {
713715
// TODO: use speed factor instead of max_time
714716
common::Pose initial_pose = this->get_cartesian_position();
715717

extensions/rcs_fr3/src/hw/Franka.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ struct PandaConfig : FrankaConfig {
4949
common::RobotType robot_type = common::RobotType::Panda;
5050
};
5151

52-
5352
struct FrankaState : common::RobotState {};
5453

5554
class Franka : public common::Robot {
@@ -70,8 +69,8 @@ class Franka : public common::Robot {
7069

7170
public:
7271
Franka(const std::string &ip,
73-
std::optional<std::shared_ptr<common::Kinematics>> ik = std::nullopt,
74-
const std::optional<FrankaConfig> &cfg = std::nullopt);
72+
std::optional<std::shared_ptr<common::Kinematics>> ik = std::nullopt,
73+
const std::optional<FrankaConfig> &cfg = std::nullopt);
7574
~Franka() override;
7675

7776
bool set_config(const FrankaConfig &cfg);

extensions/rcs_fr3/src/hw/FrankaMotionGenerator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ void setDefaultBehavior(franka::Robot& robot) {
2424
}
2525

2626
FrankaMotionGenerator::FrankaMotionGenerator(double speed_factor,
27-
const common::Vector7d q_goal)
27+
const common::Vector7d q_goal)
2828
: q_goal_(q_goal) {
2929
dq_max_ *= speed_factor;
3030
ddq_max_start_ *= speed_factor;

extensions/rcs_fr3/src/pybind/rcs.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ PYBIND11_MODULE(_core, m) {
4343

4444
py::object robot_state =
4545
(py::object)py::module_::import("rcs").attr("common").attr("RobotState");
46-
py::class_<rcs::hw::FrankaState>(hw, "FrankaState", robot_state).def(py::init<>());
46+
py::class_<rcs::hw::FrankaState>(hw, "FrankaState", robot_state)
47+
.def(py::init<>());
4748
py::class_<rcs::hw::FrankaLoad>(hw, "FrankaLoad")
4849
.def(py::init<>())
4950
.def_readwrite("load_mass", &rcs::hw::FrankaLoad::load_mass)
@@ -99,7 +100,8 @@ PYBIND11_MODULE(_core, m) {
99100

100101
py::object robot =
101102
(py::object)py::module_::import("rcs").attr("common").attr("Robot");
102-
py::class_<rcs::hw::Franka, std::shared_ptr<rcs::hw::Franka>>(hw, "Franka", robot)
103+
py::class_<rcs::hw::Franka, std::shared_ptr<rcs::hw::Franka>>(hw, "Franka",
104+
robot)
103105
.def(py::init<const std::string &,
104106
std::optional<std::shared_ptr<rcs::common::Kinematics>>>(),
105107
py::arg("ip"), py::arg("ik") = std::nullopt)
@@ -117,9 +119,11 @@ PYBIND11_MODULE(_core, m) {
117119
&rcs::hw::Franka::osc_set_cartesian_position,
118120
py::arg("desired_pos_EE_in_base_frame"))
119121
.def("controller_set_joint_position",
120-
&rcs::hw::Franka::controller_set_joint_position, py::arg("desired_q"))
122+
&rcs::hw::Franka::controller_set_joint_position,
123+
py::arg("desired_q"))
121124
.def("stop_control_thread", &rcs::hw::Franka::stop_control_thread)
122-
.def("automatic_error_recovery", &rcs::hw::Franka::automatic_error_recovery)
125+
.def("automatic_error_recovery",
126+
&rcs::hw::Franka::automatic_error_recovery)
123127
.def("double_tap_robot_to_continue",
124128
&rcs::hw::Franka::double_tap_robot_to_continue)
125129
.def("set_cartesian_position_internal",

src/sim/test.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,8 @@ int test_sim() {
147147
"robot should not be moving at the end of a step");
148148
}
149149
if (not state->is_arrived) {
150-
throw std::runtime_error("robot should be arrived at the end of a step");
150+
throw std::runtime_error(
151+
"robot should be arrived at the end of a step");
151152
}
152153
/* According to fact sheet, pose repeatability within iso cube is 0.1
153154
* millimeters, i.e. 0.0001 meters.

0 commit comments

Comments
 (0)