You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
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.
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
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.
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?
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
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.
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.
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.
Activity
gregcowell commentedon Oct 17, 2017
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.
WasabiFan commentedon Oct 17, 2017
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.
gregcowell commentedon Oct 17, 2017
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.
WasabiFan commentedon Oct 17, 2017
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.
dwalton76 commentedon Oct 17, 2017
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.
dwalton76 commentedon Oct 17, 2017
@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.
gregcowell commentedon Oct 17, 2017
Okay, will do.
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?
Is the idea to move the remote control functionality out of the GyroBalancer class and into an example script ?
dwalton76 commentedon Oct 18, 2017
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.
Na I would leave it there, just update it to use InfrafredSensor instead of RemoteControle
laurensvalk commentedon Oct 29, 2017
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.
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.
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.
gregcowell commentedon Oct 29, 2017
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.
laurensvalk commentedon Oct 29, 2017
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.