Skip to content

BALANC3R #8

Closed
Closed

Description

@dwalton76

Update BALANC3R to new API

Activity

  1. gregcowell commented on Oct 17, 2017

    @gregcowell
    Member

    I've built a BALANC3R and have it working using Laurens Valk's EV3-G programs. Once I understand how his EV3-G programs work, I'll start translating them to the new API.

  2. WasabiFan commented on Oct 17, 2017

    @WasabiFan
    Member

    For reference, the existing implementation is here: https://github.com/ev3dev/ev3dev-lang-python-demo/blob/master/robots/BALANC3R

    Some of the work might be to update the GyroBalancer class in the core library.

  3. gregcowell commented on Oct 17, 2017

    @gregcowell
    Member

    Thanks @WasabiFan. Should we move a lot of the functionality out of the GyroBalancer class and replace it with example scripts that use the new API ? It seems like the GyroBalancer class sits at level above the new API. So wondering if we want this code in the core library or in example scripts? EV3-G does not have any programming blocks that are specific to particular models of robots.

  4. WasabiFan commented on Oct 17, 2017

    @WasabiFan
    Member

    I think that'll be a question for @dwalton76. I have never used the gyro balancer. Certainly, I think it should be available as a reusable component in some form, but whether that is in the core module or a file in the demos repo here I don't really have a preference.

  5. dwalton76 commented on Oct 17, 2017

    @dwalton76
    CollaboratorAuthor

    I now realize that there is hardly any code in BALANCER here and most of the logic lives in that GyroBalancer class. I filed ev3dev/ev3dev-lang-python#418 for that, @gregcowell I would do the majority of the work there. Basically just take what is there and update it to get it working. If you can get it working using the new API I would view that as a nice bonus but not a must have. I say that because Laurens was jumping through some hoops to avoid using the old API to make updating the various /sys/ files be as fast as possible.

    Laurens posted the other day about some updates he has made
    ev3dev/ev3dev#984

    His code lives at
    https://github.com/laurensvalk/segway/

    I ported his code ~18 to 24 months ago to create our BALANCER/GyroBalancer. It might be worth looking through the commits made since then and porting them to our codebase.

  6. dwalton76 commented on Oct 17, 2017

    @dwalton76
    CollaboratorAuthor

    @gregcowell you may also need to fix ev3dev/ev3dev-lang-python#414 as part of this. I haven't started working on it, no worries from me if you get to it first.

  7. gregcowell commented on Oct 17, 2017

    @gregcowell
    Member

    I would do the majority of the work there. Basically just take what is there and update it to get it working.

    Okay, will do.

    Laurens posted the other day about some updates he has made ev3dev/ev3dev#984

    One of the things Laurens has done is add support for a touch sensor. Should this be in the GyroBalancer class or separated out into an example script if possible?

    @gregcowell you may also need to fix ev3dev/ev3dev-lang-python#414 as part of this. I haven't started working on it, no worries from me if you get to it first.

    Is the idea to move the remote control functionality out of the GyroBalancer class and into an example script ?

  8. dwalton76 commented on Oct 18, 2017

    @dwalton76
    CollaboratorAuthor

    One of the things Laurens has done is add support for a touch sensor. Should this be in the GyroBalancer class or separated out into an example script if possible?

    How about here in the demo repo update the BALANCER script to create a child class of GyroBalancer that adds support for the TouchSensor...that way we are providing a nice example of how to use object-oriented programming to build on what is already there.

    Is the idea to move the remote control functionality out of the GyroBalancer class and into an example script ?

    Na I would leave it there, just update it to use InfrafredSensor instead of RemoteControle

  9. laurensvalk commented on Oct 29, 2017

    @laurensvalk

    Here's something to perhaps consider for future updates.

    Currently, the motion of the robot is controlled on a high level using the 'speed' and 'steering' variables, e.g.

    # Just balance in place:
    speed = 0
    steering = 0
    

    It would be nice to be able to control these from the main script without having to modify the control code.

    That would separate high level from the low level control. On the high level, various examples are possible such as IR control or line following.

    In the EV3-G example, I provide this possibility through a parallel task. Unlike in my Python code, this high level loop can also do things like waiting without stalling the balancing loop.

    ev3-g

    There may be alternatives to using parallel code as well. For example, in microcontroller type applications, one might fire a timer interrupt at constant intervals to each time run the code that currently lives in the balancing loop once. Any remaining time is available for the high level control. I've never tried this in Python though.

  10. gregcowell commented on Oct 29, 2017

    @gregcowell
    Member

    I like the idea of moving the drive control loop functionality out of the GyroBalancer class and into an example script. It would make the GyroBalancer class a lot more general purpose. I’m happy to look into doing this.

  11. laurensvalk commented on Oct 29, 2017

    @laurensvalk

    Sounds good. I think I'll keep my version in it's original form for development purposes, but I like the ev3dev version because of its ease of use.

    Feel free to ask here if you have any questions when expanding this functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions