Skip to content

Commit 9f5cc9b

Browse files
committed
expose diff-flatness FF enabler as launch arg
*use launch param to enable/disable FF in controller
1 parent 19920cb commit 9f5cc9b

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

freyja_controller.launch

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@
2020
<arg name="use_waypoint_handler" default="false" />
2121

2222
<!-- advanced settings -->
23-
<arg name="use_velctrl_only" default="false"/>
23+
<arg name="use_velctrl_only" default="false" />
2424
<arg name="bias_compensation" default="false" />
25+
<arg name="enable_flatness_ff" default="false" />
2526

2627
<!-- Used for examples -->
2728
<arg name="use_examples" default="false"/>
@@ -49,6 +50,7 @@
4950
<param name="bias_compensation" type="string" value="$(arg bias_compensation)" />
5051
<param name="mass_estimation" type="bool" value="true" />
5152
<param name="mass_correction" type="bool" value="false" />
53+
<param name="enable_flatness_ff" type="bool" value="$(arg enable_flatness_ff)" />
5254
</node>
5355

5456
<node name="lqr_vel_controller" pkg="lqr_control" type="lqr_vel_ctrl_node"
@@ -77,8 +79,12 @@
7779

7880

7981
<!-- handler for discrete waypoints -->
80-
<node name="waypoint_manager" pkg="waypoint_manager" type="waypoint_manager_node" output="screen"
81-
if="$(eval use_waypoint_handler)">
82+
<node name="waypoint_manager" pkg="waypoint_manager" type="waypoint_manager_node"
83+
output="screen" if="$(eval use_waypoint_handler and not use_examples)">
84+
<param name="init_pn" type="double" value="0.0" />
85+
<param name="init_pe" type="double" value="0.0" />
86+
<param name="init_pd" type="double" value="-0.5" />
87+
<param name="init_yaw" type="double" value="0.0" />
8288
</node>
8389

8490

lqg_controller/include/lqr_control_bias.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ class LQRController
4141

4242
/* Reference state vector */
4343
Eigen::Matrix<double, 7, 1> reference_state_;
44+
Eigen::Matrix<double, 4, 1> reference_ff_;
45+
bool enable_flatness_ff_;
4446

4547
/* Rate of execution for LQR's feedback */
4648
int controller_rate_;

lqg_controller/src/lqr_control_bias.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ LQRController::LQRController(BiasEstimator &b) : nh_(),
6868

6969
f_biases_ << 0.0, 0.0, 0.0;
7070

71+
/* Differential flatness feed-forward accelerations */
72+
priv_nh_.param( "enable_flatness_ff", enable_flatness_ff_, bool(false) );
73+
reference_ff_ << 0.0, 0.0, 0.0, 0.0;
74+
7175

7276
/* Mass estimation */
7377
enable_dyn_mass_correction_ = false;
@@ -187,6 +191,7 @@ void LQRController::trajectoryReferenceCallback( const TrajRef::ConstPtr &msg )
187191
reference_state_ << msg->pn, msg->pe, msg->pd, msg->vn, msg->ve, msg->vd, msg->yaw;
188192
reference_state_mutex_.unlock();
189193

194+
reference_ff_ << msg->an, msg->ae, msg->ad, 0.0; // only NED accelerations
190195
have_reference_update_ = true;
191196
}
192197

@@ -216,7 +221,8 @@ void LQRController::computeFeedback( const ros::TimerEvent &event )
216221
else
217222
{
218223
/* Compute control inputs (accelerations, in this case) */
219-
control_input = -1 * lqr_K_ * reduced_state_;
224+
control_input = -1 * lqr_K_ * reduced_state_
225+
+ static_cast<double>(enable_flatness_ff_) * reference_ff_;
220226

221227
/* Force saturation on downward acceleration */
222228
control_input(2) = std::min( control_input(2), 8.0 );

0 commit comments

Comments
 (0)