You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Ensure that Motor/Sensor folders was created by EV3Dev #555
maybe it is the moment to fix this possible bad user experience in the proper way. Currently, the library wait 0.5 seconds (Fixed period of time) in order that Linux+EV3Dev process mount the folder about the motor/sensor with all information.
publicBaseRegulatedMotor(finalPortmotorPort, floatmoveP, floatmoveI, floatmoveD,
floatholdP, floatholdI, floatholdD, intoffset, intmaxSpeed) {
List<RegulatedMotorListener> list = newArrayList<>();
listenerList = Collections.synchronizedList(list);
if(log.isInfoEnabled())
log.info("Configuring motor connected on Port: {}", motorPort.getName());
MAX_SPEED_AT_9V = maxSpeed;
finalEV3DevPlatformsev3DevPlatforms = EV3DevPlatforms.getInstance();
finalStringport = ev3DevPlatforms.getMotorPort(motorPort);
if(log.isDebugEnabled())
log.debug("Detecting motor on port: {}", port);
this.detect(LEGO_PORT, port);
if(log.isDebugEnabled())
log.debug("Setting port in mode: {}", TACHO_MOTOR);
this.setStringAttribute(MODE, TACHO_MOTOR);
Delay.msDelay(500);
this.detect(TACHO_MOTOR, port);
Delay.msDelay(500);
this.setStringAttribute(COMMAND, RESET);
if(log.isDebugEnabled())
log.debug("Motor ready to use on Port: {}",motorPort.getName());
}
Maybe, it could be interesting to create a POC to see what is the best approach to do it.
Basically, we should introduce a asynchronous process to wait for the existency of a determinated number of folders.
changed the title [-]Ensure that Motor/Sensor folders was created by EV3Dev properly[/-][+]Ensure that Motor/Sensor folders was created by EV3Dev[/+]on Nov 8, 2018
any motor folder in EV3Dev has the following content:
robot@ev3dev:/sys/class/tacho-motor/motor0$ ls
address driver_name polarity ramp_up_sp stop_action
command duty_cycle position speed stop_actions
commands duty_cycle_sp position_sp speed_pid subsystem
count_per_rot hold_pid power speed_sp time_sp
device max_speed ramp_down_sp state uevent
What are the folders/files used in the library?
In the class EV3DevMotorDevice exist the description about all files/folders used. It could be necessary to create some kind of datastructure to interate and verify the existence.
The file doesn't differenciate between files, folders and states. It is a refactoring point.
protected static final String POSITION_SP = "position_sp";
protected static final String POSITION = "position";
protected static final String SPEED = "speed_sp";
protected static final String DUTY_CYCLE = "duty_cycle_sp";
protected static final String COMMAND = "command";
protected static final String STOP_COMMAND = "stop_action";
protected static final String STATE = "state";
protected static final String POLARITY = "polarity";
For this POC, we will group this files in a map to iterate ina
Activity
[-]Ensure that Motor/Sensor folders was created by EV3Dev properly[/-][+]Ensure that Motor/Sensor folders was created by EV3Dev[/+]jabrena commentedon Nov 8, 2018
Technical links for the future development:
https://medium.com/@senanayake.kalpa/fantastic-completablefuture-allof-and-how-to-handle-errors-27e8a97144a0
http://iteratrlearning.com/java9/2016/09/13/java9-timeouts-completablefutures.html
http://ev3dev-lang-java.github.io/docs/api/latest/ev3dev-lang-java/ev3dev/utils/Sysfs.html (getElements, existPath, existFile)
jabrena commentedon Nov 8, 2018
Analysis:
any motor folder in EV3Dev has the following content:
In the class
EV3DevMotorDeviceexist the description about all files/folders used. It could be necessary to create some kind of datastructure to interate and verify the existence.The file doesn't differenciate between files, folders and states. It is a refactoring point.
For this POC, we will group this files in a map to iterate ina
jabrena commentedon Nov 8, 2018
One idea from StackOverflow to manage retry behavior:
https://stackoverflow.com/questions/40485398/retry-logic-with-completablefuture
JakubVanek commentedon Sep 2, 2019
List of udev events:
View files in a folder with permissions:
What to check:
ev3devwith https://stackoverflow.com/a/8845198.