Announcement

Collapse
No announcement yet.

EV3 Python API

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #31
    Originally posted by shelbydavis View Post
    Another datapoint on the speed issue: I tested two versions of a 'drive forward a distance and stop when you see black'; one in MicroPython and one in EV3-G.
    The loop in MicroPython read the odometer on one motor and polled the light sensor, and stopped after it went further than 1300 degrees rotation and saw less than 50% reflected light. Response time of the stop was ~ 2 inches of travel (at full throttle), and the loop took around 40 milliseconds an iteration.
    Did the same thing in EV3-G, closer to 5 milliseconds. Now I know that the sensor values aren't updated that quickly in EV3-G, but the stopping was much quicker and closer to the transition line.

    The program start time in an event would likely be negated by making a menu program (especially with the ease of loading a different image to the screen for each mission) but the update speed may greatly hamper adoption.
    That is interesting, but I am not totally following what you were trying to do. What exactly is 'drive forward a distance and stop when you see black'? Could you post your python code here? Thanks!
    I was thinking about doing some time profiling with the python code, but I don't have the robot with me right now. The kids took it away from me.

    Comment


    • #32
      BTW. There is a post somewhere about over clocking the CPU in ev3dev image.
      Well, actually not over clocking, but get the CPU to run at full frequency allowed by the spec. The only issue is that on EV3 the CPU was supplied with a lower voltage than the full frequency requires, so it would be "under votaged". I have not tried that but people said so far they did not see any problem yet.

      Comment


      • #33
        OllyLi, are you a developer for EV3Dev?
        Norfolk, Virginia, USA
        2014 World Class Learning (coach)
        2015 Trash Trek (coach, judge)
        2016 Animal Allies (coach, judge)
        2017 Hydrodynamics (coach, judge)
        2018 Into Orbit (coach, head judge)

        Comment


        • #34
          Originally posted by SkipMorrow View Post
          OllyLi, are you a developer for EV3Dev?
          No, I am not. I am just a coach trying to teach the kids python. I did notice they like the ev3dev stuff but could not stand for the slow start of python. So I decided to help.

          Comment


          • #35
            Are there any options to use precompiled python (*.pyc or *.pyo) files on the ev3?
            Norfolk, Virginia, USA
            2014 World Class Learning (coach)
            2015 Trash Trek (coach, judge)
            2016 Animal Allies (coach, judge)
            2017 Hydrodynamics (coach, judge)
            2018 Into Orbit (coach, head judge)

            Comment


            • #36
              You might be able to do that with the EV3Dev libraries, but I'm trying to limit it to a 6-7th grade level.
              Coach, FLL Team 3146 Peace By Piece 2013 - 2016; Team 29410 The Dragon Bots 2016-2018
              Judge, FTC 2014-2015; Field Technical Advisor, FTC 2016-2018; Robot Inspector, FRC 2018

              Comment


              • #37
                Originally posted by SkipMorrow View Post
                Are there any options to use precompiled python (*.pyc or *.pyo) files on the ev3?
                I think you can, but that has nothing to do with the slow start time, if that was what you meant. You just type "python3" in the terminal and it take very long to start.

                Comment


                • #38
                  Oh, some of the websites I was looking at specifically said the precompiled versions launch must faster than non-precomiled versions.
                  Norfolk, Virginia, USA
                  2014 World Class Learning (coach)
                  2015 Trash Trek (coach, judge)
                  2016 Animal Allies (coach, judge)
                  2017 Hydrodynamics (coach, judge)
                  2018 Into Orbit (coach, head judge)

                  Comment


                  • #39
                    Two different versions of the same code (apologies for not commenting better) Both set the motors to 100%, keep a count of the number of iterations through the sensor loop, read one motor's position and the light sensor (probably should have done straight light reflected rather than RGB in python) and break out of the loop after 1300 degrees motor rotation and a reflected value below 50% Then they display the total time elapsed, along with the number of iterations.
                    Coach, FLL Team 3146 Peace By Piece 2013 - 2016; Team 29410 The Dragon Bots 2016-2018
                    Judge, FTC 2014-2015; Field Technical Advisor, FTC 2016-2018; Robot Inspector, FRC 2018

                    Comment


                    • #40
                      Originally posted by shelbydavis View Post
                      Two different versions of the same code (apologies for not commenting better) Both set the motors to 100%, keep a count of the number of iterations through the sensor loop, read one motor's position and the light sensor (probably should have done straight light reflected rather than RGB in python) and break out of the loop after 1300 degrees motor rotation and a reflected value below 50% Then they display the total time elapsed, along with the number of iterations.
                      The EV3 program stops the motor and applies the brake and waits. The Python program doesn't appear to wait. Stopping the motor and letting the program run acts quite differently than stopping the motor and ending the program. The motors don't have any brakes, and the braking action is implemented by servoing to the last command. If you quit the program right after stopping the motor there is no time to servo. This behavior cause much consternation when EV3 was initially released. A program written in NXT was slow to end, so braking the motors at the very end of a program did a pretty good job at stopping the robot. EV3 programs end quickly, and the braking action was minimal. This mislead some to believe the robot was slow to respond to seeing a black line and stopping. Both robots stopped in the same place, but the EV3 robot kept rolling after the program was done.

                      Comment


                      • #41
                        Originally posted by SkipMorrow View Post
                        Oh, some of the websites I was looking at specifically said the precompiled versions launch must faster than non-precomiled versions.
                        May be true for a huge program, but translating a few lines into bytecode should take less time than releasing the run button. A long startup has got t be caused by starting Python, not starting your program inside of Python.

                        Comment


                        • #42
                          Originally posted by Dean Hystad View Post

                          The EV3 program stops the motor and applies the brake and waits. The Python program doesn't appear to wait. Stopping the motor and letting the program run acts quite differently than stopping the motor and ending the program. The motors don't have any brakes, and the braking action is implemented by servoing to the last command. If you quit the program right after stopping the motor there is no time to servo.
                          Good catch. That likely explains some of the behavior I was getting in other experiments.
                          Coach, FLL Team 3146 Peace By Piece 2013 - 2016; Team 29410 The Dragon Bots 2016-2018
                          Judge, FTC 2014-2015; Field Technical Advisor, FTC 2016-2018; Robot Inspector, FRC 2018

                          Comment


                          • #43
                            I just made a first cut of the code, to improve ev3dev2 support in Micropython.
                            You guys can try it if you are interested. I am not familiar with the Debian Packaging stuff, so this would require some hands on compiling.

                            https://github.com/robosaurus-ev3dev2-upy/upy-ev3dev2

                            So far I tested LEDs, sound, buttons and they work. And of course the motors and external sensors were already supported.

                            Comment

                            Working...
                            X