Skip to content

Commit

Permalink
Add brake mode setting
Browse files Browse the repository at this point in the history
  • Loading branch information
jeholliday committed Jan 28, 2020
1 parent 6952568 commit 9c99197
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions robot_motor_control/cfg/Talon.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ gen.add("invert_sensor", bool_t, 0, "Invert Sensor", False)
gen.add("cont_current", int_t, 0, "Continuous Current Limit (A)", 30, 0, 60)
#gen.add("peak_current", int_t, 0, "Peak Current Limit (A)", 30, 0, 100)
gen.add("peak_current_dur", int_t, 0, "Peak Current Duration (ms)", 100, 0, 2000)
gen.add("brake_mode", bool_t, 0, "Brake Mode", True)

gen.add("P", double_t, 0, "P", 0, 0, 100000)
gen.add("I", double_t, 0, "I", 0, 0, 100000)
Expand Down
6 changes: 6 additions & 0 deletions robot_motor_control/src/TalonNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,12 @@ void TalonNode::configure()
talon.SetInverted(_config.inverted);
talon.EnableVoltageCompensation(true);

if (_config.brake_mode) {
talon.SetNeutralMode(NeutralMode::Brake);
} else {
talon.SetNeutralMode(NeutralMode::Coast);
}

ROS_INFO("Reconfigured Talon: %s with %d %f %f %f", _name.c_str(), talon.GetDeviceID(), _config.P, _config.I,
_config.D);
this->configured = true;
Expand Down

0 comments on commit 9c99197

Please sign in to comment.