Skip to content

PID Line follower - #630

Merged
dwalton76 merged 12 commits into
ev3dev:ev3dev-stretchfrom
dwalton76:line-follower
Jul 25, 2019
Merged

dwalton76 merged 12 commits into
ev3dev:ev3dev-stretchfrom
dwalton76:line-follower

Conversation

@dwalton76

Copy link
Copy Markdown
Collaborator

For #625

Comment thread ev3dev2/motor.py Resolved
Comment thread ev3dev2/motor.py Resolved
Comment thread ev3dev2/motor.py Resolved
Comment thread ev3dev2/motor.py Resolved
Comment thread ev3dev2/motor.py Resolved
Comment thread ev3dev2/motor.py Resolved
Comment thread ev3dev2/motor.py Resolved
Comment thread utils/stop_all_motors.py Resolved
Comment thread utils/line-follower-find-kp-ki-kd.py Resolved
@dwalton76

Copy link
Copy Markdown
Collaborator Author

@WasabiFan I should be able to get back to this PR this weekend

@dwalton76

dwalton76 commented Jun 8, 2019 •

Copy link
Copy Markdown
Collaborator Author

FYI tested with this

from ev3dev2.motor import OUTPUT_A, OUTPUT_B, MoveTank, SpeedRPM, SpeedPercent, follow_for_ms, follow_for_forever
from ev3dev2.sensor.lego import ColorSensor
from time import sleep
import logging
import sys


# logging
logging.basicConfig(level=logging.DEBUG,
                    format="%(asctime)s %(levelname)5s: %(message)s")
log = logging.getLogger(__name__)


tank = MoveTank(OUTPUT_A, OUTPUT_B)
tank.cs = ColorSensor()

try:
    log.info("start")
    tank.follow_line(kp=11.3, ki=0.05, kd=3.2,
        speed=SpeedRPM(60),
        # follow_for=follow_for_forever,
        follow_for=follow_for_ms,
        ms=4500,
    )
    log.info("end")
except Exception:
    tank.stop()
    raise

tank.stop()

Comment thread ev3dev2/motor.py Resolved
Comment thread ev3dev2/motor.py Resolved
Comment thread ev3dev2/motor.py Resolved
Comment thread ev3dev2/motor.py Resolved
Comment thread ev3dev2/motor.py Resolved
Comment thread ev3dev2/motor.py Resolved
@WasabiFan

Copy link
Copy Markdown
Member

I'm liking the added functionality! it would be nice to have this easily accessible.

@bpmerkel bpmerkel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In utils/line-follower-find..., the 2nd call to find_kp_ki_kd needs the speed parameter.

@bpmerkel

Copy link
Copy Markdown
Contributor

In utils/line-follower-find..., the 2nd call to find_kp_ki_kd needs the speed parameter.

Also, in the same file... can it be refactored to use time instead of the datetime class? As datetime doesn't seem to work correctly with micropython.

@dwalton76

Copy link
Copy Markdown
Collaborator Author

In utils/line-follower-find..., the 2nd call to find_kp_ki_kd needs the speed parameter.

thanks...fixed

@dwalton76

Copy link
Copy Markdown
Collaborator Author

In utils/line-follower-find..., the 2nd call to find_kp_ki_kd needs the speed parameter.

Also, in the same file... can it be refactored to use time instead of the datetime class? As datetime doesn't seem to work correctly with micropython.

I'll have this use the StopWatch class...it is a good abstraction for this sort of thing (it works with both python and micropython).

@WasabiFan WasabiFan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comments, but otherwise looks good!

Comment thread ev3dev2/motor.py Resolved
Comment thread ev3dev2/motor.py Resolved
@dwalton76
dwalton76 merged commit 33b1134 into ev3dev:ev3dev-stretch Jul 25, 2019
@dwalton76
dwalton76 deleted the line-follower branch July 25, 2019 00:59
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

Successfully merging this pull request may close these issues.

3 participants