Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

errors with arduino nano #17

Open
emdete opened this issue Oct 3, 2020 · 5 comments
Open

errors with arduino nano #17

emdete opened this issue Oct 3, 2020 · 5 comments

Comments

@emdete
Copy link

emdete commented Oct 3, 2020

I wanted to chec Open Roberta with my Nano.

I got lots of trouble using the connector under Linux. The tool throws Exceptions all time like

2020-10-03 18:45:04,815 [JmDNS(172.16.0.3).Timer] WARN  j.j.i.tasks.resolver.DNSResolverTask run - ServiceResolver(172.16.0.3).run() exception 
java.io.IOException: Der notwendige Schlüssel ist nicht verfügbar
	at java.base/java.net.PlainDatagramSocketImpl.send0(Native Method)
	at java.base/java.net.AbstractPlainDatagramSocketImpl.send(AbstractPlainDatagramSocketImpl.java:136)
	at java.base/java.net.DatagramSocket.send(DatagramSocket.java:743)
	at javax.jmdns.impl.JmDNSImpl.send(JmDNSImpl.java:1634)
	at javax.jmdns.impl.tasks.resolver.DNSResolverTask.run(DNSResolverTask.java:73)
	at java.base/java.util.TimerThread.mainLoop(Timer.java:556)
	at java.base/java.util.TimerThread.run(Timer.java:506)

while using mdns scanning all my interfaces without notice or user allowance. The next Exception appears when trying to save the device list:

2020-10-03 18:46:54,546 [AWT-EventQueue-0] INFO  d.f.i.r.u.d.DeviceIdEditorController actionPerformed - actionPerformed: save_and_close
Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: class java.lang.String cannot be cast to class de.fhg.iais.roberta.connection.wired.WiredRobotType (java.lang.String is in module java.base of loader 'bootstrap'; de.fhg.iais.roberta.connection.wired.WiredRobotType is in unnamed module of loader 'app')
	at de.fhg.iais.roberta.ui.deviceIdEditor.DeviceIdEditorController$DeviceIdEditorViewListener.saveAndClose(DeviceIdEditorController.java:182)
	at de.fhg.iais.roberta.ui.deviceIdEditor.DeviceIdEditorController$DeviceIdEditorViewListener.actionPerformed(DeviceIdEditorController.java:99)
	at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1967)
	at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2308)
	at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
	at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262)
	at java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:279)
	at java.desktop/java.awt.Component.processMouseEvent(Component.java:6636)
	at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3342)
	at java.desktop/java.awt.Component.processEvent(Component.java:6401)
	at java.desktop/java.awt.Container.processEvent(Container.java:2263)
	at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5012)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4844)
	at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4919)
	at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4548)
	at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4489)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2307)
	at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2764)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4844)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:743)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:117)
	at java.desktop/java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:190)
	at java.desktop/java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:235)
	at java.desktop/java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:233)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:312)
	at java.desktop/java.awt.WaitDispatchSupport.enter(WaitDispatchSupport.java:233)
	at java.desktop/java.awt.Dialog.show(Dialog.java:1070)
	at java.desktop/java.awt.Component.show(Component.java:1717)
	at java.desktop/java.awt.Component.setVisible(Component.java:1664)
	at java.desktop/java.awt.Window.setVisible(Window.java:1023)
	at java.desktop/java.awt.Dialog.setVisible(Dialog.java:1005)
	at de.fhg.iais.roberta.ui.deviceIdEditor.DeviceIdEditorController.showEditor(DeviceIdEditorController.java:82)
	at de.fhg.iais.roberta.ui.main.MainController$MainViewListener.actionPerformed(MainController.java:327)
	at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1967)
	at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2308)
	at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
	at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262)
	at java.desktop/javax.swing.AbstractButton.doClick(AbstractButton.java:369)
	at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1020)
	at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1064)
	at java.desktop/java.awt.Component.processMouseEvent(Component.java:6636)
	at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3342)
	at java.desktop/java.awt.Component.processEvent(Component.java:6401)
	at java.desktop/java.awt.Container.processEvent(Container.java:2263)
	at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5012)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4844)
	at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4919)
	at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4548)
	at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4489)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2307)
	at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2764)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4844)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:743)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
2020-10-03 18:47:06,714 [AWT-EventQueue-0] INFO  d.f.i.r.u.d.DeviceIdEditorController actionPerformed - actionPerformed: save_and_close

Took me a while to figure out what's wrong: It expects the type to be edited. After that i get:

2020-10-03 18:49:50,752 [main] INFO  d.f.i.r.c.w.a.ArduinoCommunicator uploadFile - Starting to upload program /tmp/NEPOprog.hex2611649717475875702 to /dev/ttyUSB0
2020-10-03 18:49:50,753 [main] INFO  d.f.i.r.c.w.a.ArduinoCommunicator uploadFile - Upload command used: [./resources/linux/arduino/avrdude-64, -v, -D, -C./resources/linux/arduino/avrdude.conf, -Uflash:w:/tmp/NEPOprog.hex2611649717475875702:i, -patmega328p, -carduino, -P/dev/ttyUSB0]

avrdude-64: Version 6.3-20190619
            Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
            Copyright (c) 2007-2014 Joerg Wunsch

            System wide configuration file is "./resources/linux/arduino/avrdude.conf"
            User configuration file is "/home/mdt/.avrduderc"
            User configuration file does not exist or is not a regular file, skipping

            Using Port                    : /dev/ttyUSB0
            Using Programmer              : arduino
avrdude-64: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
avrdude-64: stk500_getsync() attempt 2 of 10: not in sync: resp=0x1c
avrdude-64: stk500_getsync() attempt 3 of 10: not in sync: resp=0xfc
avrdude-64: stk500_getsync() attempt 4 of 10: not in sync: resp=0x1c
avrdude-64: stk500_getsync() attempt 5 of 10: not in sync: resp=0xfc
avrdude-64: stk500_getsync() attempt 6 of 10: not in sync: resp=0xe0
avrdude-64: stk500_getsync() attempt 7 of 10: not in sync: resp=0xfc
avrdude-64: stk500_getsync() attempt 8 of 10: not in sync: resp=0xfc
avrdude-64: stk500_getsync() attempt 9 of 10: not in sync: resp=0xfc
avrdude-64: stk500_getsync() attempt 10 of 10: not in sync: resp=0x00

avrdude-64 done.  Thank you.

2020-10-03 18:49:53,262 [main] ERROR d.f.i.r.c.w.a.ArduinoCommunicator uploadFile - Program was unable to be uploaded: 1, 
2020-10-03 18:49:53,263 [main] INFO  d.f.i.roberta.ui.main.MainController setState - Setting state to ERROR_UPLOAD_TO_ROBOT

with absolutly no hint in the GUI Message box about what went wrong. i searched a bit and found that the connector seems to run into this problem: https://www.heise.de/make/artikel/Arduino-Nano-mit-neuem-Bootloader-4011641.html - i use a quite old Nano which has the old bootloader installed. Is there a way to switch to the old bootloader?

BTW: Why is that jar obfuscated (d.f.i.r.c.w.a.)?

@emdete emdete changed the title destroyed arduino nano errors with arduino nano Oct 3, 2020
@rbudde
Copy link
Contributor

rbudde commented Oct 7, 2020

wrt obfuscation: the jar isn't obfuscated. Our logger has 36 chars and abbreviates logger names (assuming, that the name is <package-name>.<class-name> automatically. For example:

de.fhg.iais.roberta.util.Util (short enough)
d.f.i.roberta.util.ServerProperties (part-part)
d.f.i.r.p.AbstractProcessor (fully abbr)

@boonto
Copy link
Contributor

boonto commented Oct 7, 2020

For the first problem: I think the errors can be safely ignored, the network is scanned for network based robots and sometimes something may go wrong.

Second error: I am not sure how to reproduce that, can you tell me the steps that trigger it?

And for the final problem: these kind of errors happen from time to time with older and non-genuine Arduinos, especially Nanos.
We want to keep everything as simple as possible for most users, so you cannot select the type of bootloader or modify any other options, as the defaults work most of the time.
There are so many specific problems that may happen in conjunction with Arduinos that we just have to assume everything is "normal".

Though, you should be able to update the bootloader through the Arduino IDE, there should be enough tutorials on the internet for that. Once that is done, and everything works with the Arduino IDE, the Connector and the Lab should work as well.

@emdete
Copy link
Author

emdete commented Oct 11, 2020

If the error can be ignored why is it logged on WARN level?

The error can be reproduced in the Device-Edit-Dialog (btw: i just discoverd another strange behaviour: if i open that dialog another dialog popps up after a while to suggest to connect a device. that dialog can't be closed or otherwise interacted with while the first dialog is open), if i add a device from the top list and press 'Save'. I finally found out that the type needs to be edited.

I dont like programs that do auto-magic-everything because that fails miserably most of the times. It isnt much helpful in a classroom scenario as well. It would be easier if it would be possible to pinpoint the program to a desired behaviour via a config file or program arguments.

Upgrading the bootloader isnt an option for our students if that isn't urgently needed. The change in the connection is so simple that Open Roberta could easily support it. It can even be detected (USB ID is 1a86:7523). It's just the baudrate of 57600.

@boonto
Copy link
Contributor

boonto commented Oct 16, 2020

It is logged by the library we use for network scanning, in case something is wrong with finding network robots we could use it to determine the problem. For your usecase it can be ignored.

I was able to reproduce the second problem, I created #22 for that, thanks!

We decided on the automatic approach because that works for most of our users, without them having to change options they might not understand. I agree that allowing to specfiy extra options with (at least) a config file would be a nice addition, in case the automatic detection or transfer fails. However, that leads to capturing every specific workaround Arduinos might need, which is something we do not have the resources to support right now.
We are open to community contributions, though!

@emdete
Copy link
Author

emdete commented Nov 7, 2020

If one compiles the programs herself one can change a single line in de/fhg/iais/roberta/connection/wired/arduino/ArduinoCommunicator.java:94. Just add -b57600 to the options so that the line reads:

args.add("-patmega328p", "-carduino", "-b57600");

it will support the old bootloader this way. I "invented" a new type but that was rejected because the server doesnt know about it ;) (the arduino IDE does the same).

I as well implemented a single 60-liner to pinpoint to a certain robot/device. it isnt that complicated (for now bound to an arduino):

https://gist.github.com/emdete/2ee81f637c9a2108ef5f2adf65b51b8a

Maybe someone can take a look and tell if it's correct.

One word about auto-magic: I dont like it, especially in this case because OpenRoberta doesnt stop after succesfully connecting to a device. It further scans for devices. Watching the log is really concerning. For a stable, reliable and reproducable setup i prefere to tell the program what i want it to do, best by commandline arguments, no gui. The users are mainly young kids, i want to be able to prepare a setup for them that works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants