ElEscalador
Posts: 681
Joined: Tue Dec 15, 2015 4:55 pm
Location: Detroit, MI USA
Contact: Website

Is a 2nd Pi (for speed) just a waste on my robot?

Tue May 30, 2017 9:31 pm

So I'm finally starting to upgrade the robot...(it's a hacked roomba, currently running on a PI3) The general idea I've had all along was to add another PI3 when I upgrade other hardware - one would be dedicated to navigation and mapping of the environment and reading sensors and getting data from the roomba, the other PI would handle all the other stuff - like actually choosing a destination (the navigation computer then decides how to get there)...starting the car/furnace...communicating with other PIs scattered around dedicated to the garage or other fixes areas...whatever other functions I add.

I figured that I want the navigation to be as blazing fast as possible - especially while robot is moving - and thus the idea to run the real brain functions on another computer all together. BUT I've seen people mention things like programs only run on one core anyway and there is four cores and things I know nothing about...

I guess I'm asking if I just run two fairly large c++ programs, will they run on different cores and be just as fast as running on two separate pis anyway? Is there a way to know there are running on separate cores or the same one? What about other programs called by the "brain" program?
My Autonomous Robot Project and a few of my other projects below.

https://lloydbrombach.wordpress.com/

BMS Doug
Posts: 3824
Joined: Thu Mar 27, 2014 2:42 pm
Location: London, UK

Re: Is a 2nd Pi (for speed) just a waste on my robot?

Tue May 30, 2017 10:36 pm

I think that you'd be fine with a single pi3, I suspect that any potential speed benefits would be lost during communications between the two raspberries.
Doug.
Building Management Systems Engineer.

Heater
Posts: 13694
Joined: Tue Jul 17, 2012 3:02 pm

Re: Is a 2nd Pi (for speed) just a waste on my robot?

Tue May 30, 2017 10:58 pm

Have you checked the CPU load on your current Pi setup?

You don't know you need more compute power if you have not measured what you have yet.
Memory in C++ is a leaky abstraction .

peterlite
Posts: 720
Joined: Sun Apr 17, 2016 4:00 am

Re: Is a 2nd Pi (for speed) just a waste on my robot?

Tue May 30, 2017 11:05 pm

There are commands for displaying usage by core. You can check what happens with two programs. You could split your code in four to use four cores. Communication between multiple programs in one Pi will be faster than between two in separate computers.

pageauc
Posts: 224
Joined: Fri Jan 04, 2013 10:52 pm

Re: Is a 2nd Pi (for speed) just a waste on my robot?

Wed May 31, 2017 10:50 am

You can use htop to monitor cpu core activity plus many other things. To install

Code: Select all

sudo apt-get install htop
htop
press q to quit

htop can be run from a console session while your program is running. This will help you determine how many cores are working and what they are working on. You can then determine if code needs to be modified to take advantage of idle cores.
GitHub - https://github.com/pageauc
YouTube - https://www.youtube.com/user/pageaucp

YCN-
Posts: 246
Joined: Fri Jun 10, 2016 3:18 pm

Re: Is a 2nd Pi (for speed) just a waste on my robot?

Wed May 31, 2017 11:13 am

Hi,

You can use threads to have things done simultaneously with diferrent CPU.
Rpi are pretty powerfull, 4 CPU and 4GB Ram and you can even overclock it if needed.

https://haydenjames.io/raspberry-pi-3-overclock/

I feel like people tend to underestimate its capabilities. You just have to do some proper coding and think about how to process your data the best way.

YCN-

ElEscalador
Posts: 681
Joined: Tue Dec 15, 2015 4:55 pm
Location: Detroit, MI USA
Contact: Website

Re: Is a 2nd Pi (for speed) just a waste on my robot?

Wed May 31, 2017 12:56 pm

Cool, thanks for the info. htop should come in handy..I did figure communications would be slowish between the two... I just need to make sure the navigation program remains running top notch and doesn't slow down polling sensor data because the brain is receiving/processing an interrupt request (which hopefully requires voice recognition down the line). Plus I'll need to access cameras and both programs with VNC.
My Autonomous Robot Project and a few of my other projects below.

https://lloydbrombach.wordpress.com/

User avatar
davidcoton
Posts: 4200
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK

Re: Is a 2nd Pi (for speed) just a waste on my robot?

Wed May 31, 2017 4:28 pm

YCN- wrote:Hi,

You can use threads to have things done simultaneously with diferrent CPU.
Rpi are pretty powerfull, 4 CPU and 4GB Ram and you can even overclock it if needed.

https://haydenjames.io/raspberry-pi-3-overclock/

I feel like people tend to underestimate its capabilities. You just have to do some proper coding and think about how to process your data the best way.

YCN-
I'm afraid you are overestimating the capabilities. 4 CPU yes, but only 1GB RAM.
Signature retired

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23947
Joined: Sat Jul 30, 2011 7:41 pm

Re: Is a 2nd Pi (for speed) just a waste on my robot?

Wed May 31, 2017 6:27 pm

davidcoton wrote:
YCN- wrote:Hi,

You can use threads to have things done simultaneously with diferrent CPU.
Rpi are pretty powerfull, 4 CPU and 4GB Ram and you can even overclock it if needed.

https://haydenjames.io/raspberry-pi-3-overclock/

I feel like people tend to underestimate its capabilities. You just have to do some proper coding and think about how to process your data the best way.

YCN-
I'm afraid you are overestimating the capabilities. 4 CPU yes, but only 1GB RAM.
1GB should be fine for a huge number of tasks. If not, write better code. You can often get around memory limitations simply by trying different algorithms.

Of course, some things are simply memory hungry by nature, but that's fairly few and far between, usually in the video domain.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I think it’s wrong that only one company makes the game Monopoly.” – Steven Wright

YCN-
Posts: 246
Joined: Fri Jun 10, 2016 3:18 pm

Re: Is a 2nd Pi (for speed) just a waste on my robot?

Thu Jun 01, 2017 8:03 am

davidcoton wrote: I'm afraid you are overestimating the capabilities. 4 CPU yes, but only 1GB RAM.
My bad, sorry ! I was scrambelling info in my brain ahah.

YCN-

User avatar
Gavinmc42
Posts: 3927
Joined: Wed Aug 28, 2013 3:31 am

Re: Is a 2nd Pi (for speed) just a waste on my robot?

Thu Jun 01, 2017 9:22 am

Or plug a Zero into a USB port and use it as separate controller.

Zero's will boot without a SD card and can grab it's software from the Pi3.
I have been playing with that recently trying to get a Cluster hat doing this.
Did get a Zero booting from a PC and it only needs three files, bootload.bin, start.elf and kernel.bin.
I use Ultibo to make the kernel.bin
Ultibo is also multicore aware so you could run stuff on one core and other stuff on another etc on a Pi3.

You could use the Zero's as smart cameras etc but you will need a Linux OS at the moment, piCore works.
Zero's are low enough cost and run at 1GHz so are faster than normal Pi B+, A+.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

mattmiller
Posts: 2115
Joined: Thu Feb 05, 2015 11:25 pm

Re: Is a 2nd Pi (for speed) just a waste on my robot?

Thu Jun 01, 2017 10:02 am

Zero's will boot without a SD card and can grab it's software from the Pi3.
Have you a link to info on doing that please?
You could use the Zero's as smart cameras
That's an interesting idea :)

User avatar
Gavinmc42
Posts: 3927
Joined: Wed Aug 28, 2013 3:31 am

Re: Is a 2nd Pi (for speed) just a waste on my robot?

Thu Jun 01, 2017 11:53 am

Have you a link to info on doing that please?
Lots of links here, pretty much to everything I could find :lol:
https://ultibo.org/forum/viewtopic.php? ... 3&start=20

May have missed some Zero stuff, as I only really got back into it seriously recently.
It is looking possible to get camera working on Ultibo.
2 second boot Zero cameras :D

Full 64bit Ultibo is still a bit off but even I got it working and the QEMU version.
Going this way you don't have to wait for a 64bit Raspbian.

Since Robotics is what I spent most of my 13 years of Tertiary education learning, I have a little interest in Ultibo for bots :lol:
With AI/ML running on the Quad core Pi3 using NEON.
And of course NEON is perfect for vision image handling.

I played with the Creator bot and was not impressed, it seems a little flimsy.
With kid and dogs my bots have to be tougher than them, not easy to do :lol:
At my current rate of progress kid will have grown up and moved out ;)
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

mattmiller
Posts: 2115
Joined: Thu Feb 05, 2015 11:25 pm

Re: Is a 2nd Pi (for speed) just a waste on my robot?

Thu Jun 01, 2017 2:33 pm

That lot looks a little above my pay grade! :)

User avatar
Gavinmc42
Posts: 3927
Joined: Wed Aug 28, 2013 3:31 am

Re: Is a 2nd Pi (for speed) just a waste on my robot?

Sat Jun 03, 2017 6:31 am

That lot looks a little above my pay grade! :)
Mine too :lol:
But with the advances of tools like Ultibo, this high level stuff is within reach of people like me.
Just like Arduino made one( now many) micro easy to code for non programmers so Pi's and such tools have now reached the stage where maybe anything done in Linux on Pi's could be made in baremetal.

With USB boot mode on Zero's interesting things could be made.
https://ultibo.org/forum/viewtopic.php? ... ogic#p3189

Add TFT display to Zero and you can make a robot face.
https://ultibo.org/forum/viewtopic.php? ... eyes#p2572
Since then I figured out png to bmp to animation, it is fast enough on a Pi3 just fetching from files.
Once memory streaming /DMA etc is used it should be fast enough on a Zero.

Wanted to try this with Pi's, started at Stan Winston's shop?
https://learn.adafruit.com/animated-ele ... 1/overview

Hmm, latest google found this, it's gone mainstream into toys
https://www.engadget.com/2016/11/02/cab ... available/

A Zero for eyes/face, another Zero for camera, one more for ears/speech command processing...
Could do it all on one zero if you are a good coder
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

Return to “General discussion”