ev3dev-lang-python: motor commands not working
I was testing some motor commands. run-direct
command and run_direct()
function work fine. However, run-to-abs-pos
and run-timed
commands, along with run_to_abs_pos()
and run_timed()
functions, are not in the mood to work. (They don’t throw any errors, they just do nothing).
These are my .py files. Hope I was using the functions properly.
#!/usr/bin/python
from ev3dev.auto import *
m = LargeMotor(OUTPUT_A)
m.position_sp = 360
m.run_to_abs_pos()
#!/usr/bin/python
from ev3dev.auto import *
m = LargeMotor(OUTPUT_A)
m.time_sp = 1000
m.run_timed()
Also, I don’t know how to use position_p attribute. It always comes with this error.
>>> m.position_p
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/ev3dev/core.py", line 416, in position_p
return self.get_attr_int('hold_pid/Kp')
File "/usr/lib/python2.7/dist-packages/ev3dev/core.py", line 207, in get_attr_int
return int(self._get_attribute(attribute))
File "/usr/lib/python2.7/dist-packages/ev3dev/core.py", line 200, in _get_attribute
return self._attribute_cache.read(abspath(self._path + '/' + attribute))
File "/usr/lib/python2.7/dist-packages/ev3dev/core.py", line 85, in read
return f.read().decode().strip()
IOError: [Errno 95] Operation not supported
Thank you!
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 26 (19 by maintainers)
Thanks a TON for the help. I figured it had to be something fairly straightforward given how much of my setup was working. I will post back with results, likely will not be until tomorrow at this point.
Thanks again.
https://github.com/ev3dev/ev3dev/milestone/3
The
run_timed
andrun_forever
commands run the motor at a specific speed, not with a duty cycle. So you need to setspeed_sp
instead ofduty_cycle_sp
. See ev3dev/ev3dev#715. What examples are you referring to?