Fix ::run_state method (wait_for_idle instead of idle) and better vel_limit setting in .ino sketch example

This commit is contained in:
PAJohnson
2020-10-14 15:18:37 -04:00
parent 5d42a68e71
commit bd51fca58b
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -62,7 +62,7 @@ int32_t ODriveArduino::readInt() {
bool ODriveArduino::run_state(int axis, int requested_state, bool wait_for_idle, float timeout) {
int timeout_ctr = (int)(timeout * 10.0f);
serial_ << "w axis" << axis << ".requested_state " << requested_state << '\n';
if (wait) {
if (wait_for_idle) {
do {
delay(100);
serial_ << "r axis" << axis << ".current_state\n";
@@ -53,7 +53,7 @@ void setup() {
// You can of course set them different if you want.
// See the documentation or play around in odrivetool to see the available parameters
for (int axis = 0; axis < 2; ++axis) {
odrive_serial << "w axis" << axis << ".controller.config.vel_limit " << 22000.0f << '\n';
odrive_serial << "w axis" << axis << ".controller.config.vel_limit " << 10.0f << '\n';
odrive_serial << "w axis" << axis << ".motor.config.current_lim " << 11.0f << '\n';
// This ends up writing something like "w axis0.motor.config.current_lim 10.0\n"
}