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
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Cloud robotics demo code

Postby headamage » Sun Mar 18, 2018 5:22 pm

i'm on the same boat here. I am a network engineer so programming is not my strength at all. I am not new to arduino and python but my code is always very simple and straight forward. There are probably 100 different ways to do my code better. In fact I have ideas on how to improve it but don't know how to implement them.
I just finished implementing gripper and servo functions on the manual control. I am trying to figure out how to best take a video of it in action because I have to hold the camera and run the robot at the same time :lol:

headamage
Posts: 29
Joined: Mon Dec 04, 2017 5:27 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Cloud robotics demo code

Postby headamage » Sun Mar 18, 2018 5:54 pm


This is an early stage video before I implemented the rangefinder into python. All 'intelligence' functions are running on my PC and the rover simply sends sensor data and receives motor instructions over WiFi.
At the moment it can also use the rangefinder to avoid obstacles but I don't have a video of that yet. I am using the black tape on the floor as boundaries that the surface sensors pick up.


This is current state of manual control over WiFi. I am using jenga blocks and some batteries as objects to pick up or avoid with the rangefinder.
In this case I am picking up the battery and moving it. Second attempt to pick it up failed :lol:
WASD controls the movement, G engages/disengages gripper and UJHK move the head.

I have tried controlling the robot only by looking through its camera but the perspective makes it very difficult to estimate the distance to objects. Still I did manage to pick up the battery a few times. The jenga blocks are too tall and block the camera when it is holding them.

headamage
Posts: 29
Joined: Mon Dec 04, 2017 5:27 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Cloud robotics demo code

Postby headamage » Sun Mar 18, 2018 7:14 pm

Early Christmas present :lol:
All code can be found below.


The documentation is very basic but then again so is my code. If you have any questions let me know.

User avatar
TomTheWhittler
Posts: 29
Joined: Wed Sep 13, 2017 5:04 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

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

Postby TomTheWhittler » Sun Mar 18, 2018 8:58 pm

Thanks again for this. I am eager to try but somewhere along the line my Raspberry Pi 3 image got corrupt so I have to rebuilt that first.
Guessing it is the problem mention earlier in the thread of :" Also highly recommended to increase the shutdown delay to 10 seconds because I found the default 5 seconds is not enough and RasPi was losing power in the middle of its shutdown sequence."

I had hoped that Kevin would be a little more involved since he designed this up but I am glad someone else is stepping up.
Kevin does seem to be MIA lately. Hope he is okay.
Research is the only place in a company where you can continually have failures and still keep your job.
I knew immediately that was where I belonged.

headamage
Posts: 29
Joined: Mon Dec 04, 2017 5:27 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

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

Postby headamage » Sun Mar 18, 2018 9:34 pm

You are very welcome. Yes, it might be related to pi losing power during shutdown. Just take out the SD card from the Pi and flash it with your PC/laptop (assuming you have a card reader). I am using the latest raspbian image and flash it directly on the card so I don't have to use NOOBs after to actually install the OS.
For my rover, I am using the lite raspbian version because I don't need the GUI or any of the extras. Boots up faster and generally is cleaner.

Best of luck and let me know if you need help.

sm7tix
Posts: 31
Joined: Sat Oct 28, 2017 4:21 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Cloud robotics demo code

Postby sm7tix » Tue Mar 20, 2018 6:06 pm

Kind regards

Stefan / SM7TIX

sm7tix
Posts: 31
Joined: Sat Oct 28, 2017 4:21 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

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

Postby sm7tix » Tue Mar 20, 2018 6:47 pm

First try with the sensors demo.
sensorsrover.png
(63.18 KiB) Not downloaded yet

The rangefinder sometimes have a "heart beat" even it it looks into a wall.
Still a very nice work! I will continue to try it out. A suggestion is to make a config-file for the code there we could put in the ipadresses needed and a requirement file for the modules that have to be installed.
THANKS!
Kind regards

Stefan / SM7TIX

headamage
Posts: 29
Joined: Mon Dec 04, 2017 5:27 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

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

Postby headamage » Tue Mar 20, 2018 11:41 pm

rangefinder accuracy is a bit sketchy from what I have seen also but this is not meant to be a high precision sensor. For the rover's purposes, it does the job very well. Occasionally you will get some fluctuations but also keep in mind, the graphs have auto scale, so what looks like a huge jump or fall in the range may actually be only a few mm. Like in the case of your screenshot, the fall is just a few mm but it looks huge because the scale on Y-axis is only a few mm also. :D

i'm glad it works for you. Thanks for spotting the mistake on the second line of navlights.py, I have fixed it now. Funny enough it never complained so i am guessing it is not used in the code. You can run the sensors demo in parallel to manual control or AI. It shouldn't affect the performance since the Pi will transmit packets to both anyway the moment you initiate the clouddemo.py.

I will add some extra info in the documentation. I also thought about config file to have all the settings in one place.
I also need to add a few things in the documentation, particularly things you need to install with pip but at the moment only pynput comes to mind.

Keep in mind that on ubuntu 17 i found the manual control does not work when you have the terminal window selected. You need to open up another application like a text editor and press keyboard buttons while you are in that application otherwise they don't register as events in python and the rover won't move. This only happens on ubuntu 17 laptop. Ubuntu 16 VMs grab keyboard from inside the terminal also. I have no idea why this happens.
You may also get a bit better responses if you install lowlatency kernel on linux. And there is also a lowlatency kernel project for raspi but I am not using it.

Also keep in mind, the new Raspi3 B+ is not compatible with the top plate of the rover due to the new pins it has for PoE. I found out the hard way today. I had to settle for a Pi3 B as an upgrade to my Pi2.

sm7tix
Posts: 31
Joined: Sat Oct 28, 2017 4:21 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

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

Postby sm7tix » Wed Mar 21, 2018 5:57 am

Kind regards

Stefan / SM7TIX

sm7tix
Posts: 31
Joined: Sat Oct 28, 2017 4:21 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

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

Postby sm7tix » Wed Mar 21, 2018 11:17 am

If i start the clouddemo on the pi and provergraph on the pc all works nice.
BUT if i then access the cam through a webpage the rover get unresponsive! Have to be rebooted to access it again. I have been reading and trying now for several hours but i don't know more things to try now. Someone?
I have tried to send private msg but it doesn't work.
Kind regards

Stefan / SM7TIX


[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Who is online

Users browsing this forum: No registered users and 2 guests