Repository navigation
Actounix L12 100 not recognized #733
Description
Activity
Using a
LegoPortobject it is possible to override the detected device. There is a similar example for how to do this with sensors at https://github.com/ev3dev/ev3dev-lang-python-demo/blob/stretch/platform/brickpi3-motor-and-sensor.py.In your case
port.set_device = 'act-l12-ev3-100'should do the trick.Hi, thank you for your immediate answer!
I created this scipt:
#!/usr/bin/env python3 from ev3dev2.motor import ActuonixL12100Motor, OUTPUT_C from ev3dev2.port import LegoPort p = LegoPort(OUTPUT_C) p.set_device = 'act-l12-ev3-100' motor = ActuonixL12100Motor(OUTPUT_C)But when i run it i get this error:
Traceback (most recent call last): File "/usr/lib/python3/dist-packages/ev3dev2/__init__.py", line 244, in _get_attribute attribute = self._attribute_file_open( name ) File "/usr/lib/python3/dist-packages/ev3dev2/__init__.py", line 227, in _attribute_file_open mode = stat.S_IMODE(os.stat(path)[stat.ST_MODE]) FileNotFoundError: [Errno 2] No such file or directory: '/sys/class/tacho-motor/linear9/count_per_rot'And results in:
ev3dev2.DeviceNotFound: ActuonixL12100Motor(ev3-ports:outC) is no longer connectedTry adding a time delay between
set_deviceandActuonixL12100Motoras in the linked example.Tried that and I keep getting the same error. Changed the time delay up to 20 seconds just in case it was being slow, but nothing.
FileNotFoundError: [Errno 2] No such file or directory: '/sys/class/tacho-motor/linear9/count_per_rot'
OK, I think this is a bug in the python library then.
linear9should probably bemotor9. You can check for sure in a SSH terminal.$ ls /sys/class/tacho-motor/Is the
count_per_rotattribute omitted for linear actuators? If not, it definetely looks like a library bug somehow.It's been a long time. My memory is probably faulty 😉 Better check the docs: http://docs.ev3dev.org/projects/lego-linux-drivers/en/ev3dev-stretch/motors.html#tacho-motor-subsystem
So maybe
linearis right and the attributes are slightly different.I suspect it is trying to cache
count_per_roton initialization and failing because it doesn't exist... I'll take a look at this today.It's called linear
the output for
ls /sys/class/tacho-motor/linear13/is
address duty_cycle position speed_pid time_sp command duty_cycle_sp position_sp speed_sp uevent commands full_travel_count power state count_per_m hold_pid ramp_down_sp stop_action device max_speed ramp_up_sp stop_actions driver_name polarity speed subsystemso the attributes are different, but i don't know why it tries to get
cout_per_rotYeah, the issue is here: https://github.com/ev3dev/ev3dev-lang-python/blob/ev3dev-stretch/ev3dev2/motor.py#L425
When we restructured speed unit handling we entirely missed the linear actuator case which lacks that attribute. Right now we have speed units which know how to work for rotational motors but not for linear actuators. I'm inclined to go with the simpler solution of not supporting speed units other than percentages with linear actuators; I'll implement it and we can go from there.
@trinidadg if you'd like an immediate workaround, this should work:
from ev3dev2.motor import Motor @property def patch_count_per_rot(self): return 1 Motor.count_per_rot = patch_count_per_rot
And then don't try to use
SpeedUnits other thanSpeedPercent😆 If you are also using normal rotational motors and would like them to continue working as they currently do, you can (or I can show you how to) replacereturn 1with a try/catch which tries the original property and returns 1 if it doesn't work.- added a commit that references this issue
on Apr 14, 2020 @trinidadg Would you be up to test out my fix from #734? If your EV3 has Internet access, you can do the following:
git clone https://github.com/ev3dev/ev3dev-lang-python.git -b fix-linear-actuators cd ev3dev-lang-python sudo make installThis should install the development version and you can import/use the library as normal. If you are able to test this, please do let me know how it goes! I tested to confirm normal rotational motors still work but I don't have any linear ones to try.
To undo the installation of the development version, run
sudo apt-get --reinstall install python3-ev3dev2.The make failed with this error:
python3 setup.py install Traceback (most recent call last): File "setup.py", line 10, in <module> version=git_version(), File "/home/robot/ev3dev-lang-python/git_version.py", line 68, in git_version raise ValueError("Cannot find the version number!") ValueError: Cannot find the version number! Makefile:15: recipe for target 'install' failed make: *** [install] Error 1Using a
LegoPortobject it is possible to override the detected device. There is a similar example for how to do this with sensors at https://github.com/ev3dev/ev3dev-lang-python-demo/blob/stretch/platform/brickpi3-motor-and-sensor.py.In your case
port.set_device = 'act-l12-ev3-100'should do the trick.For some reason, the instruction
p.set_device = 'act-l12-ev3-100'stopped working for me.
The output error is:p.set_device = 'act-l12-ev3-100' File "/usr/lib/python3/dist-packages/ev3dev2/port.py", line 140, in set_device self._set_device = self.set_attr_string(self._set_device, 'set_device', value) File "/usr/lib/python3/dist-packages/ev3dev2/__init__.py", line 322, in set_attr_string return self._set_attribute(attribute, name, value) File "/usr/lib/python3/dist-packages/ev3dev2/__init__.py", line 264, in _set_attribute self._raise_friendly_access_error(ex, name, value) File "/usr/lib/python3/dist-packages/ev3dev2/__init__.py", line 288, in _raise_friendly_access_error raise driver_error File "/usr/lib/python3/dist-packages/ev3dev2/__init__.py", line 261, in _set_attribute attribute.write(value) OSError: [Errno 95] Operation not supportedIt worked fine for a while but now it keeps throwing that error.
Check the mode of the port. Only certain modes allow
set_device.@trinidadg I haven't gotten a chance to look into the installation error you posted; for our purposes though you can replace line 10 (the middle line below) in
setup.pyas a workaround:setup(name='python-ev3dev2', version='2.1.0.post3', description='v2.x Python language bindings for ev3dev',
I've been working with ev3-dev for the past weeks and successfully configured various sensors and actuators. However I can't get the Actuonix Linear Actuator working.
When I try to initialize the class, it says the motor is not connected.
I checked for the driver and it is there:
I have changed the port and the cable just in case and had no luck.
When I create a simple Motor class in that port It uses the lego-ev3-l-motor driver.
Using that it responds to the on(vel) command, going both ways and stopping on the edges. I can't use stop() (it does nothing) and when asked for position it says 0 or 1 being fully retracted or fully extended.
Really hope for some help! Thanks
Desktop :
Robot:
ev3dev-sysinfo -m output: