-
Notifications
You must be signed in to change notification settings - Fork 14
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
Any way to pair motors? #13
Comments
No, there is currently no such functionality. This library is based on version 1 of the python library wich does not have such utility functions. As it seems, But it would be possible to implement a slightly more advanced version of let motor1 = LargeMotor::get(MotorPort::OutA)?;
let motor2 = LargeMotor::get(MotorPort::OutB)?;
let motor3 = MediumMotor::get(MotorPort::OutC)?;
let motor_set = MotorSet::create<3>([motor1, motor2, motor3]);
motor_set.run_direct()?;
motor_set.set_duty_cycle_sp([50, 70, 30])?;
motor_set.stop()?; This would achieve the same as: let motor1 = LargeMotor::get(MotorPort::OutA)?;
let motor2 = LargeMotor::get(MotorPort::OutB)?;
let motor3 = MediumMotor::get(MotorPort::OutC)?;
motor1.run_direct()?;
motor2.run_direct()?;
motor3.run_direct()?;
motor1.set_duty_cycle_sp(50)?;
motor2.set_duty_cycle_sp(70)?;
motor3.set_duty_cycle_sp(30)?;
motor1.stop()?;
motor2.stop()?;
motor3.stop()?; What would be your intended use case? Would such a |
So, again, I'm pretty new to all this, but I'm seeing some driving behavior that I suspect is a timing issue. When I use this Python program, I notice that the robot "kicks" a bit to one side when it starts driving: https://github.com/ev3dev/ev3dev-lang-python-demo/blob/stretch/robots/EXPLOR3R/auto-drive.py My initial guess here is that it's a timing issue: one wheel starts moving slightly before another, and that acts as a bit of accidental steering. I further guess/hope that if I update that code to use something like a My current mini project is rewriting that little program in Rust, so I was hoping to use a |
Yes, such small "kicks" are a typical problem on ev3 robot and it is indeed a timing problem. Unfortunately a for motor in motors:
motor.polarity = polarity As you can see, this is basically the same implementation as the example code: for m in motors:
m.duty_cycle_sp = dc However, it is possible to reduce these "kicks". First you should initialise all properties used, in particular for m in motors:
m.duty_cycle_sp = 0 And a rust implementation of this example would reduce this "kick" too. Compared to python, rust is a compiled language and generally has better performance (this also applies to I/O operations). |
Apologies if this is a dumb question, but as someone new to Mindstorms and this library, I suspect there ought to be a way to pair motors together? Like, if I want to start driving, shouldn't there be a way to start both motors/wheels at the same time?
I see that the Python libraries have a
MotorSet
. Is that what I'm thinking it is and is there an equivalent for this library?The text was updated successfully, but these errors were encountered: