Skip to content

Commit

Permalink
Fixed bugs with launching and clarified some parameters.
Browse files Browse the repository at this point in the history
  • Loading branch information
iandareid committed Jun 18, 2024
1 parent 710f205 commit 15c2a14
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 29 deletions.
2 changes: 1 addition & 1 deletion rosplane/scripts/rosplane_gcs_launch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ fi

# Check to see if rc_sim has been passed an arg
if $rc_sim; then
tmux send-keys -t rosplane_sim_session:0.3 'ros2 run rosflight_sim rc_sim.py --ros-args --remap RC:=/fixedwing/RC' C-m
tmux send-keys -t rosplane_sim_session:0.3 'ros2 run rosflight_sim rc.py --ros-args --remap RC:=/fixedwing/RC' C-m
fi

if $sim; then
Expand Down
4 changes: 2 additions & 2 deletions rosplane/src/controller_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ controller_base::controller_base()
void controller_base::declare_parameters()
{
// Declare default parameters associated with this controller, controller_base
params.declare_bool("roll_command_override", false);
params.declare_bool("pitch_command_override", false);
params.declare_bool("roll_command_override", false); // TODO: move this to controller_successive_loop.
params.declare_bool("pitch_command_override", false); // TODO: move this to controller_successive_loop.
params.declare_double("pwm_rad_e", 1.0);
params.declare_double("pwm_rad_a", 1.0);
params.declare_double("pwm_rad_r", 1.0);
Expand Down
6 changes: 3 additions & 3 deletions rosplane/src/controller_total_energy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ void controller_total_energy::update_energies(float va_c, float va, float h_c, f
// For readability, declare parameters here that will be used in this function
double mass = params.get_double("mass");
double gravity = params.get_double("gravity");
double max_energy = params.get_double("max_energy");
double max_alt_error = params.get_double("max_alt_error");

// Calculate the error in kinetic energy.
K_error = 0.5 * mass * (pow(va_c, 2) - pow(va, 2));
Expand All @@ -164,7 +164,7 @@ void controller_total_energy::update_energies(float va_c, float va, float h_c, f
K_ref = 0.5 * mass * pow(va_c, 2);

// Calculate the error in the potential energy.
U_error = mass * gravity * sat(h_c - h, max_energy, -max_energy);
U_error = mass * gravity * sat(h_c - h, max_alt_error, -max_alt_error);
}

void controller_total_energy::declare_parameters()
Expand All @@ -180,6 +180,6 @@ void controller_total_energy::declare_parameters()

params.declare_double("mass", 2.28);
params.declare_double("gravity", 9.8);
params.declare_double("max_energy", 5.0);
params.declare_double("max_alt_error", 5.0);
}
} // namespace rosplane
2 changes: 1 addition & 1 deletion rosplane_msgs/msg/Command.msg
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ uint8 ignore # bitmask for ignore specific setpoint values
float32 x
float32 y
float32 z
float32 f # This threw an error with the original name of F
float32 f
11 changes: 0 additions & 11 deletions rosplane_sim/launch/sim.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,5 @@ def generate_launch_description():
package = 'rosplane_sim',
executable='rosplane_gazebo_truth_publisher',
name='gazebo_truth'
),
Node(
package='rosplane_tuning',
executable='data_viz.py',
name='uav_plotter',
parameters=[{
'use_sim_time': False,
't_horizon': 100.,
'plot_sensors': False
}],
output='screen'
)
])
11 changes: 0 additions & 11 deletions rosplane_sim/launch/sim_tuning.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,6 @@ def generate_launch_description():
package = 'rosplane_sim',
executable='rosplane_gazebo_truth_publisher',
name='gazebo_truth'
),
Node(
package='rosplane_tuning',
executable='data_viz.py',
name='uav_plotter',
parameters=[{
'use_sim_time': False,
't_horizon': 100.,
'plot_sensors': False
}],
output='screen'
)
])

0 comments on commit 15c2a14

Please sign in to comment.