Skip to content

Commit 7c3801b

Browse files
committed
refactor(hw): guiding mode configure DOFs
1 parent f8f9354 commit 7c3801b

4 files changed

Lines changed: 20 additions & 13 deletions

File tree

python/rcsss/_core/hw/__init__.pyi

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,22 @@ class FR3(rcsss._core.common.Robot):
6262
) -> None: ...
6363
def set_cartesian_position_internal(self, pose: rcsss._core.common.Pose) -> None: ...
6464
def set_default_robot_behavior(self) -> None: ...
65-
def set_guiding_mode(self, enabled: bool) -> None: ...
65+
def set_guiding_mode(
66+
self,
67+
x: bool = True,
68+
y: bool = True,
69+
z: bool = True,
70+
roll: bool = True,
71+
pitch: bool = True,
72+
yaw: bool = True,
73+
elbow: bool = True,
74+
) -> None: ...
6675
def set_parameters(self, cfg: FR3Config) -> bool: ...
6776
def stop_control_thread(self) -> None: ...
6877
def zero_torque(self) -> None: ...
6978

7079
class FR3Config(rcsss._core.common.RConfig):
7180
async_control: bool
72-
guiding_mode_enabled: bool
7381
ik_solver: IKSolver
7482
load_parameters: FR3Load | None
7583
nominal_end_effector_frame: rcsss._core.common.Pose | None

src/hw/FR3.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ FR3::FR3(const std::string &ip, std::optional<std::shared_ptr<common::IK>> ik,
2424
: robot(ip), m_ik(ik) {
2525
// set collision behavior and impedance
2626
this->set_default_robot_behavior();
27-
this->set_guiding_mode(true);
27+
this->set_guiding_mode(true, true, true, true, true, true, true);
2828

2929
if (cfg.has_value()) {
3030
this->cfg = cfg.value();
@@ -121,11 +121,11 @@ common::Vector7d FR3::get_joint_position() {
121121
return joints;
122122
}
123123

124-
void FR3::set_guiding_mode(bool enabled) {
125-
std::array<bool, 6> activated;
126-
activated.fill(enabled);
127-
this->robot.setGuidingMode(activated, enabled);
128-
this->cfg.guiding_mode_enabled = enabled;
124+
void FR3::set_guiding_mode(bool x, bool y, bool z,
125+
bool roll, bool pitch, bool yaw,
126+
bool elbow) {
127+
std::array<bool, 6> activated = {x, y, z, roll, pitch, yaw};
128+
this->robot.setGuidingMode(activated, elbow);
129129
}
130130

131131
void PInverse(const Eigen::MatrixXd &M, Eigen::MatrixXd &M_inv,

src/hw/FR3.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ struct FR3Config : common::RConfig {
3535
// TODO: we can either write specific bindings for each, or we use python
3636
// dictionaries with these objects
3737
IKSolver ik_solver = IKSolver::franka;
38-
bool guiding_mode_enabled = true;
3938
double speed_factor = DEFAULT_SPEED_FACTOR;
4039
std::optional<FR3Load> load_parameters = std::nullopt;
4140
std::optional<common::Pose> nominal_end_effector_frame = std::nullopt;
@@ -79,7 +78,9 @@ class FR3 : public common::Robot {
7978

8079
common::Vector7d get_joint_position() override;
8180

82-
void set_guiding_mode(bool enabled);
81+
void set_guiding_mode(bool x, bool y, bool z,
82+
bool roll, bool pitch, bool yaw,
83+
bool elbow);
8384

8485
void controller_set_joint_position(const common::Vector7d &desired_q);
8586
void osc_set_cartesian_position(

src/pybind/rcsss.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,6 @@ PYBIND11_MODULE(_core, m) {
323323
.def(py::init<>())
324324
.def_readwrite("ik_solver", &rcs::hw::FR3Config::ik_solver)
325325
.def_readwrite("speed_factor", &rcs::hw::FR3Config::speed_factor)
326-
.def_readwrite("guiding_mode_enabled",
327-
&rcs::hw::FR3Config::guiding_mode_enabled)
328326
.def_readwrite("load_parameters", &rcs::hw::FR3Config::load_parameters)
329327
.def_readwrite("nominal_end_effector_frame",
330328
&rcs::hw::FR3Config::nominal_end_effector_frame)
@@ -362,7 +360,7 @@ PYBIND11_MODULE(_core, m) {
362360
.def("set_default_robot_behavior",
363361
&rcs::hw::FR3::set_default_robot_behavior)
364362
.def("set_guiding_mode", &rcs::hw::FR3::set_guiding_mode,
365-
py::arg("enabled"))
363+
py::arg("x") = true, py::arg("y") = true, py::arg("z") = true, py::arg("roll") = true, py::arg("pitch") = true, py::arg("yaw") = true, py::arg("elbow") = true)
366364
.def("zero_torque", &rcs::hw::FR3::zero_torque)
367365
.def("osc_set_cartesian_position",
368366
&rcs::hw::FR3::osc_set_cartesian_position,

0 commit comments

Comments
 (0)