Skip to content

Feature/bldc haptics #60

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 31 commits into from
Jun 3, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
3522aef
feat(bldc_haptics): initial bldc_haptics component
finger563 May 25, 2023
04aa8ab
feat(bldc_haptics): remove empty src
finger563 May 25, 2023
e6ee866
feat(pid): udpate API
finger563 May 26, 2023
1c18925
chore(math): add maybe_unused to suppress compiler warning
finger563 May 26, 2023
ae25fb9
doc: update
finger563 May 26, 2023
f66034f
ci: update
finger563 May 26, 2023
f47e192
removed unneeded file
finger563 May 26, 2023
208ddcf
feat(bldc_driver): add fault
finger563 May 27, 2023
a76c066
feat(bldc_motor): update example
finger563 May 27, 2023
cdd3bd9
example(bldc_motor): update to use logger
finger563 May 27, 2023
550a203
example(bldc_haptics): update
finger563 May 27, 2023
dde3d42
feat(bldc_haptics): allow pid config
finger563 May 29, 2023
abfe080
feat(bldc_motor): refactor types
finger563 May 31, 2023
59e8acf
feat(bldc_haptics): updated interface
finger563 May 31, 2023
4ec09be
doc(rtsp): update
finger563 May 31, 2023
a56542a
doc(ftp): update
finger563 May 31, 2023
65f3ff7
feat(bldc_haptics): updated haptics
finger563 Jun 1, 2023
d5f41ca
doc
finger563 Jun 1, 2023
671d80f
doc: update
finger563 Jun 1, 2023
682ca04
doc: rebuild
finger563 Jun 1, 2023
e162a78
feat(haptics): update api
finger563 Jun 2, 2023
b52a513
example(haptics): update
finger563 Jun 2, 2023
114392e
update to use new logger
finger563 Jun 2, 2023
1e1d2c3
merge main
finger563 Jun 2, 2023
a874795
feat(bldc_motor): accept 0 targets in the move() command
finger563 Jun 2, 2023
58c45bb
feat(bldc_haptics): better behavior
finger563 Jun 2, 2023
ffaaad5
feat(bldc_motor): minor update
finger563 Jun 3, 2023
b71ab12
feat(bldc_haptics): working haptics example
finger563 Jun 3, 2023
8fb55f1
doc: rebuild
finger563 Jun 3, 2023
886d5e3
feat(bldc_haptics): update example
finger563 Jun 3, 2023
e3beb88
doc: rebuild
finger563 Jun 3, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat(bldc_motor): refactor types
* Moved non-templated types into their own header files (now inside espp::detail namespace) and updated example accordingly
  • Loading branch information
finger563 committed May 31, 2023
commit abfe080626b6233bb606538f5495ed4a3c17f302
32 changes: 16 additions & 16 deletions components/bldc_motor/example/main/bldc_motor_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ extern "C" void app_main(void) {
.current_limit = 0.5f, // Amps
.zero_electric_offset = 1.1784807f, // gotten from previously running without providing this
// and it will be logged.
.sensor_direction = BldcMotor::Direction::CLOCKWISE,
.foc_type = BldcMotor::FocType::SPACE_VECTOR_PWM,
.sensor_direction = espp::detail::SensorDirection::CLOCKWISE,
.foc_type = espp::detail::FocType::SPACE_VECTOR_PWM,
.driver = driver,
.sensor = mt6701,
.velocity_pid_config =
Expand All @@ -141,10 +141,10 @@ extern "C" void app_main(void) {
},
.log_level = espp::Logger::Verbosity::INFO});

// static const auto motion_control_type = BldcMotor::MotionControlType::VELOCITY;
static const auto motion_control_type = BldcMotor::MotionControlType::ANGLE;
// static const auto motion_control_type = BldcMotor::MotionControlType::VELOCITY_OPENLOOP;
// static const auto motion_control_type = BldcMotor::MotionControlType::ANGLE_OPENLOOP;
// static const auto motion_control_type = espp::detail::MotionControlType::VELOCITY;
static const auto motion_control_type = espp::detail::MotionControlType::ANGLE;
// static const auto motion_control_type = espp::detail::MotionControlType::VELOCITY_OPENLOOP;
// static const auto motion_control_type = espp::detail::MotionControlType::ANGLE_OPENLOOP;

// Set the motion control type and create a target for the motor (will be
// updated in the target update task below)
Expand All @@ -156,8 +156,8 @@ extern "C" void app_main(void) {
auto start = std::chrono::high_resolution_clock::now();
// command the motor
motor.loop_foc();
if (motion_control_type == BldcMotor::MotionControlType::VELOCITY ||
motion_control_type == BldcMotor::MotionControlType::VELOCITY_OPENLOOP) {
if (motion_control_type == espp::detail::MotionControlType::VELOCITY ||
motion_control_type == espp::detail::MotionControlType::VELOCITY_OPENLOOP) {
// if it's a velocity setpoint, convert it from RPM to rad/s
motor.move(target * espp::RPM_TO_RADS);
} else {
Expand Down Expand Up @@ -185,17 +185,17 @@ extern "C" void app_main(void) {
enum class IncrementDirection { DOWN = -1, HOLD = 0, UP = 1 };
static IncrementDirection increment_direction = IncrementDirection::UP;
static const bool is_angle =
motion_control_type == BldcMotor::MotionControlType::ANGLE ||
motion_control_type == BldcMotor::MotionControlType::ANGLE_OPENLOOP;
motion_control_type == espp::detail::MotionControlType::ANGLE ||
motion_control_type == espp::detail::MotionControlType::ANGLE_OPENLOOP;
static const float max_target = is_angle ? (2.0f * M_PI) : 200.0f;
static const float target_delta = is_angle ? (M_PI / 4.0f) : (50.0f * core_update_period);
switch (motion_control_type) {
case BldcMotor::MotionControlType::VELOCITY:
case BldcMotor::MotionControlType::VELOCITY_OPENLOOP:
case espp::detail::MotionControlType::VELOCITY:
case espp::detail::MotionControlType::VELOCITY_OPENLOOP:
target = 50.0f;
break;
case BldcMotor::MotionControlType::ANGLE:
case BldcMotor::MotionControlType::ANGLE_OPENLOOP:
case espp::detail::MotionControlType::ANGLE:
case espp::detail::MotionControlType::ANGLE_OPENLOOP:
target = M_PI; // 180 degrees (whereever that is...)
break;
default:
Expand Down Expand Up @@ -262,8 +262,8 @@ extern "C" void app_main(void) {
.callback = task_fn,
.stack_size_bytes = 5 * 1024,
.log_level = espp::Logger::Verbosity::WARN});
if (motion_control_type == BldcMotor::MotionControlType::VELOCITY ||
motion_control_type == BldcMotor::MotionControlType::VELOCITY_OPENLOOP) {
if (motion_control_type == espp::detail::MotionControlType::VELOCITY ||
motion_control_type == espp::detail::MotionControlType::VELOCITY_OPENLOOP) {
// if it's a velocity setpoint then target is RPM
fmt::print("%time(s), count, radians, degrees, target velocity (rpm), actual speed (rpm)\n");
} else {
Expand Down
Loading