bmegli / ev3dev-mapping

The ev3dev-mapping project meta repository
http://www.ev3dev.org/projects/2016/08/07/Mapping/
16 stars 6 forks source link

How to run in Python : Code provided #3

Closed burf2000 closed 8 years ago

burf2000 commented 8 years ago

Hey dude, maybe this help people

Notice I am doing -40 as I thought that was anti clockwise Also running the motor your way did not work so added my own code

import os import time

os.system("echo other-uart > /sys/class/lego-port/port0/mode") os.system("export MC=/sys/class/tacho-motor/motor0") os.system("echo -40 > $MC/duty_cycle_sp") os.system("echo run-forever > $MC/command") time.sleep(5)

os.system("echo 40 /sys/class/tacho-motor/motor0/duty_cycle_sp")

os.system("echo run-direct /sys/class/tacho-motor/motor0/command")

os.system("./xv11test /dev/tty_in1") os.system("echo stop > $MC/command")

bmegli commented 8 years ago

@burf2000 Thanks!

It may be 40, not -40. Make sure its CCW visually (look which way its rotating) otherwise you can get some invalid data because device gets confused on speed calculation. It's difficult to debug, you get invalid data only from some angles where the speed calculation gets confused.

Did you get it running? Did you get some distance output from the lidar?

If its 40, not -40 for CCW it simply means that I have mistaken the cables in tutorial so just use the correct value for CCW.

bmegli commented 8 years ago

And also what didn't work? run-direct command for the motor?

Ok, got it. There were missing > after echo commands. Thanks!

run-direct is ok.

bmegli commented 8 years ago

@burf2000 It would be helpfull if you could tell which one is counterclockwise for you: 40 or -40.

I have two LIDARS now and one works with positive and one negative values.

I don't remember which is which and would rather not resolder them just to check. I believe its 40 (positive) for counterclockwise with the scheme I did for the movie (with the mistake -40 in the movie).

bmegli commented 8 years ago

Ok, it's 40 for CCW with the soldering sheme I made. All the docs hopefully updated. Thanks.