Code Monkey home page Code Monkey logo

ev3dev_examples's Introduction

ev3dev_examples

Examples of program for ev3dev

Installation

For python/rubiks_test.py:

  • apt-get install python-pip python-dev python-numpy
  • pip install colormath

UI

  • Hold down the center button for several seconds to exit the program (the LED will turn yellow). This is handy if the arm fails to flip the cube and you want to stop and start over.
  • If you have a server.conf file but cannot reach the server the LED will change to orange. The color analyzer and solution program will both run on the ev3 so orange is a sign that things will run a little slower.
  • If we hit an eror the LED will turn RED. Check the rubiks.log file to see what went wrong.

Server

It is possible to run the color analyzing software and the rubiks cube solution software on the ev3 but there are two advantages in offloading this to a much faster server:

  • When run on a server, the color analyzer will use a more CPU intensive algorithm and will return more reliable results.
  • When run on a server, ev3dev_examples/python/pyev3/twophase_python/solve.py is used to calculate the solution. This normally returns a solution that takes about 20 steps. This is compared to a solution in the 60 to 100 steps range if you use cubex on the ev3.

To use a server create an ev3dev_examples/python/server.conf file that has the following fields

dwalton76@ev3dev[python]# cat server.conf username=dwalton76 ip=192.168.0.13 path=/home/dwalton76/ev3dev_examples/ dwalton76@ev3dev[python]#

You will need to create ssh keys so that you can login without a password http://www.thegeekstuff.com/2008/11/3-steps-to-perform-ssh-login-without-password-using-ssh-keygen-ssh-copy-id/

ev3dev_examples's People

Contributors

antbob avatar cavenel avatar dwalton76 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ev3dev_examples's Issues

server

how do i create a server?
i don't understand clearly the README.md

Scan problems with EV3 Education

Hello, I tried using this project using the ev3dev.

I built the mindcub3r EV3 Education variant from their website.
Its like the home edition. So should be same.
I already tested the mindcub3r EV3 project and it will solve the rubiks.
But I want an open source variant of the code, so I found this. (Are there other working ev3 mindcuber opensource repos ? Send me!)
But it will only scan and throw errors.

If I run the python/rubiks_test.py by the "File Browser" it will throw an error in the log.
The error is sometimes. Sometimes at the thrid site of the cube, sometimes at the first, sometimes at the 5. site.

rubiks.log:

2021-01-25 13:02:47,142 rubiks_test.py     INFO: Begin...
2021-01-25 13:02:48,426       ev3.py     INFO: Available Sensors:
('ev3-ports:in1', 'lego-ev3-us')
('ev3-ports:in2', 'lego-ev3-color')
2021-01-25 13:02:48,459    rubiks.py     INFO: Initialize flipper
2021-01-25 13:02:48,706    rubiks.py     INFO: Initialize color arm
2021-01-25 13:02:50,177    rubiks.py     INFO: Initialize turntable
2021-01-25 13:02:50,611    rubiks.py     INFO: wait for cube...proximity 86, present for 1/10
2021-01-25 13:02:50,738    rubiks.py     INFO: wait for cube...proximity 86, present for 2/10
2021-01-25 13:02:50,857    rubiks.py     INFO: wait for cube...proximity 86, present for 3/10
2021-01-25 13:02:50,981    rubiks.py     INFO: wait for cube...proximity 86, present for 4/10
2021-01-25 13:02:51,103    rubiks.py     INFO: wait for cube...proximity 86, present for 5/10
2021-01-25 13:02:51,227    rubiks.py     INFO: wait for cube...proximity 86, present for 6/10
2021-01-25 13:02:51,349    rubiks.py     INFO: wait for cube...proximity 86, present for 7/10
2021-01-25 13:02:51,471    rubiks.py     INFO: wait for cube...proximity 86, present for 8/10
2021-01-25 13:02:51,595    rubiks.py     INFO: wait for cube...proximity 86, present for 9/10
2021-01-25 13:02:51,715    rubiks.py     INFO: wait for cube...proximity 86, present for 10/10
2021-01-25 13:02:51,727    rubiks.py     INFO: wait for cube...cube found and stable
2021-01-25 13:02:51,778    rubiks.py     INFO: scanning face
2021-01-25 13:02:53,484    rubiks.py     INFO: i 1, k 1, current_position 131, current_color (81, 25, 25)
2021-01-25 13:02:53,855    rubiks.py     INFO: i 2, k 2, current_position 281, current_color (192, 135, 86)
2021-01-25 13:02:54,220    rubiks.py     INFO: i 3, k 3, current_position 428, current_color (23, 16, 22)
2021-01-25 13:02:54,495    rubiks.py     INFO: i 4, k 4, current_position 536, current_color (210, 195, 242)
2021-01-25 13:02:54,834    rubiks.py     INFO: i 5, k 5, current_position 671, current_color (25, 52, 43)
2021-01-25 13:02:55,200    rubiks.py     INFO: i 6, k 6, current_position 821, current_color (198, 141, 89)
2021-01-25 13:02:55,509    rubiks.py     INFO: i 7, k 7, current_position 942, current_color (197, 136, 80)
2021-01-25 13:02:55,842    rubiks.py     INFO: i 8, k 8, current_position 1075, current_color (188, 135, 85)
2021-01-25 13:02:58,195    rubiks.py     INFO: scanning face
2021-01-25 13:02:59,545    rubiks.py     INFO: i 1, k 10, current_position 133, current_color (41, 73, 53)
2021-01-25 13:02:59,910    rubiks.py     INFO: i 2, k 11, current_position 281, current_color (97, 36, 35)
2021-01-25 13:03:00,279    rubiks.py     INFO: i 3, k 12, current_position 427, current_color (5, 4, 10)
2021-01-25 13:03:00,551    rubiks.py     INFO: i 4, k 13, current_position 537, current_color (41, 83, 52)
2021-01-25 13:03:00,916    rubiks.py     INFO: i 5, k 14, current_position 685, current_color (10, 15, 27)
2021-01-25 13:03:01,285    rubiks.py     INFO: i 6, k 15, current_position 831, current_color (207, 190, 246)
2021-01-25 13:03:01,567    rubiks.py     INFO: i 7, k 16, current_position 942, current_color (179, 179, 237)
2021-01-25 13:03:01,965 rubiks_test.py    ERROR: i is 8..should be 9
Traceback (most recent call last):
  File "/home/robot/ev3dev_examples/python/rubiks_test.py", line 20, in <module>
    rub.scan()
  File "/home/robot/ev3dev_examples/python/pyev3/rubiks.py", line 363, in scan
    self.scan_face()
  File "/home/robot/ev3dev_examples/python/pyev3/rubiks.py", line 346, in scan_face
    raise ScanError('i is %d..should be 9' % i)
ScanError: i is 8..should be 9```

Even more suggestions

Hello!

I came across your project from the EV3dev page, like most people I assume. I took a look at some of the suggestions others made, and incorporated theirs with a few of my own.

https://github.com/Redoubts/python-ev3

I didn't clone the repo, as I'm only interested in ev3.py for my purposes, but you could probably do a local diff to see what changed.

Highlights are better use of pyudev so that sensor selection is more generic, merging brake/halt mode into a single stop mode, and also a few sensible defaults for motion rotating. I also unguarded some exceptions, because I'd rather have my mistakes thrown in my face right away -- but that's just my opinion.

Thanks for your work! It was very clear code, and worked well as a companion to the ev3dev docs.

Does not work on current ev3dev

I spent many hours trying to get this code to work on the current ev3dev distribution (not to mention building the Rubik solver Lego robot). I came to the conclusion that it needs major work to get it to work.

After fixing the device driver instantiations (Motor and Color_sensor), doing any actions failed due to the no longer existing run_mode files in the sysfs.

Is there any chance this project will get fixed and be operational again?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.