Closed jabrena closed 8 years ago
I am not sure what is the problem here. Is this not what you would expect?
imagine that I write a program which the robot has 2 motors connected to motor port A & B.
in the preliminary tests, I have connected 2 motors, but the reference is motor2 & 4 but they are connected to port A & B.
I would like to send:
root@ev3dev:~# echo 50 > /sys/class/tacho-motor/outA/duty_cycle_sp
root@ev3dev:~# echo run-forever > /sys/class/tacho-motor/outA/command
root@ev3dev:~# echo 50 > /sys/class/tacho-motor/outB/duty_cycle_sp
root@ev3dev:~# echo run-forever > /sys/class/tacho-motor/outB/command
does exist some way to make reference for motor port based on the position where user connected?
If you look at how Device is initialized in python now, it tries to connect to any device by default, but if user provides port_name
(well, any attribute value), it tries to match that.
So you just iterate over devices until you find the one you need.
Oki, I understand the idea.
When you init a Motor object, you search the element in "/sys/class/tacho-motor" and you fix the object with that element.
Thanks
Hi,
I am using some motors connecting and disconnecting from motor port 1 and 2 and now, I have 2 NXT motors in motor port A y B. Reading values from sysfs:
I observe this answer. If I use this way:
I see an absolute reference, because motor2 is connected in port B and motor4 is connected in port A.
How to send commands to motor port A & B?
http://www.ev3dev.org/docs/tutorials/tacho-motors/