Skip to content
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

Motor Ramping Assistance #787

Open
TheDoctor2017 opened this issue Jan 9, 2023 · 3 comments
Open

Motor Ramping Assistance #787

TheDoctor2017 opened this issue Jan 9, 2023 · 3 comments

Comments

@TheDoctor2017
Copy link

ev3dev version: 4.14.117-ev3dev-2.3.5-ev3
ev3dev-lang-python version:
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
ii micropython-ev3dev2 2.1.0 all Python language bindings for ev3dev for MicroPython
ii python3-ev3dev 1.2.0 all Python language bindings for ev3dev
ii python3-ev3dev2 2.1.0 all Python language bindings for ev3dev

I am trying to add ramping to my builds. I know it is supported by the Lego software, but I want Python practice so I am using ev3dev. I can't find anything in the basic motor commands. I did find this:
https://ev3dev-lang.readthedocs.io/projects/python-ev3dev/en/stable/motors.html
But it appears to require a custom class, which is beyond my programming knowledge. Is there anyone out there in ev3dev land that understands how this works that could give me a code example or any other method to support ramping on the motors to avoid the sharp jerk at initial start? Thanks in advance!

@dlech
Copy link
Member

dlech commented Jan 9, 2023

Did you try setting ramp_up_sp and ramp_down_sp?

@TheDoctor2017
Copy link
Author

Did you try setting ramp_up_sp and ramp_down_sp?

That's the problem, I don't know how. What is the full syntax of the command?

@TheDoctor2017
Copy link
Author

TheDoctor2017 commented Jan 10, 2023

I figured it out. If anyone else runs across this, here is sample code:

lm = LargeMotor(OUTPUT_B)
lm.ramp_up_sp = 2000

Now every time the motor is started it will ramp.

Important! The ramp_up_sp command must come AFTER any tank pairing assignments. For example, this works:

lm = LargeMotor(OUTPUT_A)
rm = LargeMotor(OUTPUT_D)
tank_pair = MoveTank(OUTPUT_A, OUTPUT_D)
lm.ramp_up_sp = 1000
rm.ramp_up_sp = 1000

But this does not:

lm = LargeMotor(OUTPUT_A)
rm = LargeMotor(OUTPUT_D)
lm.ramp_up_sp = 1000
rm.ramp_up_sp = 1000
tank_pair = MoveTank(OUTPUT_A, OUTPUT_D)

The second code will not generate any errors, but there will be no ramping.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants