pixix4/ev3dev-lang-rust

Can't get PID values from TachoMotor

Closed this issue · 2 comments

I'm trying to work with de PID values from the tacho motor, but it seens like the atributes names are wrong:

Trying to run something like
let p = motor.get_speed_pid_kp()?; println!("{}", p);

I get the fallowing error (runing with RUST_BACKTRACE=1)

Starting: brickrun -r --directory="/home/robot/ev3_sensor_color/programas" "/home/robot/ev3_sensor_color/programas/ev3dev-color-sensor"
----------
thread 'main' panicked at 'Internal error in the attribute map', C:\Users\lucas.ms\.cargo\registry\src\github.com-1ecc6299db9ec823\ev3dev-lang-rust-0.12.0\src\driver.rs:130:14
stack backtrace:
   0: rust_begin_unwind
             at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/panicking.rs:143:14
   2: core::panicking::panic_display
             at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/panicking.rs:73:5
   3: core::panicking::panic_str
             at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/panicking.rs:56:5
   4: core::option::expect_failed
             at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/option.rs:1852:5
   5: ev3dev_lang_rust::driver::Driver::get_attribute
   6: ev3dev_color_sensor::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
----------
Exited with error code 101.

I think the get_speed_pid_kp() has the wrong attribute name, reading de ev3dev docs, it looks like the right name is 'speed_pid/Kp' instead of 'speed_pid_kp'

Just tested on my fork, and the attribute name is actually wrong

Oh, I missed that when translating the python library. Thanks for the find. This should now be fixed with the current release.