ev3dev/ev3dev-lang-python

BrickPi3 example

dlech opened this issue · 9 comments

dlech commented
  • ev3dev version: PASTE THE OUTPUT OF uname -r HERE
  • ev3dev-lang-python version: INSERT ALL VERSIONS GIVEN BY dpkg-query -l {python3,micropython}-ev3dev* HERE

We get a fairly steady stream of people trying to use BrickPi3 and failing because it cannot automatically detect sensors and motors. It would be super-helpful if the docs here had an example that people could copy and paste to get started.

Despite the constant questions, I still cannot find any known working example in any of the ev3dev GithHub issues.

Good call. I don't personally have a BrickPi but I can certainly try to write some code if someone else can test it.

I'm trying to test manually setting port modes on my EV3. This works with tacho motors, but when I have a US sensor connected I see the following behavior:

robot@ev3dev:~$ cat /sys/class/lego-port/port0/address   
ev3-ports:in1
robot@ev3dev:~$ echo ev3-uart > /sys/class/lego-port/port0/mode        
robot@ev3dev:~$ echo lego-ev3-us > /sys/class/lego-port/port0/set_device 
-bash: echo: write error: Operation not supported

Is there something obvious I'm doing wrong here, or do you have suggestions for where I should look? This should be supported on the EV3, right?

ev3dev-stretch-ev3-generic-2019-05-29
Kernel version:     4.14.117-ev3dev-2.3.4-ev3
dlech commented

Since EV3 can automatically detect UART sensors, it doesn't let you pick a different one. BrickPi3 and PiStorms (and mindsensors EV3 sensor multiplexer) on the other hand can't automatically detect sensors, so you have explicitly tell them which sensor is attached.

Ah, got it -- I didn't realize it wasn't supported on the EV3 ports. I opened a PR on the python demo repo with a sample program; would you be able to test it?

I'll link to this example in docs and maybe quote some of it too.

dlech commented

I opened a PR on the python demo repo with a sample program; would you be able to test it?

Yeah, I'll try it tomorrow.

dlech commented

Perhaps another tip for the documentation, if you get this error...

Starting: brickrun --directory="/home/robot/brickpi3" "/home/robot/brickpi3/main.py"
----------
Traceback (most recent call last):
  File "/home/robot/brickpi3/main.py", line 11, in <module>
    from ev3dev2.motor import OUTPUT_A, LargeMotor, SpeedPercent
  File "/usr/lib/python3/dist-packages/ev3dev2/motor.py", line 77, in <module>
    raise Exception("Unsupported platform '%s'" % platform)
Exception: Unsupported platform 'None'
----------
Exited with error code 1.

Then you probably forgot to edit config.txt.

@dlech Do you have any particular recommendations for where that should go? I am tempted to put it in our FAQ but no one reads the FAQ 😢

dlech commented

The more places the better 😄

Maybe add some links to the FAQ from different places? e.g. at the top of the sensor docs, say "If you are using BrickPi3, also see the FAQ"