Cloud robotics demo code (now with actual code and links to BBC and FT)

The more technical aspects of Spirit, and carry-over discussion from Kickstarter updates.
headamage
Posts: 29
Joined: Mon Dec 04, 2017 5:27 pm

Re: Cloud robotics demo code (now with actual code!!)

Postby headamage » Wed Mar 21, 2018 7:14 pm

are you on pi3 or pi2?
I just discovered a major problem with pi3 on mine. Pi3 for some reason loses access to the file system when using the pixels. It's a catastrophic failure since the device crashes completely.
It may also simply be a case that your network cannot handle the camera traffic on top of the sensors. camera traffic does make it less responsive but it should not crash it completely.
i have to go back and rebuild it with pi2 and hope for the best at this point.

sm7tix
Posts: 31
Joined: Sat Oct 28, 2017 4:21 pm

Re: Cloud robotics demo code (now with actual code!!)

Postby sm7tix » Wed Mar 21, 2018 7:33 pm

Ok. I think it is the pi3 since it have wifi onboard.
I will try to figure out what causing this strange things but for now i have no clue where to start.
Kind regards

Stefan / SM7TIX

headamage
Posts: 29
Joined: Mon Dec 04, 2017 5:27 pm

Re: Cloud robotics demo code (now with actual code!!)

Postby headamage » Wed Mar 21, 2018 10:37 pm

ok since you definitely have pi3, i advise you do not use any of the pixel functions. Especially the navlights.py
Every time i start navlights.py on the pi3 it corrupts the file system. There seems to be a conflict between the supplied python libraries for pixels and the way the pi3 accesses the sd card. Go through my scripts and eliminate all the pixel functions from all of them. i didn't notice any problems with the servos and motors so everything else should be fine.
You should definitely be able to use manual control over the network without the camera.
i just finished moving back to pi2. I wasted the whole day trying to troubleshoot problems with pi3.

sm7tix
Posts: 31
Joined: Sat Oct 28, 2017 4:21 pm

Re: Cloud robotics demo code (now with actual code!!)

Postby sm7tix » Thu Mar 22, 2018 3:23 am

headamage wrote:ok since you definitely have pi3, i advise you do not use any of the pixel functions. Especially the navlights.py
Every time i start navlights.py on the pi3 it corrupts the file system. There seems to be a conflict between the supplied python libraries for pixels and the way the pi3 accesses the sd card. Go through my scripts and eliminate all the pixel functions from all of them. i didn't notice any problems with the servos and motors so everything else should be fine.
You should definitely be able to use manual control over the network without the camera.
i just finished moving back to pi2. I wasted the whole day trying to troubleshoot problems with pi3.

Ok. I will go through the code and comment out pixel-functions. I am visual impaired so i can't change the pi by myself :D My nephew build mine ( sloppy work and screws falling of ) so i find another person doing it i have a pi2 here also. But then i have to get a USB wifi adapter. The one i have here don't work on raspbian.

Kind regards

Stefan / SM7TIX

sm7tix
Posts: 31
Joined: Sat Oct 28, 2017 4:21 pm

Re: Cloud robotics demo code (now with actual code!!)

Postby sm7tix » Thu Mar 22, 2018 3:46 am

There are some issues with the socket lib also I think. When cloud code is started it is ok to connect to the rover through a new ssh connection, but when i start the graph on my desktop the network on the rover gets unreachable until I close the graph again. Maybe the ip get bind by socket but it should only bind port i think.
I will google for a while.... :D
Kind regards

Stefan / SM7TIX

sm7tix
Posts: 31
Joined: Sat Oct 28, 2017 4:21 pm

Re: Cloud robotics demo code (now with actual code!!)

Postby sm7tix » Thu Mar 22, 2018 10:31 am

Network issue solved!!
I don't know what was wrong, but i rewrote the /etc/network/interfaces file and now it works like a sharm! I can run graph, manual and cam at the same time. GREAT work!
I get some error on read and error on write from cloud. Do you know how to debug that more?
Do you know how to set static values in the QT window? Volt for example could be between 2 and 4 volt. Easier to the trend when draining the battery.
Is there a way to get the graph-window without X?
I have setup a "mission control" on a headless virtual machine and it should be nice to have one console with the graph in in it.
When i run the manual rover code it picks up keystrokes from all my terminal windows. I will see if i find anything on the net on this.
The pixel lib, is it something done just for the spirit or is it a common lib?
Keep up the good work!
Kind regards

Stefan / SM7TIX

tvoverbeek
Posts: 5
Joined: Sun Feb 11, 2018 8:20 am

Re: Cloud robotics demo code (now with actual code!!)

Postby tvoverbeek » Thu Mar 22, 2018 6:01 pm

The pixel lib, is it something done just for the spirit or is it a common lib?

Spirit-pixel.py is just a front-end to send commands to the pgpixelserver via the network.
pgpixelserver processes the received commands and the actual pixel operations are in PixAnimation.py
PixAnimation.py uses the rpi_ws281x neopixel library (https://github.com/jgarff/rpi_ws281x)
which is used by many projects.
So quite a long way from spirit-pixel.py to the actual pixels.

headamage
Posts: 29
Joined: Mon Dec 04, 2017 5:27 pm

Re: Cloud robotics demo code (now with actual code!!)

Postby headamage » Thu Mar 22, 2018 8:40 pm

tvoverbeek wrote:
The pixel lib, is it something done just for the spirit or is it a common lib?

Spirit-pixel.py is just a front-end to send commands to the pgpixelserver via the network.
pgpixelserver processes the received commands and the actual pixel operations are in PixAnimation.py
PixAnimation.py uses the rpi_ws281x neopixel library (https://github.com/jgarff/rpi_ws281x)
which is used by many projects.
So quite a long way from spirit-pixel.py to the actual pixels.


The issue is that somewhere along the way on a Pi3 one of these libs interferes with the SD card bus and the Pi immediately crashes with errors that the file system is read-only and eventually may corrupt the SD card completely. I have only encountered this on Pi3 so I cannot recommend Pi3 for the rover at this point. The Pi2 works like a charm every time but it does need a USB-WiFi adapter.

headamage
Posts: 29
Joined: Mon Dec 04, 2017 5:27 pm

Re: Cloud robotics demo code (now with actual code!!)

Postby headamage » Thu Mar 22, 2018 8:50 pm

sm7tix wrote:Network issue solved!!
I don't know what was wrong, but i rewrote the /etc/network/interfaces file and now it works like a sharm! I can run graph, manual and cam at the same time. GREAT work!
I get some error on read and error on write from cloud. Do you know how to debug that more?
Do you know how to set static values in the QT window? Volt for example could be between 2 and 4 volt. Easier to the trend when draining the battery.
Is there a way to get the graph-window without X?
I have setup a "mission control" on a headless virtual machine and it should be nice to have one console with the graph in in it.
When i run the manual rover code it picks up keystrokes from all my terminal windows. I will see if i find anything on the net on this.
The pixel lib, is it something done just for the spirit or is it a common lib?
Keep up the good work!


Very good questions but I don't know the answers to most of them :D
Ignore the read/write errors appearing on the clouddemo.py. They are actually generated by the rover.py so my guess is that it somestimes has trouble talking to the PIC. At worst you may lose a couple of sensor measurements per second which is nothing since you are sending over 20 samples per second.

The scale on the y-axis for the graphs should be possible to be locked to a certain range but I never checked how. It was the first time i use python to make any graphs and most of the code is copied and modified from an example. Speaking of seeing the trend, you can go in the graph script and modify the size of the arrays with the number of elements you want. I currently fill them with 100 samples of 0. You can make them 1000 if you want the graph to display a longer duration. I don't know what the max array size is in python. Maybe it is worth checking out if you want to see a trend. Otherwise, you can write a subroutine that will take multiple volt readings and average them and only update the volt graph once every few minutes.

graphs without X means curses on terminal really. I have never programmed anything with curses but it sounds like an interesting approach.

Good thing that your manual control seems to pick up the keyboard from inside terminal windows. I just confirmed again today on my laptop that it won't do that and I must open another application and select that in order for my keystrokes to register in the manualcontrol.py. No idea why this is happening on that laptop.

Today was the rover's first trip over the prototype 5G network and it performed beautifully. :D

sm7tix
Posts: 31
Joined: Sat Oct 28, 2017 4:21 pm

Re: Cloud robotics demo code (now with actual code!!)

Postby sm7tix » Thu Mar 22, 2018 11:29 pm

Thanks again for all the info!
I will try to find someone to switch the pi3 to a pi2 on the rover for me, or i have to fix the issue for the spirit_pixel :D
Now with a working platform it will be fun and easier to learn more about this rover and programming.
Sounds great that you succeeded with the 5G trial!
I will keep you posted if i find any good code or make some other changes.
May the force be with you!
Kind regards

Stefan / SM7TIX


Who is online

Users browsing this forum: No registered users and 2 guests