-
Notifications
You must be signed in to change notification settings - Fork 1
RMD first position control cmd not working #41
Copy link
Copy link
Open
Description
The RMD ignores the first position control message but when the position but when a dummy message is placed at the begging then the RMD works as coded.
Code:
hal::degrees stop_angle;
auto& mc_x_1 = steering_modules[0].steer;
//DUMMY MESSAGE AT THE BEGINNING THAT IS IGNORED
mc_x_1.value()->feedback_request(
hal::actuator::rmd_mc_x_v2::read::multi_turns_angle);
stop_angle = mc_x_1.value()->feedback().angle();
hal::print<128>(console, "Read angle: %f\n", stop_angle);
mc_x_1.value()->position_control(stop_angle +90, 20);
hal::delay(clock, 2s);
while (true) {
hal::print<128>(console, "Motor: %d\n", 1);
mc_x_1.value()->feedback_request(
hal::actuator::rmd_mc_x_v2::read::multi_turns_angle);
stop_angle = mc_x_1.value()->feedback().angle();
hal::print<128>(console, "Starting angle: %f\n", stop_angle);
hal::delay(clock, 2s);
mc_x_1.value()->position_control(stop_angle + 90, 20);
hal::delay(clock, 2s);
mc_x_1.value()->feedback_request(
hal::actuator::rmd_mc_x_v2::read::multi_turns_angle);
stop_angle = mc_x_1.value()->feedback().angle();
hal::print<128>(console, "Middle angle: %f\n", stop_angle);
hal::delay(clock, 2s);
mc_x_1.value()->position_control(stop_angle - 90, 20);
hal::delay(clock, 2s);
hal::print(console, "motor stopped\n");
mc_x_1.value()->feedback_request(
hal::actuator::rmd_mc_x_v2::read::multi_turns_angle);
stop_angle = mc_x_1.value()->feedback().angle();
hal::print<128>(console, "Final angle (afterstop): %f\n\n", stop_angle);
hal::delay(clock, 2s);
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels