Skip to content

Commit fd0787e

Browse files
committed
[actuation] Changed notion of propellers to thrusters
1 parent 89ec337 commit fd0787e

16 files changed

+255
-274
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
66

77
## [Unreleased]
88

9-
* Introduced floating base propeller actuation model in https://github.com/loco-3d/crocoddyl/pull/1213
9+
* Introduced floating base thruster actuation model in https://github.com/loco-3d/crocoddyl/pull/1213
1010
* Fixed quadruped and biped examples in https://github.com/loco-3d/crocoddyl/pull/1208
1111
* Fixed terminal computation in Python models in https://github.com/loco-3d/crocoddyl/pull/1204
1212
* Fixed handling of unbounded values for `ActivationBounds` in https://github.com/loco-3d/crocoddyl/pull/1191

bindings/python/crocoddyl/multibody/actuations/floating-base-propellers.cpp

+75-77
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
// All rights reserved.
77
///////////////////////////////////////////////////////////////////////////////
88

9-
#include "crocoddyl/multibody/actuations/floating-base-propellers.hpp"
10-
9+
#include "crocoddyl/multibody/actuations/floating-base-thrusters.hpp"
1110
#include "python/crocoddyl/multibody/multibody.hpp"
1211
#include "python/crocoddyl/utils/copyable.hpp"
1312
#include "python/crocoddyl/utils/printable.hpp"
@@ -17,84 +16,83 @@ namespace crocoddyl {
1716

1817
namespace python {
1918

20-
void exposeActuationFloatingBasePropeller() {
21-
bp::enum_<PropellerType>("PropellerType")
19+
void exposeActuationFloatingBaseThruster() {
20+
bp::enum_<ThrusterType>("ThrusterType")
2221
.value("CW", CW)
2322
.value("CCW", CCW)
2423
.export_values();
2524

26-
bp::class_<Propeller>(
27-
"Propeller", "Model for propellers",
28-
bp::init<pinocchio::SE3, double, double, bp::optional<PropellerType>>(
29-
bp::args("self", "M", "cthrust", "ctau", "type"),
30-
"Initialize the propeller in a give pose from the root joint.\n\n"
25+
bp::class_<Thruster>(
26+
"Thruster", "Model for thrusters",
27+
bp::init<pinocchio::SE3, double,
28+
bp::optional<ThrusterType, double, double>>(
29+
bp::args("self", "M", "ctorque", "type", "min_thrust", "max_thrust"),
30+
"Initialize the thruster in a give pose from the root joint.\n\n"
3131
":param M: pose from root joint\n"
32-
":param cthrust: coefficient of thrust (it relates propeller's "
33-
"(square) velocity to its thrust)\n"
34-
":param ctau: coefficient of torque (it relates propeller's (square) "
35-
"velocity to its torque)\n"
36-
":param type: type of propeller (clockwise or counterclockwise, "
37-
"default clockwise)"))
38-
.def(bp::init<double, double, bp::optional<PropellerType>>(
39-
bp::args("self", "cthrust", "ctau", "type"),
40-
"Initialize the propeller in a pose in the origin of the root "
41-
"joint.\n\n"
42-
":param cthrust: coefficient of thrust (it relates propeller's "
43-
"(square) velocity to its thrust)\n"
44-
":param ctau: coefficient of torque (it relates propeller's (square) "
45-
"velocity to its torque)\n"
46-
":param type: type of propeller (clockwise or counterclockwise, "
47-
"default clockwise)"))
48-
.def_readwrite("pose", &Propeller::pose,
49-
"propeller pose (traslation, rotation)")
50-
.def_readwrite("cthrust", &Propeller::cthrust, "coefficient of thrust")
51-
.def_readwrite("ctorque", &Propeller::ctorque, "coefficient of torque")
52-
.def_readwrite("type", &Propeller::type,
53-
"type of propeller (clockwise or counterclockwise)")
54-
.def(PrintableVisitor<Propeller>())
55-
.def(CopyableVisitor<Propeller>());
32+
":param ctorque: coefficient of generated torque per thrust\n"
33+
":param type: type of thruster (clockwise or counterclockwise, "
34+
"default clockwise)\n"
35+
":param min_thrust: minimum thrust (default 0.)\n"
36+
":param max_thrust: maximum thrust (default np.inf)"))
37+
.def(bp::init<double, bp::optional<ThrusterType, double, double>>(
38+
bp::args("self", "ctorque", "type", "min_thrust", "max_thrust"),
39+
"Initialize the thruster in a give pose from the root joint.\n\n"
40+
":param ctorque: coefficient of generated torque per thrust\n"
41+
":param type: type of thruster (clockwise or counterclockwise, "
42+
"default clockwise)\n"
43+
":param min_thrust: minimum thrust (default 0.)\n"
44+
":param max_thrust: maximum thrust (default np.inf)"))
45+
.def_readwrite("pose", &Thruster::pose,
46+
"thruster pose (traslation, rotation)")
47+
.def_readwrite("ctorque", &Thruster::ctorque,
48+
"coefficient of generated torque per thrust")
49+
.def_readwrite("type", &Thruster::type,
50+
"type of thruster (clockwise or counterclockwise)")
51+
.def_readwrite("min_thrust", &Thruster::min_thrust, "minimum thrust")
52+
.def_readwrite("max_thrust", &Thruster::min_thrust, "maximum thrust")
53+
.def(PrintableVisitor<Thruster>())
54+
.def(CopyableVisitor<Thruster>());
5655

57-
StdVectorPythonVisitor<std::vector<Propeller>, true>::expose(
58-
"StdVec_Propeller");
56+
StdVectorPythonVisitor<std::vector<Thruster>, true>::expose(
57+
"StdVec_Thruster");
5958

6059
bp::register_ptr_to_python<
61-
boost::shared_ptr<crocoddyl::ActuationModelFloatingBasePropellers>>();
60+
boost::shared_ptr<crocoddyl::ActuationModelFloatingBaseThrusters>>();
6261

63-
bp::class_<ActuationModelFloatingBasePropellers,
62+
bp::class_<ActuationModelFloatingBaseThrusters,
6463
bp::bases<ActuationModelAbstract>>(
65-
"ActuationModelFloatingBasePropellers",
66-
"Actuation models for floating base systems actuated with propellers "
64+
"ActuationModelFloatingBaseThrusters",
65+
"Actuation models for floating base systems actuated with thrusters "
6766
"(e.g. aerial "
6867
"manipulators).",
69-
bp::init<boost::shared_ptr<StateMultibody>, std::vector<Propeller>>(
70-
bp::args("self", "state", "propellers"),
68+
bp::init<boost::shared_ptr<StateMultibody>, std::vector<Thruster>>(
69+
bp::args("self", "state", "thrusters"),
7170
"Initialize the floating base actuation model equipped with "
72-
"propellers.\n\n"
71+
"thrusters.\n\n"
7372
":param state: state of multibody system\n"
74-
":param propellers: vector of propellers"))
75-
.def<void (ActuationModelFloatingBasePropellers::*)(
73+
":param thrusters: vector of thrusters"))
74+
.def<void (ActuationModelFloatingBaseThrusters::*)(
7675
const boost::shared_ptr<ActuationDataAbstract>&,
7776
const Eigen::Ref<const Eigen::VectorXd>&,
7877
const Eigen::Ref<const Eigen::VectorXd>&)>(
79-
"calc", &ActuationModelFloatingBasePropellers::calc,
78+
"calc", &ActuationModelFloatingBaseThrusters::calc,
8079
bp::args("self", "data", "x", "u"),
8180
"Compute the actuation signal and actuation set from the thrust\n"
8281
"forces and joint torque inputs u.\n\n"
83-
":param data: floating base propellers actuation data\n"
82+
":param data: floating base thrusters actuation data\n"
8483
":param x: state point (dim. state.nx)\n"
8584
":param u: joint torque input (dim. nu)")
86-
.def(
87-
"calcDiff", &ActuationModelFloatingBasePropellers::calcDiff,
88-
bp::args("self", "data", "x", "u"),
89-
"Compute the derivatives of the actuation model.\n\n"
90-
"It computes the partial derivatives of the propeller actuation. It\n"
91-
"assumes that calc has been run first. The reason is that the\n"
92-
"derivatives are constant and defined in createData. The Hessian\n"
93-
"is constant, so we don't write again this value.\n"
94-
":param data: floating base propellers actuation data\n"
95-
":param x: state point (dim. state.nx)\n"
96-
":param u: joint torque input (dim. nu)")
97-
.def("commands", &ActuationModelFloatingBasePropellers::commands,
85+
.def("calcDiff", &ActuationModelFloatingBaseThrusters::calcDiff,
86+
bp::args("self", "data", "x", "u"),
87+
"Compute the derivatives of the actuation model.\n\n"
88+
"It computes the partial derivatives of the thruster actuation. It\n"
89+
"assumes that calc has been run first. The reason is that the\n"
90+
"derivatives are constant and defined in createData. The Hessian\n"
91+
"is constant, so we don't write again this value.\n"
92+
":param data: floating base thrusters actuation data\n"
93+
":param x: state point (dim. state.nx)\n"
94+
":param u: joint torque input (dim. nu)")
95+
.def("commands", &ActuationModelFloatingBaseThrusters::commands,
9896
bp::args("self", "data", "x", "tau"),
9997
"Compute the thrust and joint torque commands from the generalized "
10098
"torques.\n\n"
@@ -103,40 +101,40 @@ void exposeActuationFloatingBasePropeller() {
103101
":param x: state point (dim. state.nx)\n"
104102
":param tau: generalized torques (dim state.nv)")
105103
.def("torqueTransform",
106-
&ActuationModelFloatingBasePropellers::torqueTransform,
104+
&ActuationModelFloatingBaseThrusters::torqueTransform,
107105
bp::args("self", "data", "x", "tau"),
108106
"Compute the torque transform from generalized torques to thrust "
109107
"and joint torque inputs.\n\n"
110108
"It stores the results in data.Mtau.\n"
111-
":param data: floating base propellers actuation data\n"
109+
":param data: floating base thrusters actuation data\n"
112110
":param x: state point (dim. state.nx)\n"
113111
":param tau: generalized torques (dim state.nv)")
114-
.def("createData", &ActuationModelFloatingBasePropellers::createData,
112+
.def("createData", &ActuationModelFloatingBaseThrusters::createData,
115113
bp::args("self"),
116-
"Create the floating base propellers actuation data.")
117-
.add_property("propellers",
118-
bp::make_function(
119-
&ActuationModelFloatingBasePropellers::get_propellers,
120-
bp::return_value_policy<bp::return_by_value>()),
121-
bp::make_function(
122-
&ActuationModelFloatingBasePropellers::set_propellers),
123-
"vector of propellers")
124-
.add_property("npropellers",
114+
"Create the floating base thrusters actuation data.")
115+
.add_property(
116+
"thrusters",
117+
bp::make_function(&ActuationModelFloatingBaseThrusters::get_thrusters,
118+
bp::return_value_policy<bp::return_by_value>()),
119+
bp::make_function(
120+
&ActuationModelFloatingBaseThrusters::set_thrusters),
121+
"vector of thrusters")
122+
.add_property("nthrusters",
125123
bp::make_function(
126-
&ActuationModelFloatingBasePropellers::get_npropellers),
127-
"number of propellers")
124+
&ActuationModelFloatingBaseThrusters::get_nthrusters),
125+
"number of thrusters")
128126
.add_property(
129127
"Wthrust",
130-
bp::make_function(&ActuationModelFloatingBasePropellers::get_Wthrust,
128+
bp::make_function(&ActuationModelFloatingBaseThrusters::get_Wthrust,
131129
bp::return_value_policy<bp::return_by_value>()),
132-
"matrix mapping from thrusts to propeller wrenches")
130+
"matrix mapping from thrusts to thruster wrenches")
133131
.add_property(
134132
"S",
135-
bp::make_function(&ActuationModelFloatingBasePropellers::get_S,
133+
bp::make_function(&ActuationModelFloatingBaseThrusters::get_S,
136134
bp::return_value_policy<bp::return_by_value>()),
137135
"selection matrix for under-actuation part")
138-
.def(PrintableVisitor<ActuationModelFloatingBasePropellers>())
139-
.def(CopyableVisitor<ActuationModelFloatingBasePropellers>());
136+
.def(PrintableVisitor<ActuationModelFloatingBaseThrusters>())
137+
.def(CopyableVisitor<ActuationModelFloatingBaseThrusters>());
140138
}
141139

142140
} // namespace python

bindings/python/crocoddyl/multibody/multibody.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ void exposeMultibody() {
1818
exposeStateMultibody();
1919
exposeActuationFloatingBase();
2020
exposeActuationFull();
21-
exposeActuationFloatingBasePropeller();
21+
exposeActuationFloatingBaseThruster();
2222
exposeActuationModelMultiCopterBase();
2323
exposeForceAbstract();
2424
exposeContactAbstract();

bindings/python/crocoddyl/multibody/multibody.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ void exposeCoPSupport();
2323
void exposeStateMultibody();
2424
void exposeActuationFloatingBase();
2525
void exposeActuationFull();
26-
void exposeActuationFloatingBasePropeller();
26+
void exposeActuationFloatingBaseThruster();
2727
void exposeActuationModelMultiCopterBase();
2828
void exposeForceAbstract();
2929
void exposeContactAbstract();

examples/quadrotor_fwddyn.py

+13-29
Original file line numberDiff line numberDiff line change
@@ -21,46 +21,30 @@
2121

2222
state = crocoddyl.StateMultibody(robot_model)
2323

24-
d_cog, cf, cm, u_lim, l_lim = 0.1525, 6.6e-5, 1e-6, 5.0, 0.1
25-
tau_f = np.array(
26-
[
27-
[0.0, 0.0, 0.0, 0.0],
28-
[0.0, 0.0, 0.0, 0.0],
29-
[1.0, 1.0, 1.0, 1.0],
30-
[0.0, d_cog, 0.0, -d_cog],
31-
[-d_cog, 0.0, d_cog, 0.0],
32-
[-cm / cf, cm / cf, -cm / cf, cm / cf],
33-
]
34-
)
35-
3624
d_cog, cf, cm, u_lim, l_lim = 0.1525, 6.6e-5, 1e-6, 5.0, 0.1
3725
ps = [
38-
crocoddyl.Propeller(
26+
crocoddyl.Thruster(
3927
pinocchio.SE3(np.eye(3), np.array([d_cog, 0, 0])),
40-
cf,
41-
cm,
42-
crocoddyl.PropellerType.CCW,
28+
cm / cf,
29+
crocoddyl.ThrusterType.CCW,
4330
),
44-
crocoddyl.Propeller(
31+
crocoddyl.Thruster(
4532
pinocchio.SE3(np.eye(3), np.array([0, d_cog, 0])),
46-
cf,
47-
cm,
48-
crocoddyl.PropellerType.CW,
33+
cm / cf,
34+
crocoddyl.ThrusterType.CW,
4935
),
50-
crocoddyl.Propeller(
36+
crocoddyl.Thruster(
5137
pinocchio.SE3(np.eye(3), np.array([-d_cog, 0, 0])),
52-
cf,
53-
cm,
54-
crocoddyl.PropellerType.CCW,
38+
cm / cf,
39+
crocoddyl.ThrusterType.CCW,
5540
),
56-
crocoddyl.Propeller(
41+
crocoddyl.Thruster(
5742
pinocchio.SE3(np.eye(3), np.array([0, -d_cog, 0])),
58-
cf,
59-
cm,
60-
crocoddyl.PropellerType.CW,
43+
cm / cf,
44+
crocoddyl.ThrusterType.CW,
6145
),
6246
]
63-
actuation = crocoddyl.ActuationModelFloatingBasePropellers(state, ps)
47+
actuation = crocoddyl.ActuationModelFloatingBaseThrusters(state, ps)
6448

6549
nu = actuation.nu
6650
runningCostModel = crocoddyl.CostModelSum(state, nu)

examples/quadrotor_invdyn.py

+13-17
Original file line numberDiff line numberDiff line change
@@ -23,32 +23,28 @@
2323

2424
d_cog, cf, cm, u_lim, l_lim = 0.1525, 6.6e-5, 1e-6, 5.0, 0.1
2525
ps = [
26-
crocoddyl.Propeller(
26+
crocoddyl.Thruster(
2727
pinocchio.SE3(np.eye(3), np.array([d_cog, 0, 0])),
28-
cf,
29-
cm,
30-
crocoddyl.PropellerType.CCW,
28+
cm / cf,
29+
crocoddyl.ThrusterType.CCW,
3130
),
32-
crocoddyl.Propeller(
31+
crocoddyl.Thruster(
3332
pinocchio.SE3(np.eye(3), np.array([0, d_cog, 0])),
34-
cf,
35-
cm,
36-
crocoddyl.PropellerType.CW,
33+
cm / cf,
34+
crocoddyl.ThrusterType.CW,
3735
),
38-
crocoddyl.Propeller(
36+
crocoddyl.Thruster(
3937
pinocchio.SE3(np.eye(3), np.array([-d_cog, 0, 0])),
40-
cf,
41-
cm,
42-
crocoddyl.PropellerType.CCW,
38+
cm / cf,
39+
crocoddyl.ThrusterType.CCW,
4340
),
44-
crocoddyl.Propeller(
41+
crocoddyl.Thruster(
4542
pinocchio.SE3(np.eye(3), np.array([0, -d_cog, 0])),
46-
cf,
47-
cm,
48-
crocoddyl.PropellerType.CW,
43+
cm / cf,
44+
crocoddyl.ThrusterType.CW,
4945
),
5046
]
51-
actuation = crocoddyl.ActuationModelFloatingBasePropellers(state, ps)
47+
actuation = crocoddyl.ActuationModelFloatingBaseThrusters(state, ps)
5248

5349
nu = state.nv
5450
runningCostModel = crocoddyl.CostModelSum(state, nu)

examples/quadrotor_ubound.py

+13-17
Original file line numberDiff line numberDiff line change
@@ -23,32 +23,28 @@
2323

2424
d_cog, cf, cm, u_lim, l_lim = 0.1525, 6.6e-5, 1e-6, 5.0, 0.1
2525
ps = [
26-
crocoddyl.Propeller(
26+
crocoddyl.Thruster(
2727
pinocchio.SE3(np.eye(3), np.array([d_cog, 0, 0])),
28-
cf,
29-
cm,
30-
crocoddyl.PropellerType.CCW,
28+
cm / cf,
29+
crocoddyl.ThrusterType.CCW,
3130
),
32-
crocoddyl.Propeller(
31+
crocoddyl.Thruster(
3332
pinocchio.SE3(np.eye(3), np.array([0, d_cog, 0])),
34-
cf,
35-
cm,
36-
crocoddyl.PropellerType.CW,
33+
cm / cf,
34+
crocoddyl.ThrusterType.CW,
3735
),
38-
crocoddyl.Propeller(
36+
crocoddyl.Thruster(
3937
pinocchio.SE3(np.eye(3), np.array([-d_cog, 0, 0])),
40-
cf,
41-
cm,
42-
crocoddyl.PropellerType.CCW,
38+
cm / cf,
39+
crocoddyl.ThrusterType.CCW,
4340
),
44-
crocoddyl.Propeller(
41+
crocoddyl.Thruster(
4542
pinocchio.SE3(np.eye(3), np.array([0, -d_cog, 0])),
46-
cf,
47-
cm,
48-
crocoddyl.PropellerType.CW,
43+
cm / cf,
44+
crocoddyl.ThrusterType.CW,
4945
),
5046
]
51-
actuation = crocoddyl.ActuationModelFloatingBasePropellers(state, ps)
47+
actuation = crocoddyl.ActuationModelFloatingBaseThrusters(state, ps)
5248

5349
nu = actuation.nu
5450
runningCostModel = crocoddyl.CostModelSum(state, nu)

0 commit comments

Comments
 (0)