Cannot import snap blocks created in physical poppy ergo jr into Poppy Ergo Jr for browser

ergo-jr
snap
software
Tags: #<Tag:0x00007fae8d1bb410> #<Tag:0x00007fae8d1bb028> #<Tag:0x00007fae8d1bad80>

#1

Continuing the discussion from Load failed: Type Error: Cannot read property 'setContents' of undefined:
I created blocks in the Poppy Ergo Jr robot, which I saved to a .xml file. When I try to import the blocks to the online snap for poppy I get the error:

Load failed: Type Error: Cannot read property 'setContents' of undefined

In the developer console, the error says:

Uncaught TypeError: Cannot read property ‘getContext’ of null at Image.project.pentrails.onload store.js:392)

My workaround for now is to download Snap 4.2.2.9 and use that Snap locally, but it would be much nicer to be able to use the online version.

Has anyone been able to modify the .xml file such that it works in this case? I can import it to the Berkeley Snap editor, but I can’t get it to connect to poppy-services.


#2

hey @cbertin

I’m not sure I understand.

to program the robot with Snap you use the API (via port 6969). Thus, the origin of the request url does not matter as long as it reaches the robot.

by right-clicking on a block and then editing you can observe the instructions executed inside
Example for the block pypot-snap-blocks%20script%20pic%20(9) , it calls the block pypot-snap-blocks%20script%20pic%20(10) , which sends the following URL: http://poppy.local/motors/motors.
Whether this url is sent by Snap 4.2.2.9, or from an earlier version, or directly from the address bar of your web browser, does not change anything.

But if you use the online version, you are automatically redirected to an HTTPS page, but the API only works on HTTP requests and your browser certainly blocks them by default …
cf:


and


#3

Hey @tibo

Thank you for your reply. I seem to have mixed two different issues, which made my post confusing.

  1. I created some poppy blocks on the snap running on the poppy-ergo-jr robot itself. I saved those blocks to xml, but when I try to import them to the poppy-ergo-jr snap version I get the error “Load failed: Type Error: Cannot read property ‘setContents’ of undefined”. Linked that previous thread because it was created by someone else with the same issue. I am able to import that xml file to the Berkeley snap page though.

  2. The http / https issue. I am running a local poppy-ergo-jr on my computer. I cannot connect my poppy-ergo-jr to the Berkeley snap, even when I add http:// before the address, or when I check the option to run http in an https site. I can connect poppy-egro-jr to the poppy-project snap no problem (but I cannot load my blocks there… )

I tried the fixes of the threads you linked, but to no avail. My workaround is downloading snap 4.2.2.9 and running it locally, I can also skip the http / https issue by modifying threads.js changing https to http. I want to be able to use the online snap editors.


#4

why do you want to use this version of snap? This version is obsolete.
Preferably use the version in the robot http://poppy.local/snap
or the online version https://snap.berkeley.edu/snapsource/snap.html (paying attention to the HTTP issue).

You can also update the snap version available on the robot by replacing the files from the sd card located in the folder: /home/poppy/dev/puppet-master/snap/
Be careful, if you want your snap project to appear in the open section


edit the file
/home/poppy/dev/puppet-master/snapExamples/EXAMPLE.txt accordingly.