<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://nurdspace.nl/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Peterr</id>
	<title>NURDspace - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://nurdspace.nl/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Peterr"/>
	<link rel="alternate" type="text/html" href="https://nurdspace.nl/Special:Contributions/Peterr"/>
	<updated>2026-05-10T13:03:37Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.4</generator>
	<entry>
		<id>https://nurdspace.nl/index.php?title=Electricity_overhaul&amp;diff=15868</id>
		<title>Electricity overhaul</title>
		<link rel="alternate" type="text/html" href="https://nurdspace.nl/index.php?title=Electricity_overhaul&amp;diff=15868"/>
		<updated>2026-04-08T20:04:59Z</updated>

		<summary type="html">&lt;p&gt;Peterr: /* Stuff that needs to happen */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Name=Electricity overhaul&lt;br /&gt;
|Participants= r3boot Rubberduck septillion&lt;br /&gt;
|Status=In progress&lt;br /&gt;
|Niche=Electronics&lt;br /&gt;
|Purpose=Infra&lt;br /&gt;
|Tool=No&lt;br /&gt;
|Location=Space&lt;br /&gt;
|Category=Infra&lt;br /&gt;
|Image=File:danger-high-voltage-sign-vector-6149863.jpg&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
This page is to make some investigate and track the changes that could/need to be done or are done, keeping in mind that we also would like [[Solar power]].&lt;br /&gt;
&lt;br /&gt;
This page is only for the project itself, see the pages about the [[distribution board]] and [[power distribution]].&lt;br /&gt;
&lt;br /&gt;
== Stuff that needs to happen ==&lt;br /&gt;
* &amp;lt;s&amp;gt;Replace the current [[groepenkast]]&amp;lt;/s&amp;gt;&lt;br /&gt;
* Add &#039;[[Cabletray|kabelgoot]]&#039;&lt;br /&gt;
* Rebuild whole infra (step by step)&lt;br /&gt;
* &amp;lt;s&amp;gt;Add more groups&amp;lt;/s&amp;gt;&lt;br /&gt;
* Remove old infra (as we go)&lt;br /&gt;
* upgrade aansluiting to 3x25A&lt;br /&gt;
&lt;br /&gt;
== Ideas == &lt;br /&gt;
What do we like to achieve in the end:&lt;br /&gt;
* Done! &amp;lt;s&amp;gt;One distribution board for the whole space @ grid connection point&amp;lt;/s&amp;gt;&lt;br /&gt;
* Done! &amp;lt;s&amp;gt;[https://en.wikipedia.org/wiki/Residual-current_device#RCBO2 RCBO] (Dutch: [https://nl.wikipedia.org/wiki/Aardlekautomaat aardlekautomaat]) for every end circuit to isolate circuits for each other.&amp;lt;/s&amp;gt;&lt;br /&gt;
* Replace all wiring&lt;br /&gt;
* New wiring in central cable tray along the length of the space&lt;br /&gt;
* Go step by step, old distribution stays in place until room is remodeled&lt;br /&gt;
* Upgrade to 3-phase power&lt;br /&gt;
&lt;br /&gt;
== Original layout ==&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
:File:groepenverkl_kast A.jpg|400px&lt;br /&gt;
Volkshuis-stoppenkastkaart.JPG&lt;br /&gt;
:File:Groepenverklaring_kast_b.jpg|400px&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Original circuits ==&lt;br /&gt;
Called &amp;quot;groepen&amp;quot; in Dutch.&lt;br /&gt;
=== Groepen kast A===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name&lt;br /&gt;
! Location&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| Groep 4 Kast A &lt;br /&gt;
| Toilet groep bar&lt;br /&gt;
| 16 A&lt;br /&gt;
|-&lt;br /&gt;
|Groep 5 res.&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|3 fase groep &lt;br /&gt;
|voeding kast b&lt;br /&gt;
| 3x 20A  afgezekerd.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Groepen Kast B===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name&lt;br /&gt;
! Location&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;del&amp;gt;Groep 1&amp;lt;/&amp;gt;  &lt;br /&gt;
| zaal 3 zaal2 gang 1 wcd&lt;br /&gt;
| 16 A&lt;br /&gt;
|-&lt;br /&gt;
|Groep 2 res.&lt;br /&gt;
|Zaal 2 zaal3 1 wcd, gang deur makershoek zaal 1  studio&lt;br /&gt;
|-&lt;br /&gt;
|groep 3 &lt;br /&gt;
|zaal 3 bar makershoek&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
Groep 1 is now out of service as part of the overhaul.&lt;br /&gt;
&lt;br /&gt;
== New ==&lt;br /&gt;
See [[Distribution board#Circuits]]&lt;br /&gt;
&lt;br /&gt;
== 3-phase power ==&lt;br /&gt;
Currently the space is supplied with 1-phase power. It is a 1x30A (or maybe even a 1x25A) connection. Now the [[distribution board]] is upgraded and has a 4-pole main switch (Dutch: hoofdschakelaar) it is possible to apply for an upgrade to 3-phase. This would mean an upgrade to 3x25A. The monthly fee is the same as the current 1-phase.&lt;br /&gt;
&lt;br /&gt;
The upgrade needs to be applied from Liander via [https://www.mijnaansluiting.nl]. The cost is [https://www.liander.nl/-/media/files/tarieven/consument/2024/eenmalige-tarieven-stroom-2024.pdf €332,15] and is expected tot take 6 weeks. The smart meter will get replaced in the process.&lt;br /&gt;
&lt;br /&gt;
== Old ideas ==&lt;br /&gt;
Just moved here for reference.&lt;br /&gt;
=== Shopping list ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Product&lt;br /&gt;
! Amount&lt;br /&gt;
! Price&lt;br /&gt;
! Shop&lt;br /&gt;
! Comments&lt;br /&gt;
|-&lt;br /&gt;
| kabel 5x2.5mm 100M&lt;br /&gt;
| 1&lt;br /&gt;
| 281,59&lt;br /&gt;
| https://www.elektrobode.nl/products/alfana-ymvk-dca-5g2-5mm2-gr-r100-ymvk5g2-5r&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| Kabel 3x2.5mm 500M&lt;br /&gt;
| 1&lt;br /&gt;
| 858&lt;br /&gt;
| https://www.elektrobode.nl/products/alfana-ymvk-dca-3g2-5mm2-gr-h500-ymvk3g2-5h&lt;br /&gt;
|-&lt;br /&gt;
| Abb Haf 3640 kabeldoos met schetsplaat&lt;br /&gt;
| ?&lt;br /&gt;
| ?&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| Abb Haf 3640 deksel rood met normaal/wieland wcd&lt;br /&gt;
| ?&lt;br /&gt;
| ?&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| Abb Haf 3640 deksel  grijs met normaal wcd&lt;br /&gt;
| ?&lt;br /&gt;
| ?&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| Abb Haf 3640 deksel grijs&lt;br /&gt;
| ?&lt;br /&gt;
| ?&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| Abb Haf 3640 deksel rood &lt;br /&gt;
| ?&lt;br /&gt;
| ?&lt;br /&gt;
| ?&lt;br /&gt;
|- &lt;br /&gt;
 I have made 2 different cabinet proposals.&lt;br /&gt;
1 with 2 columns and 1 with 1 column.&lt;br /&gt;
[[:File:kast_2kolom.pdf]] the 2 columns € 635.46&lt;br /&gt;
[[:File:kast _1kolom.pdf]] the single. € 628.89 &lt;br /&gt;
or we can make one ourselves, see the list below&lt;br /&gt;
|-&lt;br /&gt;
| Groepenkast&lt;br /&gt;
| 1&lt;br /&gt;
| 420,36&lt;br /&gt;
| https://www.elektrobode.nl/products/eaton-moeller-wandverdeler-bp-o-144te-ip30-b600-h1060-wit-opbouw-105535&lt;br /&gt;
|-&lt;br /&gt;
| Main Switch&lt;br /&gt;
| 1&lt;br /&gt;
| 21,79&lt;br /&gt;
|https://www.elektrobode.nl/products/eaton-lastscheider-4p-40a-flex-1742151&lt;br /&gt;
|-&lt;br /&gt;
| overspanning security.&lt;br /&gt;
| 1&lt;br /&gt;
| 124,92&lt;br /&gt;
|https://www.elektrobode.nl/products/eaton-moeller-overspanningsafleider-spct2-280-4-167596&lt;br /&gt;
|-&lt;br /&gt;
| installatie zekering 1x16A&lt;br /&gt;
|15&lt;br /&gt;
| 13,99&lt;br /&gt;
| https://www.elektrobode.nl/products/eaton-moeller-installatieautomaat-pln6-c16-1n-mw-c-16a-2-polig-incl-nul-6-ka-263174&lt;br /&gt;
|-&lt;br /&gt;
| i0nstallatie zekering 2x16 A&lt;br /&gt;
| 2 &lt;br /&gt;
|42,42&lt;br /&gt;
| https://www.elektrobode.nl/products/eaton-install-aut-6ka-2p2n-20a-b-kar-flex-1742419 for furness/solar panel&lt;br /&gt;
|-&lt;br /&gt;
| aardlek schakelaar&lt;br /&gt;
| 4&lt;br /&gt;
| 60,88&lt;br /&gt;
|https://www.elektrobode.nl/products/eaton-aardlekschakelaar-2p-40a-30ma-a-flex-naast-1742425&lt;br /&gt;
|-&lt;br /&gt;
| kabelgoot 200mm &lt;br /&gt;
| 50M&lt;br /&gt;
|?&lt;br /&gt;
|?&lt;br /&gt;
|-&lt;br /&gt;
|  scheidingschot &lt;br /&gt;
|50M&lt;br /&gt;
|?&lt;br /&gt;
|?&lt;br /&gt;
|-&lt;br /&gt;
|  aftakstuk 200&lt;br /&gt;
|5&lt;br /&gt;
|?&lt;br /&gt;
|?&lt;br /&gt;
|-&lt;br /&gt;
|  eindkap  200&lt;br /&gt;
|6&lt;br /&gt;
|?&lt;br /&gt;
|?&lt;br /&gt;
|-&lt;br /&gt;
|  vervalkstuk 200&lt;br /&gt;
|2&lt;br /&gt;
|?&lt;br /&gt;
|?&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
|}&lt;br /&gt;
=== New circuits idea ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name&lt;br /&gt;
! Location&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| light incl. emergency light.&lt;br /&gt;
| whole space.&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| serverrack.&lt;br /&gt;
| hall.&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
| Cv. installation.&lt;br /&gt;
| cv. closet.&lt;br /&gt;
| 3&lt;br /&gt;
|-&lt;br /&gt;
| Dishwasher. refrigerator incl. beer.&lt;br /&gt;
| bar.&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
| Cooker&lt;br /&gt;
| bar.&lt;br /&gt;
|6&lt;br /&gt;
|-&lt;br /&gt;
| Furness&lt;br /&gt;
| 2X16A or 3x16A&lt;br /&gt;
| 7&lt;br /&gt;
|-&lt;br /&gt;
|General Usage&lt;br /&gt;
| bar.&lt;br /&gt;
|8&lt;br /&gt;
|-&lt;br /&gt;
|room1.&lt;br /&gt;
| room 1.&lt;br /&gt;
|9&lt;br /&gt;
|-&lt;br /&gt;
| room 1&lt;br /&gt;
| room1.&lt;br /&gt;
| 10&lt;br /&gt;
|-&lt;br /&gt;
| room 2 &lt;br /&gt;
| &lt;br /&gt;
| 11&lt;br /&gt;
|-&lt;br /&gt;
|room 2&lt;br /&gt;
|&lt;br /&gt;
| 12&lt;br /&gt;
|-&lt;br /&gt;
| room 3&lt;br /&gt;
| room 3.&lt;br /&gt;
| 13&lt;br /&gt;
|-&lt;br /&gt;
| room 3&lt;br /&gt;
| room 3.&lt;br /&gt;
| 14&lt;br /&gt;
|-&lt;br /&gt;
| Maker corner 1&lt;br /&gt;
| maker corner.&lt;br /&gt;
| 15&lt;br /&gt;
|-&lt;br /&gt;
| Solar panels&lt;br /&gt;
| rooftop&lt;br /&gt;
|16&lt;br /&gt;
| What is nessary (Rubberduck has 2X16 A for it) &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Peterr</name></author>
	</entry>
	<entry>
		<id>https://nurdspace.nl/index.php?title=Cabletray&amp;diff=15867</id>
		<title>Cabletray</title>
		<link rel="alternate" type="text/html" href="https://nurdspace.nl/index.php?title=Cabletray&amp;diff=15867"/>
		<updated>2026-04-08T19:48:47Z</updated>

		<summary type="html">&lt;p&gt;Peterr: planning cabletray&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Planning cable tray continuation, step and two of many&lt;br /&gt;
&lt;br /&gt;
1. Construct the small cable tray going towards the kitchen&lt;br /&gt;
   - find the position of the screws in the ceiling beam allong the wall into the kitchen &lt;br /&gt;
     (75cm from main system tray, 150 cm, 75 cm (end of small tray.&lt;br /&gt;
   - screw the vertical holders in the beam&lt;br /&gt;
   - hang up the small cable tray&lt;br /&gt;
   &lt;br /&gt;
2. Extend the cable tray in the corridor trough the wall of room 1 &lt;br /&gt;
  - get a laser to find the position on the wall wthe hole should be &lt;br /&gt;
  - draw the outline on the outside  wall of room 1&lt;br /&gt;
  - get a strong enough drill (find Parkside drill back -mail on mailinglist!)&lt;br /&gt;
  - drill enough holes allong the outline to be able of remove the inner block&lt;br /&gt;
  - rinse and repeat for the inside wall in room 1&lt;br /&gt;
  - put up the cable tray&lt;/div&gt;</summary>
		<author><name>Peterr</name></author>
	</entry>
	<entry>
		<id>https://nurdspace.nl/index.php?title=Open_hackerspace_dag_2026&amp;diff=15808</id>
		<title>Open hackerspace dag 2026</title>
		<link rel="alternate" type="text/html" href="https://nurdspace.nl/index.php?title=Open_hackerspace_dag_2026&amp;diff=15808"/>
		<updated>2026-03-12T23:10:09Z</updated>

		<summary type="html">&lt;p&gt;Peterr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Event&lt;br /&gt;
|Name=Open Hackerspace dag&lt;br /&gt;
|Date=2026/03/28&lt;br /&gt;
|DateEnd=2026/03/28&lt;br /&gt;
|Location=NURDspace&lt;br /&gt;
|Contact=info@nurdspace.nl&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Nou mensen, de laatste zaterdag van maart 2026 zal er weer een &amp;quot;open hackerspace dag&amp;quot; zijn.&lt;br /&gt;
Laten we deze tot een succes maken, whatever succes is in deze context.&lt;br /&gt;
Het zou leuk zijn als mensen iets willen demo&#039;en, e.o.a. project ofzo.&lt;br /&gt;
Reclamen er voor maken zou wellicht ook wel een leuk idee zijn, zodat we &amp;gt;0 bezoeker(s) krijgen&lt;br /&gt;
&lt;br /&gt;
* folkert: schaakprogramma op een ESP32 of een PDP-11/70 emulator op een ESP32 of misschien iets met die ledboxen, eurorack dingen? maar dan met zelfgebouwde modules&lt;br /&gt;
* Melan: Wellicht een of andere AI demo, adsb op een scherm, powerbook g4/thinkpad t41 &amp;amp; sony vaio p showcase&lt;br /&gt;
* peterr: Primo (cmos poorten robot), Secundo [https://nurdspace.nl/Leaphy_Robot Leaphy robot], een HERO [https://en.wikipedia.org/wiki/HERO_(robot)].&lt;br /&gt;
* SPARCie: De HARK-OpenVMS cluster (als ze tijd kan vinden om het op tijd af te maken :3) (één van die 3 virtuale VAXen op mijn fysieke VT510 of de VT420 van de space?)&lt;br /&gt;
* Tathkev: Wellicht Full color Telegram sticker printer&lt;br /&gt;
* jij? ...&lt;br /&gt;
&lt;br /&gt;
== Posters ==&lt;br /&gt;
&lt;br /&gt;
=== AI slop ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Ohsd2026-poster-idee-gemini1.png&lt;br /&gt;
ChatGPTopendagfolkert.png&lt;br /&gt;
Copilotopendagfolkert.png&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Artisanal ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Nurdspace-poster.png&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;/div&gt;</summary>
		<author><name>Peterr</name></author>
	</entry>
	<entry>
		<id>https://nurdspace.nl/index.php?title=Open_hackerspace_dag_2026&amp;diff=15792</id>
		<title>Open hackerspace dag 2026</title>
		<link rel="alternate" type="text/html" href="https://nurdspace.nl/index.php?title=Open_hackerspace_dag_2026&amp;diff=15792"/>
		<updated>2026-03-08T19:53:43Z</updated>

		<summary type="html">&lt;p&gt;Peterr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Event&lt;br /&gt;
|Name=Open Hackerspace dag&lt;br /&gt;
|Date=2026/03/28&lt;br /&gt;
|DateEnd=2026/03/28&lt;br /&gt;
|Location=NURDspace&lt;br /&gt;
|Contact=info@nurdspace.nl&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Nou mensen, de laatste zaterdag van maart 2026 zal er weer een &amp;quot;open hackerspace dag&amp;quot; zijn.&lt;br /&gt;
Laten we deze tot een succes maken, whatever succes is in deze context.&lt;br /&gt;
Het zou leuk zijn als mensen iets willen demo&#039;en, e.o.a. project ofzo.&lt;br /&gt;
Reclamen er voor maken zou wellicht ook wel een leuk idee zijn, zodat we &amp;gt;0 bezoeker(s) krijgen&lt;br /&gt;
&lt;br /&gt;
* folkert: schaakprogramma op een ESP32 of een PDP-11/70 emulator op een ESP32 of misschien iets met die ledboxen, eurorack dingen? maar dan met zelfgebouwde modules&lt;br /&gt;
* Melan: Wellicht een of andere AI demo, adsb op een scherm, powerbook g4/thinkpad t41 &amp;amp; sony vaio p showcase&lt;br /&gt;
* peterr: Primo (cmos poorten robot), Secundo [https://nurdspace.nl/Leaphy_Robot Leaphy robot], een HERO [https://en.wikipedia.org/wiki/HERO_(robot)].Helaas maar tot 17:00 i.v.m.een onvermijdbare verplichting.&lt;br /&gt;
* SPARCie: De HARK-OpenVMS cluster (als ze tijd kan vinden om het op tijd af te maken :3) (één van die 3 virtuale VAXen op mijn fysieke VT510 of de VT420 van de space?)&lt;br /&gt;
* Tathkev: Wellicht Full color Telegram sticker printer&lt;br /&gt;
* jij? ...&lt;br /&gt;
&lt;br /&gt;
== Posters ==&lt;br /&gt;
&lt;br /&gt;
=== AI slop ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Ohsd2026-poster-idee-gemini1.png&lt;br /&gt;
ChatGPTopendagfolkert.png&lt;br /&gt;
Copilotopendagfolkert.png&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Artisanal ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Nurdspace-poster.png&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;/div&gt;</summary>
		<author><name>Peterr</name></author>
	</entry>
	<entry>
		<id>https://nurdspace.nl/index.php?title=Open_hackerspace_dag_2026&amp;diff=15663</id>
		<title>Open hackerspace dag 2026</title>
		<link rel="alternate" type="text/html" href="https://nurdspace.nl/index.php?title=Open_hackerspace_dag_2026&amp;diff=15663"/>
		<updated>2026-02-05T19:01:45Z</updated>

		<summary type="html">&lt;p&gt;Peterr: added HERO&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Event&lt;br /&gt;
|Name=Open Hackerspace dag&lt;br /&gt;
|Date=2026/03/28&lt;br /&gt;
|DateEnd=2026/03/28&lt;br /&gt;
|Location=NURDspace&lt;br /&gt;
|Contact=folkert, ...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Nou mensen, de laatste zaterdag van maart 2026 zal er weer een &amp;quot;open hackerspace dag&amp;quot; zijn.&lt;br /&gt;
Laten we deze tot een succes maken, whatever succes is in deze context.&lt;br /&gt;
Het zou leuk zijn als mensen iets willen demo&#039;en, e.o.a. project ofzo.&lt;br /&gt;
Reclamen er voor maken zou wellicht ook wel een leuk idee zijn, zodat we &amp;gt;0 bezoeker(s) krijgen&lt;br /&gt;
&lt;br /&gt;
* folkert: schaakprogramma op een ESP32 of een PDP-11/70 emulator op een ESP32&lt;br /&gt;
* Melan: Wellicht een of andere AI demo, adsb op een scherm, powerbook g4/thinkpad t41 &amp;amp; sony vaio p showcase&lt;br /&gt;
* peterr: Primo (cmos poorten robot), Secundo [https://nurdspace.nl/Leaphy_Robot Leaphy robot], een HERO [https://en.wikipedia.org/wiki/HERO_(robot)], en meer.&lt;br /&gt;
* SPARCie: De HARK-OpenVMS cluster (als ze tijd kan vinden om het op tijd af te maken :3) (één van die 3 virtuale VAXen op mijn fysieke VT510 of de VT420 van de space?)&lt;br /&gt;
* jij? ...&lt;/div&gt;</summary>
		<author><name>Peterr</name></author>
	</entry>
	<entry>
		<id>https://nurdspace.nl/index.php?title=Peter&amp;diff=15507</id>
		<title>Peter</title>
		<link rel="alternate" type="text/html" href="https://nurdspace.nl/index.php?title=Peter&amp;diff=15507"/>
		<updated>2026-01-03T01:44:29Z</updated>

		<summary type="html">&lt;p&gt;Peterr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Members&lt;br /&gt;
|picture=Mandrill.jpg&lt;br /&gt;
|Nickname=peterr&lt;br /&gt;
|Memberstatus=member&lt;br /&gt;
|Email=vleermuis@riseup.net&lt;br /&gt;
}}&lt;br /&gt;
I am here to have fun, learn new stuff, get advice, and help others if and when I can.&lt;/div&gt;</summary>
		<author><name>Peterr</name></author>
	</entry>
	<entry>
		<id>https://nurdspace.nl/index.php?title=Open_hackerspace_dag_2026&amp;diff=15434</id>
		<title>Open hackerspace dag 2026</title>
		<link rel="alternate" type="text/html" href="https://nurdspace.nl/index.php?title=Open_hackerspace_dag_2026&amp;diff=15434"/>
		<updated>2025-12-22T11:23:23Z</updated>

		<summary type="html">&lt;p&gt;Peterr: Update&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Event&lt;br /&gt;
|Name=Open Hackerspace dag&lt;br /&gt;
|Date=2026/03/28&lt;br /&gt;
|DateEnd=2026/03/28&lt;br /&gt;
|Location=NURDspace&lt;br /&gt;
|Contact=folkert, ...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Nou mensen, de laatste zaterdag van maart 2026 zal er weer een &amp;quot;open hackerspace dag&amp;quot; zijn.&lt;br /&gt;
Laten we deze tot een succes maken, whatever succes is in deze context.&lt;br /&gt;
Het zou leuk zijn als mensen iets willen demo&#039;en, e.o.a. project ofzo.&lt;br /&gt;
Reclamen er voor maken zou wellicht ook wel een leuk idee zijn, zodat we &amp;gt;0 bezoeker(s) krijgen&lt;br /&gt;
&lt;br /&gt;
* folkert: schaakprogramma op een ESP32 of een PDP-11/70 emulator op een ESP32&lt;br /&gt;
* Melan: Wellicht een of andere AI demo, adsb op een scherm, powerbook g4/thinkpad t41 &amp;amp; sony vaio p showcase&lt;br /&gt;
* peterr: Primo (cmos poorten robot), Secundo [https://nurdspace.nl/Leaphy_Robot Leaphy robot], and mogelijk ook de &amp;quot;tank robot&amp;quot;.&lt;br /&gt;
* SPARCie: De HARK-OpenVMS cluster (als ze tijd kan vinden om het op tijd af te maken :3) (één van die 3 virtuale VAXen op mijn fysieke VT510 of de VT420 van de space?)&lt;br /&gt;
* jij? ...&lt;/div&gt;</summary>
		<author><name>Peterr</name></author>
	</entry>
	<entry>
		<id>https://nurdspace.nl/index.php?title=Library&amp;diff=15336</id>
		<title>Library</title>
		<link rel="alternate" type="text/html" href="https://nurdspace.nl/index.php?title=Library&amp;diff=15336"/>
		<updated>2025-10-22T20:33:56Z</updated>

		<summary type="html">&lt;p&gt;Peterr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Name=Library&lt;br /&gt;
|Status=Active as fuck!!&lt;br /&gt;
|Niche=Yes&lt;br /&gt;
|Purpose=Use in other project&lt;br /&gt;
|Tool=No&lt;br /&gt;
|Location=Library&lt;br /&gt;
|Cost=0&lt;br /&gt;
}}&lt;br /&gt;
&#039;&#039;Library&#039;s are imporant for the revolution!&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== The library is work in progress ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 - The library team has only one member, &lt;br /&gt;
     but to make up for that: it is peterr :)&lt;br /&gt;
 - Currently there is no database&lt;br /&gt;
 -   a nice project would be to build that database using an OCR/scanner and some smart software&lt;br /&gt;
 - To make up for the missing database, there is a &#039;&#039;&#039;some very rough&#039;&#039;&#039; ordering.&lt;br /&gt;
 - People who like to improve the ordering are welcome, go ahead! but the current state seems workable&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:nurdspace_layout_library.png|700px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 - There is no automated administration for borrowing, so please fill in the table below if you take a book home.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
|+ books&lt;br /&gt;
! Title !! Niche !! lent to? !! date&lt;br /&gt;
|-&lt;br /&gt;
| Mastering algorithms with C || C programming || Rosh/[[User:Vriendschapsfee|Vriendschapsfee]] || ...............?&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Peterr</name></author>
	</entry>
	<entry>
		<id>https://nurdspace.nl/index.php?title=File:Nurdspace_layout_library.png&amp;diff=15335</id>
		<title>File:Nurdspace layout library.png</title>
		<link rel="alternate" type="text/html" href="https://nurdspace.nl/index.php?title=File:Nurdspace_layout_library.png&amp;diff=15335"/>
		<updated>2025-10-22T20:31:05Z</updated>

		<summary type="html">&lt;p&gt;Peterr: File uploaded with MsUpload&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;File uploaded with MsUpload&lt;/div&gt;</summary>
		<author><name>Peterr</name></author>
	</entry>
	<entry>
		<id>https://nurdspace.nl/index.php?title=Library&amp;diff=15334</id>
		<title>Library</title>
		<link rel="alternate" type="text/html" href="https://nurdspace.nl/index.php?title=Library&amp;diff=15334"/>
		<updated>2025-10-22T20:29:16Z</updated>

		<summary type="html">&lt;p&gt;Peterr: update&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Name=Library&lt;br /&gt;
|Status=Active as fuck!!&lt;br /&gt;
|Niche=Yes&lt;br /&gt;
|Purpose=Use in other project&lt;br /&gt;
|Tool=No&lt;br /&gt;
|Location=Library&lt;br /&gt;
|Cost=0&lt;br /&gt;
}}&lt;br /&gt;
&#039;&#039;Library&#039;s are imporant for the revolution!&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== The library is work in progress ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 - The library team has only one member, &lt;br /&gt;
     but to make up for that: it is peterr :)&lt;br /&gt;
 - Currently there is no database&lt;br /&gt;
 -   a nice project would be to build that database using an OCR/scanner and some smart software&lt;br /&gt;
 - To make up for the missing database, there is a &#039;&#039;&#039;some very rough&#039;&#039;&#039; ordering.&lt;br /&gt;
 - People who like to improve the ordering are welcome, go ahead! but the current state seems workable&lt;br /&gt;
&lt;br /&gt;
[[File:Nurdspace library.pdf|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 - There is no automated administration for borrowing, so please fill in the table below if you take a book home.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
|+ books&lt;br /&gt;
! Title !! Niche !! lent to? !! date&lt;br /&gt;
|-&lt;br /&gt;
| Mastering algorithms with C || C programming || Rosh/[[User:Vriendschapsfee|Vriendschapsfee]] || ...............?&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Peterr</name></author>
	</entry>
	<entry>
		<id>https://nurdspace.nl/index.php?title=File:Nurdspace_library.pdf&amp;diff=15333</id>
		<title>File:Nurdspace library.pdf</title>
		<link rel="alternate" type="text/html" href="https://nurdspace.nl/index.php?title=File:Nurdspace_library.pdf&amp;diff=15333"/>
		<updated>2025-10-22T20:22:23Z</updated>

		<summary type="html">&lt;p&gt;Peterr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;layout of library&lt;/div&gt;</summary>
		<author><name>Peterr</name></author>
	</entry>
	<entry>
		<id>https://nurdspace.nl/index.php?title=Library&amp;diff=15332</id>
		<title>Library</title>
		<link rel="alternate" type="text/html" href="https://nurdspace.nl/index.php?title=Library&amp;diff=15332"/>
		<updated>2025-10-22T19:57:20Z</updated>

		<summary type="html">&lt;p&gt;Peterr: New headers&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Name=Library&lt;br /&gt;
|Status=Active as fuck!!&lt;br /&gt;
|Niche=Yes&lt;br /&gt;
|Purpose=Use in other project&lt;br /&gt;
|Tool=No&lt;br /&gt;
|Location=Library&lt;br /&gt;
|Cost=0&lt;br /&gt;
}}&lt;br /&gt;
Library&#039;s are imporant for the revolution!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
|+ books&lt;br /&gt;
! Title !! Niche !! lent to?&lt;br /&gt;
|-&lt;br /&gt;
| Mastering algorithms with C || C programming || Rosh/[[User:Vriendschapsfee|Vriendschapsfee]]&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Peterr</name></author>
	</entry>
	<entry>
		<id>https://nurdspace.nl/index.php?title=Open_hackerspace_dag_2026&amp;diff=15320</id>
		<title>Open hackerspace dag 2026</title>
		<link rel="alternate" type="text/html" href="https://nurdspace.nl/index.php?title=Open_hackerspace_dag_2026&amp;diff=15320"/>
		<updated>2025-10-01T23:26:31Z</updated>

		<summary type="html">&lt;p&gt;Peterr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Event&lt;br /&gt;
|Name=Open Hackerspace dag&lt;br /&gt;
|Date=2026/03/28&lt;br /&gt;
|DateEnd=2026/03/28&lt;br /&gt;
|Location=NURDspace&lt;br /&gt;
|Contact=folkert, ...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Nou mensen, de laatste zaterdag van maart 2026 zal er weer een &amp;quot;open hackerspace dag&amp;quot; zijn.&lt;br /&gt;
Laten we deze tot een succes maken, whatever succes is in deze context.&lt;br /&gt;
Het zou leuk zijn als mensen iets willen demo&#039;en, e.o.a. project ofzo.&lt;br /&gt;
Reclamen er voor maken zou wellicht ook wel een leuk idee zijn, zodat we &amp;gt;0 bezoeker(s) krijgen&lt;br /&gt;
&lt;br /&gt;
* folkert: schaakprogramma op een ESP32 of een PDP-11/70 emulator op een ESP32&lt;br /&gt;
* Melan: Wellicht een of andere AI demo, adsb op een scherm, powerbook g4/thinkpad t41 &amp;amp; sony vaio p showcase&lt;br /&gt;
* peterr: Primo (cmos poorten robot), Secundo [https://nurdspace.nl/Leaphy_Robot Leaphy robot], and mogelijk ook -een begin van- het Terzo robot project&lt;br /&gt;
* SPARCie: De HARK-OpenVMS cluster (als ze tijd kan vinden om het op tijd af te maken :3) (één van die 3 virtuale VAXen op mijn fysieke VT510 of de VT420 van de space?)&lt;br /&gt;
* jij? ...&lt;/div&gt;</summary>
		<author><name>Peterr</name></author>
	</entry>
	<entry>
		<id>https://nurdspace.nl/index.php?title=Open_hackerspace_dag_2026&amp;diff=15319</id>
		<title>Open hackerspace dag 2026</title>
		<link rel="alternate" type="text/html" href="https://nurdspace.nl/index.php?title=Open_hackerspace_dag_2026&amp;diff=15319"/>
		<updated>2025-10-01T23:25:56Z</updated>

		<summary type="html">&lt;p&gt;Peterr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Event&lt;br /&gt;
|Name=Open Hackerspace dag&lt;br /&gt;
|Date=2026/03/28&lt;br /&gt;
|DateEnd=2026/03/28&lt;br /&gt;
|Location=NURDspace&lt;br /&gt;
|Contact=folkert, ...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Nou mensen, de laatste zaterdag van maart 2026 zal er weer een &amp;quot;open hackerspace dag&amp;quot; zijn.&lt;br /&gt;
Laten we deze tot een succes maken, whatever succes is in deze context.&lt;br /&gt;
Het zou leuk zijn als mensen iets willen demo&#039;en, e.o.a. project ofzo.&lt;br /&gt;
Reclamen er voor maken zou wellicht ook wel een leuk idee zijn, zodat we &amp;gt;0 bezoeker(s) krijgen&lt;br /&gt;
&lt;br /&gt;
* folkert: schaakprogramma op een ESP32 of een PDP-11/70 emulator op een ESP32&lt;br /&gt;
* Melan: Wellicht een of andere AI demo, adsb op een scherm, powerbook g4/thinkpad t41 &amp;amp; sony vaio p showcase&lt;br /&gt;
* peterr: Primo (cmos poorten robot), Secundo (https://nurdspace.nl/Leaphy_Robot) [https://nurdspace.nl/Leaphy_Robot Leaphy robot], and mogelijk ook -een begin van- het Terzo robot project&lt;br /&gt;
* SPARCie: De HARK-OpenVMS cluster (als ze tijd kan vinden om het op tijd af te maken :3) (één van die 3 virtuale VAXen op mijn fysieke VT510 of de VT420 van de space?)&lt;br /&gt;
* jij? ...&lt;/div&gt;</summary>
		<author><name>Peterr</name></author>
	</entry>
	<entry>
		<id>https://nurdspace.nl/index.php?title=Open_hackerspace_dag_2026&amp;diff=15318</id>
		<title>Open hackerspace dag 2026</title>
		<link rel="alternate" type="text/html" href="https://nurdspace.nl/index.php?title=Open_hackerspace_dag_2026&amp;diff=15318"/>
		<updated>2025-10-01T23:21:45Z</updated>

		<summary type="html">&lt;p&gt;Peterr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Event&lt;br /&gt;
|Name=Open Hackerspace dag&lt;br /&gt;
|Date=2026/03/28&lt;br /&gt;
|DateEnd=2026/03/28&lt;br /&gt;
|Location=NURDspace&lt;br /&gt;
|Contact=folkert, ...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Nou mensen, de laatste zaterdag van maart 2026 zal er weer een &amp;quot;open hackerspace dag&amp;quot; zijn.&lt;br /&gt;
Laten we deze tot een succes maken, whatever succes is in deze context.&lt;br /&gt;
Het zou leuk zijn als mensen iets willen demo&#039;en, e.o.a. project ofzo.&lt;br /&gt;
Reclamen er voor maken zou wellicht ook wel een leuk idee zijn, zodat we &amp;gt;0 bezoeker(s) krijgen&lt;br /&gt;
&lt;br /&gt;
* folkert: schaakprogramma op een ESP32 of een PDP-11/70 emulator op een ESP32&lt;br /&gt;
* Melan: Wellicht een of andere AI demo, adsb op een scherm, powerbook g4/thinkpad t41 &amp;amp; sony vaio p showcase&lt;br /&gt;
* peterr: Primo (cmos poorten robot), Secundo ([[https://nurdspace.nl/Leaphy_Robot|Leaphy robot]]), and mogelijk ook -een begin van- het Terzo robot project&lt;br /&gt;
* SPARCie: De HARK-OpenVMS cluster (als ze tijd kan vinden om het op tijd af te maken :3) (één van die 3 virtuale VAXen op mijn fysieke VT510 of de VT420 van de space?)&lt;br /&gt;
* jij? ...&lt;/div&gt;</summary>
		<author><name>Peterr</name></author>
	</entry>
	<entry>
		<id>https://nurdspace.nl/index.php?title=Open_hackerspace_dag_2026&amp;diff=15317</id>
		<title>Open hackerspace dag 2026</title>
		<link rel="alternate" type="text/html" href="https://nurdspace.nl/index.php?title=Open_hackerspace_dag_2026&amp;diff=15317"/>
		<updated>2025-10-01T23:16:28Z</updated>

		<summary type="html">&lt;p&gt;Peterr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Event&lt;br /&gt;
|Name=Open Hackerspace dag&lt;br /&gt;
|Date=2026/03/28&lt;br /&gt;
|DateEnd=2026/03/28&lt;br /&gt;
|Location=NURDspace&lt;br /&gt;
|Contact=folkert, ...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Nou mensen, de laatste zaterdag van maart 2026 zal er weer een &amp;quot;open hackerspace dag&amp;quot; zijn.&lt;br /&gt;
Laten we deze tot een succes maken, whatever succes is in deze context.&lt;br /&gt;
Het zou leuk zijn als mensen iets willen demo&#039;en, e.o.a. project ofzo.&lt;br /&gt;
Reclamen er voor maken zou wellicht ook wel een leuk idee zijn, zodat we &amp;gt;0 bezoeker(s) krijgen&lt;br /&gt;
&lt;br /&gt;
* folkert: schaakprogramma op een ESP32 of een PDP-11/70 emulator op een ESP32&lt;br /&gt;
* Melan: Wellicht een of andere AI demo, adsb op een scherm, powerbook g4/thinkpad t41 &amp;amp; sony vaio p showcase&lt;br /&gt;
* peterr: Primo(cmos poorten robot), Secundo [https://nurdspace.nl/Leaphy_Robot|Leaphy robot]), and mogelijk ook -een begin van- het Terzo robot project&lt;br /&gt;
* SPARCie: De HARK-OpenVMS cluster (als ze tijd kan vinden om het op tijd af te maken :3) (één van die 3 virtuale VAXen op mijn fysieke VT510 of de VT420 van de space?)&lt;br /&gt;
* jij? ...&lt;/div&gt;</summary>
		<author><name>Peterr</name></author>
	</entry>
	<entry>
		<id>https://nurdspace.nl/index.php?title=Open_hackerspace_dag_2026&amp;diff=15316</id>
		<title>Open hackerspace dag 2026</title>
		<link rel="alternate" type="text/html" href="https://nurdspace.nl/index.php?title=Open_hackerspace_dag_2026&amp;diff=15316"/>
		<updated>2025-10-01T23:15:25Z</updated>

		<summary type="html">&lt;p&gt;Peterr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Event&lt;br /&gt;
|Name=Open Hackerspace dag&lt;br /&gt;
|Date=2026/03/28&lt;br /&gt;
|DateEnd=2026/03/28&lt;br /&gt;
|Location=NURDspace&lt;br /&gt;
|Contact=folkert, ...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Nou mensen, de laatste zaterdag van maart 2026 zal er weer een &amp;quot;open hackerspace dag&amp;quot; zijn.&lt;br /&gt;
Laten we deze tot een succes maken, whatever succes is in deze context.&lt;br /&gt;
Het zou leuk zijn als mensen iets willen demo&#039;en, e.o.a. project ofzo.&lt;br /&gt;
Reclamen er voor maken zou wellicht ook wel een leuk idee zijn, zodat we &amp;gt;0 bezoeker(s) krijgen&lt;br /&gt;
&lt;br /&gt;
* folkert: schaakprogramma op een ESP32 of een PDP-11/70 emulator op een ESP32&lt;br /&gt;
* Melan: Wellicht een of andere AI demo, adsb op een scherm, powerbook g4/thinkpad t41 &amp;amp; sony vaio p showcase&lt;br /&gt;
* peterr: Primo(cmos poorten robot), Secundo ([[https://nurdspace.nl/Leaphy_Robot|Leaphy robot]]), and mogelijk ook -een begin van- het Terzo robot project&lt;br /&gt;
* SPARCie: De HARK-OpenVMS cluster (als ze tijd kan vinden om het op tijd af te maken :3) (één van die 3 virtuale VAXen op mijn fysieke VT510 of de VT420 van de space?)&lt;br /&gt;
* jij? ...&lt;/div&gt;</summary>
		<author><name>Peterr</name></author>
	</entry>
	<entry>
		<id>https://nurdspace.nl/index.php?title=Open_hackerspace_dag_2026&amp;diff=15315</id>
		<title>Open hackerspace dag 2026</title>
		<link rel="alternate" type="text/html" href="https://nurdspace.nl/index.php?title=Open_hackerspace_dag_2026&amp;diff=15315"/>
		<updated>2025-10-01T23:13:33Z</updated>

		<summary type="html">&lt;p&gt;Peterr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Event&lt;br /&gt;
|Name=Open Hackerspace dag&lt;br /&gt;
|Date=2026/03/28&lt;br /&gt;
|DateEnd=2026/03/28&lt;br /&gt;
|Location=NURDspace&lt;br /&gt;
|Contact=folkert, ...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Nou mensen, de laatste zaterdag van maart 2026 zal er weer een &amp;quot;open hackerspace dag&amp;quot; zijn.&lt;br /&gt;
Laten we deze tot een succes maken, whatever succes is in deze context.&lt;br /&gt;
Het zou leuk zijn als mensen iets willen demo&#039;en, e.o.a. project ofzo.&lt;br /&gt;
Reclamen er voor maken zou wellicht ook wel een leuk idee zijn, zodat we &amp;gt;0 bezoeker(s) krijgen&lt;br /&gt;
&lt;br /&gt;
* folkert: schaakprogramma op een ESP32 of een PDP-11/70 emulator op een ESP32&lt;br /&gt;
* Melan: Wellicht een of andere AI demo, adsb op een scherm, powerbook g4/thinkpad t41 &amp;amp; sony vaio p showcase&lt;br /&gt;
* peterr: Primo(cmos poorten robot), Secundo ([[https://nurdspace.nl/Leaphy_Robot|Leaphy  robot]]), and mogelijk ook -een begin van- het Terzo robot project&lt;br /&gt;
* SPARCie: De HARK-OpenVMS cluster (als ze tijd kan vinden om het op tijd af te maken :3) (één van die 3 virtuale VAXen op mijn fysieke VT510 of de VT420 van de space?)&lt;br /&gt;
* jij? ...&lt;/div&gt;</summary>
		<author><name>Peterr</name></author>
	</entry>
	<entry>
		<id>https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15314</id>
		<title>Leaphy Robot</title>
		<link rel="alternate" type="text/html" href="https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15314"/>
		<updated>2025-10-01T23:05:18Z</updated>

		<summary type="html">&lt;p&gt;Peterr: /* Sensory inputs */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Name=Leaphy robot with subsumption architecture&lt;br /&gt;
|Skills=software hardware electronics biology&lt;br /&gt;
|Status=Active&lt;br /&gt;
|Niche=robotics&lt;br /&gt;
|Purpose=Fun&lt;br /&gt;
|Picture=Leaphy back side view.jpg&lt;br /&gt;
|Tool=No&lt;br /&gt;
|Location=Space, home&lt;br /&gt;
|Cost=Very small given what is already present and what is available in the space (everything!!)&lt;br /&gt;
|Category=Electronics&lt;br /&gt;
}}&lt;br /&gt;
== Electronic insect-like creature ==&lt;br /&gt;
&#039;&#039;&#039;Physiological, Behavioural and environmental overview&#039;&#039;&#039; &amp;lt;br&amp;gt;&lt;br /&gt;
peterr 2022- 2025 (with &#039;&#039;very&#039;&#039; long pauses)&lt;br /&gt;
&lt;br /&gt;
====Document history====&lt;br /&gt;
* Currently this is a living document and this wiki contains the latest version&lt;br /&gt;
* September 2025 subsumption architecture design &amp;amp; transfer to nurdspace wiki&lt;br /&gt;
* August    2025 Documentation for scheduler&lt;br /&gt;
* March     2023 Draft version 0.2  - terminology cleanup and scope&lt;br /&gt;
* November  2022 First document sketches &amp;amp; ideas&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project==&lt;br /&gt;
The insect like creature based on the original [https://leaphy.store/product/leaphy-original-los/ leaphyrobot] has a set of functionalities that together allow it to effectively find, and feed on targets that provides electricity as a reward.&lt;br /&gt;
Learning strategies to improve success rate can be implemented.&lt;br /&gt;
Sexual signaling, event prediction, mating behaviour, genetic exchange and evolution are in principle possible but are currently still (far) out of scope. The system at it&#039;s highest level can be seen as a feedback loop: sensory input =&amp;gt; behavioural selection =&amp;gt; motor output =&amp;gt; new sensory input. The original design (2022) was meant to live in wind tunnel, and find odour sources to feed, but currently the emphasis has shifted from odour detection to more general sensory processing using subsumption architecture, [https://nurdspace.nl/Leaphy_Robot#Brain see below].&lt;br /&gt;
&lt;br /&gt;
== Sensory inputs ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Mechanoreceptor - sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
:::Micro switch based tactile hairs. &lt;br /&gt;
:::&#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Ultrasound - Distance sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
::: Ultrasonic pulses detect obstacles and trigger reflex avoidance behaviour&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Better directional responses would be possible with more than one US sensor. &lt;br /&gt;
:::: This would need a dedicated embedded processor. &lt;br /&gt;
:::: &#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing light intensity&#039;&#039;&#039;&lt;br /&gt;
::: Two LDR photoreceptors measure front-left light level and front-right light level&lt;br /&gt;
::: Total light intensity (sum) is available as an analog voltage&lt;br /&gt;
::: The difference between the inputs is also available, and signals what side to turn to, to approach or avoid the light.&lt;br /&gt;
::: &#039;&#039;Development status: working well in priciple, but due to mounting problems actually not functioning currently.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing sound (audio)&#039;&#039;&#039;&lt;br /&gt;
::: A subunit with its own processor, containing an [https://en.wikipedia.org/wiki/Electret_microphone Electret microphone] to measure ambiant sound level, frequency and sound patterns. &lt;br /&gt;
::: Can be used in classical (Pawlow) and operand conditioning experiments. Will detect both absolute sound levels (for startle or avoidance responses) and can contain feature detectors (e.g. chirp intervals for leaf hopper like  communication and courting  behaviour of two leaphy&#039;s).  &lt;br /&gt;
::: In addition, an Audeme Movi speech recognition shield (see https://www.audeme.com/movi.html) could be used to process voice commands&lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented, but Movi shield &amp;quot;proof of concept&amp;quot; done&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;PIR movement sensor&#039;&#039;&#039;&lt;br /&gt;
::: In addition to light intensity, an infra red motion sensors can be used to detect movements (humans, or the cat for that matter) &lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented but PIR (similar to this [https://www.adafruit.com/product/189 adafruit thingy]) is available&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Sensing wind direction &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based tactile hairs?  Something like [https://www.instructables.com/Low-Cost-Low-Speed-Wind-Sensor-1/ this],with shielding? or sensitive temperature measurements?&lt;br /&gt;
:::; Note: Wind direction sensing in the wind tunnel is currently replaced by sensing light gradients parallel to the wind direction because the wind sensor is not available yet. &lt;br /&gt;
:::: &#039;&#039;Development status: To be designed, high priority for the windtunnel version with odour source finding as a main goal, low priority for the a free walking space/nurdspace version described here.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Volatiles (odours) &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based perception of volatiles like alcohol (fruit-fly like behaviours), Carbon dioxide (mosquito like behaviour), or VOC&#039;s (most plant eating insects). The sensor produces a voltage level proportional to the intensity of the stimulus. Using a threshold can generate a presence/absence signal. &lt;br /&gt;
::: The interval between odour pulses is a proxy for the distance to the source. Note that an odour &amp;quot;gradient&amp;quot; does not exist!&lt;br /&gt;
&lt;br /&gt;
::: Current implementation uses a SGP30 board. The time constant of the the sensor is in the order of 1 second, but &amp;quot;whiffs&amp;quot; of odour could be detected faster by using a feature detector that looks for sudden steps in the signal. This will also act as an sensory adaptation mechanism: in the absence of change the output go&#039;s to zero.&lt;br /&gt;
::: &#039;&#039;Development status: Sensor: worked, currently broken&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground color&#039;&#039;&#039;&lt;br /&gt;
::: This sensor measures ground colour and the output can be used to test for a particular condition (e.g. being at a target position). It can also be used to simulate trail pheromones implemented as colors next to the  trail followed. This sense can also take the role of short distance &amp;quot; present at target&amp;quot; stimuli.&lt;br /&gt;
::: &#039;&#039; Development status: Operational &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground reflection level&#039;&#039;&#039;&lt;br /&gt;
::: Two sensors &#039;line followers&#039; that both provide a binary present/absent signal of ground reflection.&lt;br /&gt;
::: Can be used to simulate trail following behaviour on a network of lines  (combined with (led) ground colours.&lt;br /&gt;
::: &#039;&#039;Development status: testing phase&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Future extensions: A combination of voltage levels and pulse frequency coding in the source could be used to simulate a spectrum of &amp;quot;chemical&amp;quot; inputs.  &lt;br /&gt;
:::: Feature detectors could extract particular frequencies and/or patterns to recognise for instance &amp;quot;&#039;&#039;toxic&#039;&#039;&amp;quot; substances. &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Proprioception (internal &amp;quot;feeling&amp;quot;)&#039;&#039;&#039;&lt;br /&gt;
::: Checking for instance for body movement when motors move, or for force feedback when extending electrical honey sucking mouthparts&lt;br /&gt;
::: Development status:To be developed, as yet low priority. &lt;br /&gt;
 &lt;br /&gt;
:: &#039;&#039;&#039;Sensing internal physiological states &#039;&#039;&#039;&lt;br /&gt;
:::To place electric reward information in perspective, some internal status information is needed, that is supplied by reading internal variables like energy levels (battery voltage , load current) or physiological state (internal variables like &amp;quot;ready to feed&amp;quot;. &lt;br /&gt;
::: More advances implementations could look up previous experiences, and rate of change in physiological status as well as brain hormone levels and excitation states (see below under internal states and hormones&amp;quot;).&lt;br /&gt;
:::Development status: To be designed.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing hormone levels&#039;&#039;&#039;&lt;br /&gt;
::: Certain activities or combinations of activities can stimulate the production of hormones. This could be implemented as slow changing values in memory. Hormone levels might modulate the effect of sensory input or behavioural output, and act as a slow form of memory.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing rewards and deterrents&#039;&#039;&#039;&lt;br /&gt;
::: Electronic organisms live on electricity, and are rewarded by sensing the presence of a voltage and current. This sensory organ is just sensing the analog voltage measured by the sensory organ. It simulates the perception of food such as nectar. Most logical position is at the tip of an appendage. &lt;br /&gt;
::: &#039;&#039;Development status: implemented and removed (needs mutiplexing). Mechanical movement (servo) to make electrical contact: testing phase.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Brain ==&lt;br /&gt;
::&#039;&#039;&#039;Subsumption architecture&#039;&#039;&#039;&lt;br /&gt;
:::The Electronic organisms has a software brain that receives sensory input both from the environment and internal status. The brain reads all inputs about every 50 msec, and produces command for actuators that produce behaviour. These behaviours can be as simple as a colour changes of a led (signaling sensory status) or movements of body and body and appendages. The aim is to make the lower levels as stateless as possible i.e. the brain uses its real time vision of the word as a model instead of some abstract internal representation. The processing principle roughly follow the subsumption architecture (Brooks 1986).&lt;br /&gt;
&lt;br /&gt;
:::Wikipedia writes about this technique:&lt;br /&gt;
::::&amp;quot;&#039;&#039;[Behaviours] are organized into a hierarchy of layers. Each layer implements a particular level of behavioral competence, and higher levels are able to subsume lower levels (= integrate/combine lower levels to a more comprehensive whole) in order to create viable behavior. For example, a robot&#039;s lowest layer could be &amp;quot;avoid an object&amp;quot;. The second layer would be &amp;quot;wander around&amp;quot;, which runs beneath the third layer &amp;quot;explore the world&amp;quot;.[...]The subsumption architecture creates a system in which the higher layers utilize the lower-level competencies. The layers, which all receive sensor-information, work in parallel and generate outputs. These outputs can be commands to actuators, or signals that suppress or inhibit other layers.&amp;quot;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::My current implementation uses the opposite order. The high priority levels conduct the simplest behavioural tasks, and when these high priority but simple behavioural levels are happy more complex task can get control. This approach is still experimental, but in any case easy enough to reverse again.&lt;br /&gt;
&lt;br /&gt;
:::The behavioural levels &#039;&#039;all&#039;&#039; compete for control of the robot. Each behavioural layer evaluates its sensory input and determines if it wants to control the outputs (to change its input according to its (implied) goal, e.g. mechanoreceptors (microswitches) will only request control if the switch is closed. After all the behavioural levels are evaluated, and their request flags set or reset an arbitrate routine  selects the highest active layer that will run the robot behaviorual output for the next 50 msec.&lt;br /&gt;
:::See Anderson (2007) for a clear explanations and actual implementation examples.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Brain subsystems&#039;&#039;&#039;&lt;br /&gt;
:::More complicated or slow tasks (like sound processing or US echo detection) can be executed in separate processor boards that report their status  to the main  controller. Conceptually this is not different from subroutines for tasks.&lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Nervous system&#039;&#039;&#039;&lt;br /&gt;
::: The currently (sort of) running implementation of the brain is using a real time loop in a very simple cooperative multitasking system ([https://yiweimao.github.io/blog/async_microcontroller/ YiweiMao scheduler]) and inmplemented on an Arduino Uno &lt;br /&gt;
::: &#039;&#039;Development status: operational, but under active development.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Associative memory&#039;&#039;&#039;&lt;br /&gt;
::: Associative memory in it current, simplest form will be implemented as memory locations for particular sensory input combinations.  inputs that coincide increase a counter for that combination (learning those combinations). This allows both Pawlow  and operand conditioning.&lt;br /&gt;
:::&#039;&#039;Development status: not yet implemented, proof of concept done ~50 years ago :).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Excitation state and hormones&#039;&#039;&#039;&lt;br /&gt;
::: Hormones are internal variables with levels that act as slow changing memory for previous (combinations of) states.&lt;br /&gt;
::: A default breakdown speed can be set that slowly decrease hormone levels. Particular sensory input could increase the levels again. Reaching high levels of certain hormones can be a goal in itself, and subject to learning behaviour.&lt;br /&gt;
::: &#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Satisfaction&#039;&#039;&#039;&lt;br /&gt;
:::Signals to end feeding behaviour can -in addition to electrical food running out- also come from internal signals (satiation, internal hormonal signals, (too) long time periods with little change of events)&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Future prediction&#039;&#039;&#039;&lt;br /&gt;
:::This is currently way out of scope, but neural-net like implementations that store event sequences, predict likely outcomes of current inputs and act accordingly are fully feasible.&lt;br /&gt;
::: See Rickenbacher 1975 for an example that is probably  a bit more traceable than -for instance- modern neural network code like Tensorflow. &lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Effectors ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;main motors&#039;&#039;&#039;&lt;br /&gt;
:::The main moves of the organism are implemented by two wheels driven by two [https://leaphy.store/product/tt-motor-10cm-jumper-female/ DC motors] with build in gearboxes) and a [https://leaphy.store/product/motor-shield/ motor shield]. Motor speed is controlled by pulse width modualation (PMW)) present in the processor. Steering is done by differential motorspeed, a third backside &amp;quot;wheel&amp;quot; is a simple short passive wooden stand. This works well on reasonable flat surfaces, but needs improvement is the next robot (Terzo).&lt;br /&gt;
:::&#039;&#039;Motor development status: Operational at a basic level, PID control and extra power at startup to get smooth startup at low speed is needed.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Movable mouthparts&#039;&#039;&#039;&lt;br /&gt;
:::Appendages like extendable mouthparts controlled by [https://isking-modellbahn.de/modelcraft-es-030-Servo-top-line-steuerelektronik servo]&#039;s can be used for feeding on electrical food. Currently one servo controlling a proboscis (mouthpart for feeding) is present.&lt;br /&gt;
:::&#039;&#039;Development status: Operational in priciple, untested in practice, needs 3D printing of parts&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;[https://leaphy.store/product/rgb-led-single/ Three colour led]&#039;&#039;&#039;&lt;br /&gt;
::: can be used for signaling status of whatever state we want.&lt;br /&gt;
:::&#039;&#039;Development status: Operational &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Piezo beeper &#039;&#039;&#039;&lt;br /&gt;
::: Present on the [https://leaphy.store/product/motor-shield/ motor shield] can be used to create a variety of sounds,for instance to signal happines, distress or alarm.&lt;br /&gt;
:::&#039;&#039;Development status: Operational, but specific sounds need to be designed&lt;br /&gt;
&lt;br /&gt;
== Behavioural levels ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:: Behaviour in subsumption architecture is organised in levels that compete for control, the highest priority behaviour (lowest rank, top of list) will control the robot for 50 msec.&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Overview of current behavioral levels and  their most important inputs for controlling requests&#039;&#039;&#039;. &lt;br /&gt;
:::Layers are only a naming convention, conceptually grouping behaviour with somewhat similar aims. Note that the ultimate goals of the system (here level SLEEP, see below) is determined by the order of the levels. Changing the order evidently will change the behavioural outcomes.  Currently the order is hard coded.&lt;br /&gt;
&lt;br /&gt;
:::High priority behavioural levels take care of the most basic and critical task. When their goals are reached (their requests for control stop), higher behavioural levels, (representing more advanced lower priority tasks will be able to run. Note however that higher levels can explicitly inhibit or even modify lower level behaviours under some circumstances for some time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
::See the actual calls for details.&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;Layer &amp;quot;distress&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::If unable to meet the absolute basic requirement for battery voltage or movement CALL for help. In STUCK, try reflexes to get loose, pause regular. If nothing works eventually HIBERNATE &lt;br /&gt;
&lt;br /&gt;
::::Goal:  deal with the really difficult situations &lt;br /&gt;
::::0  HIBERNATE // hope for better times...&lt;br /&gt;
::::1  STUCK // try to solve non-movement when motors run...&lt;br /&gt;
::::2  CALL  // call for help&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;stay free&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::The primary sensory input activating this level are Bumper sensors and Ultrasonics, but also hormones for high emotional levels reached by an overload of sensory input or a high number of failing tries to reach some goal. FREEZE will stop movement for an serious amount of time to reduce overload FIGHT will move quickly forward and get very close to an object possibly even disregarding US and bumpers and hitting the object. ESCAPE will try to free the bumpers EVADE will try to keep a safe distance from objects. FLIGHT will try to run straight for a relative long time (using a countdown timer) but will subsumed by lower levels.&lt;br /&gt;
&lt;br /&gt;
::::Goal: avoid stressors. &lt;br /&gt;
::::3  FREEZE  // simulated dead&lt;br /&gt;
::::4  FIGHT   // try to intimidate &lt;br /&gt;
::::5  ESCAPE  // escape from touch&lt;br /&gt;
::::6  EVADE   // keep distance&lt;br /&gt;
::::7  FLIGHT  // run away  &lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;external control&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::This level is only requesting control if external commands are present in sensordata. The behaviour is self-reinforcing so once activated it keeps controlling the creature as long as new commands arrive within reasonable time. Note that Escape and Evade and Flight have priority, manual control has limits, the creature is autonomous!&lt;br /&gt;
&lt;br /&gt;
::::Goals: Stay free and prevent distress, but otherwise otherwise obey external commands.&lt;br /&gt;
::::8 MANUAL // How boring...&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;scan and move&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::This level is the heart of the brain. Reaching the first level of this layer (INTEGRATE) is rewarding. :::Everything is (locally) under control and a target goal can been set. This will also increase positive emotional level. INTEGRATE will inspect internal status, like battery level, and emotional states like exhaustion, excitatory state and modify the settings for ORIENT and MOVE accordingly. Options for ORIENTs setting are for instance random turn angles and low speed  for a drunkard&#039;s walk, phototaxis (pos. or neg.), odour pulse count or interval for kinesis behaviour, and PIR input (i. e. human or robot) presence for more interactive behaviour. After this setting, INTEGRATE will inhibit the setting of the the INTEGRATE request flag for some time. Input from rotary encoders and/or motor commands) will re-trigger this inhibition of INTEGRATE so rotate and Orient can work. ROTATE will rotate around the body center until some sensory dead zone for the current target (just picked by INTEGRATE is reached. Move will drive forward and (together with ORIENT) allow the creature to move in the direction of the goal implied by ORIENT. ACCEPT checks sensory input for an acceptable stop position that might have food or a high quality resource. ACCEPT will increase positive emotional levels. FEED will become active when food is indeed available available, for instance, via bottom contacts and feeding will increase positive emotional levels even more.&lt;br /&gt;
&lt;br /&gt;
::::Goal: find out where and when and how to move and set a goal&lt;br /&gt;
::::9 INTEGRATE // combine inputs and decide what to do at this moment.&lt;br /&gt;
::::10 ORIENT // orient towards the current goal&lt;br /&gt;
::::11 MOVE // move forward towards the current goal&lt;br /&gt;
::::12 ACCEPT // accept the current position and stop&lt;br /&gt;
::::13 FEED // electrical food is the best!&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;appendage use&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::Not all accepted position will directly allow access to resources like a voltage source, or an object to collect. EXTEND will try to reach the resource by (surprise) extending an appendage. PROBE will conduct a local search for the resource, and USE will get or enjoy the resource.&lt;br /&gt;
&lt;br /&gt;
::::Goal: reach a high quality resource by extending an appendage&lt;br /&gt;
::::14  EXTEND // reach for a resource&lt;br /&gt;
::::15 PROBE // probe to make contact&lt;br /&gt;
::::16 USE // this is sooo good!&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;interaction&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::EXPLORE will search for fun, however that is defined at that moment, it might mean going back to some other location to drop a collected object. For more social tasks, it might be finding something or somebody to make contact with. When EXPLORE is successful and switches its request flag off, INTERACT will control the interactive behaviour performed. Both these levels may modify the inputs for the SCAN layer to keep focus. Interact will however also increase exhaustion that eventually will prevent allow SEEKREST to become active.&lt;br /&gt;
&lt;br /&gt;
::::Goal: if all previous goals were reached this is the final goal setting layer&lt;br /&gt;
::::17 EXPLORE // find the fun&lt;br /&gt;
::::18 INTERACT // and love it!&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;rest&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::All fun comes to and end, when exhaustion strikes many higher priority levels that monitor exhaustion levels will become inactive and SEEKREST will modify the the scan layer and the the goal to finding a suitable location to rest. If a suitable location is found SLEEP will get active and stay active until sensory input changes again. At that point it is rinse and repeat.&lt;br /&gt;
&lt;br /&gt;
::::Goal: reduce exhaustion, find a location to rest and sleep there.&lt;br /&gt;
::::19 SEEKREST // after hard work...&lt;br /&gt;
::::20 SLEEP // ... it is time to sleep!&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;default&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::If non of the other levels asks for control WAIT (that always requests control) switches off all motors, reduces power use as much as possible, and waits for input. This is &#039;&#039;never&#039;&#039; expected to happen!&lt;br /&gt;
&lt;br /&gt;
::::Goal: wait for input&lt;br /&gt;
::::21 WAIT // default, always requesting but never getting it... &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;Stay tuned, more comming soon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Implementation details ==&lt;br /&gt;
: &#039;&#039;Stay tuned, more comming soon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Anderson, D.P. (2007)&#039;&#039;&#039; https://www.dprg.org/articles/2007-03a/&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Bettosini et al., 2022&#039;&#039;&#039; Torocó: A Subsumption Architecture Implementation, in: 2022 8th International Conference on Automation, Robotics and Applications (ICARA) IEEE, Prague, Czech Republic, pp. 27–32. . https://doi.org/10.1109/ICARA55094.2022.9738521&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Brooks, R.A. (1986)&#039;&#039;&#039; A Robust Layer Control System for a Mobile Robot, IEEE Journal of Robotics and Automation RA-2, 14-23&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Rickenbacher (1975)&#039;&#039;&#039; Lernen und Motivation als relevanzgesteuerte Datenverarbeitung: Ein Computer-Simulationsmodell elementarer kognitiv-affektiver Prozesse. Birkhäuser Verag Basel.&lt;/div&gt;</summary>
		<author><name>Peterr</name></author>
	</entry>
	<entry>
		<id>https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15313</id>
		<title>Leaphy Robot</title>
		<link rel="alternate" type="text/html" href="https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15313"/>
		<updated>2025-10-01T22:46:01Z</updated>

		<summary type="html">&lt;p&gt;Peterr: /* Sensory inputs */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Name=Leaphy robot with subsumption architecture&lt;br /&gt;
|Skills=software hardware electronics biology&lt;br /&gt;
|Status=Active&lt;br /&gt;
|Niche=robotics&lt;br /&gt;
|Purpose=Fun&lt;br /&gt;
|Picture=Leaphy back side view.jpg&lt;br /&gt;
|Tool=No&lt;br /&gt;
|Location=Space, home&lt;br /&gt;
|Cost=Very small given what is already present and what is available in the space (everything!!)&lt;br /&gt;
|Category=Electronics&lt;br /&gt;
}}&lt;br /&gt;
== Electronic insect-like creature ==&lt;br /&gt;
&#039;&#039;&#039;Physiological, Behavioural and environmental overview&#039;&#039;&#039; &amp;lt;br&amp;gt;&lt;br /&gt;
peterr 2022- 2025 (with &#039;&#039;very&#039;&#039; long pauses)&lt;br /&gt;
&lt;br /&gt;
====Document history====&lt;br /&gt;
* Currently this is a living document and this wiki contains the latest version&lt;br /&gt;
* September 2025 subsumption architecture design &amp;amp; transfer to nurdspace wiki&lt;br /&gt;
* August    2025 Documentation for scheduler&lt;br /&gt;
* March     2023 Draft version 0.2  - terminology cleanup and scope&lt;br /&gt;
* November  2022 First document sketches &amp;amp; ideas&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project==&lt;br /&gt;
The insect like creature based on the original [https://leaphy.store/product/leaphy-original-los/ leaphyrobot] has a set of functionalities that together allow it to effectively find, and feed on targets that provides electricity as a reward.&lt;br /&gt;
Learning strategies to improve success rate can be implemented.&lt;br /&gt;
Sexual signaling, event prediction, mating behaviour, genetic exchange and evolution are in principle possible but are currently still (far) out of scope. The system at it&#039;s highest level can be seen as a feedback loop: sensory input =&amp;gt; behavioural selection =&amp;gt; motor output =&amp;gt; new sensory input. The original design (2022) was meant to live in wind tunnel, and find odour sources to feed, but currently the emphasis has shifted from odour detection to more general sensory processing using subsumption architecture, [https://nurdspace.nl/Leaphy_Robot#Brain see below].&lt;br /&gt;
&lt;br /&gt;
== Sensory inputs ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Mechanoreceptor - sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
:::Micro switch based tactile hairs. &lt;br /&gt;
:::&#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Ultrasound - Distance sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
::: Ultrasonic pulses detect obstacles and trigger reflex avoidance behaviour&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Better directional responses would be possible with more than one US sensor. &lt;br /&gt;
:::: This would need a dedicated embedded processor. &lt;br /&gt;
:::: &#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing light intensity&#039;&#039;&#039;&lt;br /&gt;
::: Two LDR photoreceptors measure front-left light level and front-right light level&lt;br /&gt;
::: Total light intensity (sum) is available as an analog voltage&lt;br /&gt;
::: The difference between the inputs is also available, and signals what side to turn to, to approach or avoid the light.&lt;br /&gt;
::: &#039;&#039;Development status: working well in priciple, but due to mounting problems actually not functioning currently.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing sound (audio)&#039;&#039;&#039;&lt;br /&gt;
::: A subunit with its own processor, containing an [https://en.wikipedia.org/wiki/Electret_microphone Electret microphone] to measure ambiant sound level, frequency and sound patterns. &lt;br /&gt;
::: Can be used in classical (Pawlow) and operand conditioning experiments. Will detect both absolute sound levels (for startle or avoidance responses) and can contain feature detectors (e.g. chirp intervals for leaf hopper like  communication and courting  behaviour of two leaphy&#039;s).  &lt;br /&gt;
::: In addition, an Audeme Movi speech recognition shield (see https://www.audeme.com/movi.html) could be used to process voice commands&lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented, but Movi shield &amp;quot;proof of concept&amp;quot; done&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;PIR movement sensor&#039;&#039;&#039;&lt;br /&gt;
::: In addition to light intensity, an infra red motion sensors can be used to detect movements (humans, or the cat for that matter) &lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented but PIR (similar to this [https://www.adafruit.com/product/189 adafruit thingy]) is available&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Sensing wind direction &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based tactile hairs?  Something like [https://www.instructables.com/Low-Cost-Low-Speed-Wind-Sensor-1/ this],with shielding? or sensitive temperature measurements?&lt;br /&gt;
:::; Note: Wind direction sensing in the wind tunnel is currently replaced by sensing light gradients parallel to the wind direction because the wind sensor is not available yet. &lt;br /&gt;
:::: &#039;&#039;Development status: To be designed, high priority for the windtunnel version with odour processing as a main goal, low priority for the a free walking space/nurdspace version described here.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Volatiles (odours) &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based perception of volatiles like alcohol (fruit-fly like behaviours), Carbon dioxide (mosquito like behaviour), or VOC&#039;s (most plant eating insects). The sensor produces a voltage level proportional to the intensity of the stimulus. Using a threshold can generate a presence/absence signal. &lt;br /&gt;
::: The interval between odour pulses is a proxy for the distance to the source. Note that an odour &amp;quot;gradient&amp;quot; does not exist!&lt;br /&gt;
&lt;br /&gt;
::: Current implementation uses a SGP30 board. The time constant of the the sensor is in the order of 1 second, but &amp;quot;whiffs&amp;quot; of odour could be detected faster by using a feature detector that looks for sudden steps in the signal. This will also act as an sensory adaptation mechanism: in the absence of change the output go&#039;s to zero.&lt;br /&gt;
::: &#039;&#039;Development status: Sensor: worked, currently broken&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground color&#039;&#039;&#039;&lt;br /&gt;
::: This sensor measures ground colour and the output can be used to test for a particular condition (e.g. being at a target position). It can also be used to simulate trail pheromones implemented as colors next to the  trail followed. This sense can also take the role of short distance &amp;quot; present at target&amp;quot; stimuli.&lt;br /&gt;
::: &#039;&#039; Development status: Operational &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground reflection level&#039;&#039;&#039;&lt;br /&gt;
::: Two sensors &#039;line followers&#039; that both provide a binary present/absent signal of ground reflection.&lt;br /&gt;
::: Can be used to simulate trail following behaviour on a network of lines  (combined with (led) ground colours.&lt;br /&gt;
::: &#039;&#039;Development status: testing phase&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Future extensions: A combination of voltage levels and pulse frequency coding in the source could be used to simulate a spectrum of &amp;quot;chemical&amp;quot; inputs.  &lt;br /&gt;
:::: Feature detectors could extract particular frequencies and/or patterns to recognise for instance &amp;quot;&#039;&#039;toxic&#039;&#039;&amp;quot; substances. &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Proprioception (internal &amp;quot;feeling&amp;quot;)&#039;&#039;&#039;&lt;br /&gt;
::: Checking for instance for body movement when motors move, or for force feedback when extending electrical honey sucking mouthparts&lt;br /&gt;
::: Development status:To be developed, as yet low priority. &lt;br /&gt;
 &lt;br /&gt;
:: &#039;&#039;&#039;Sensing internal physiological states &#039;&#039;&#039;&lt;br /&gt;
:::To place electric reward information in perspective, some internal status information is needed, that is supplied by reading internal variables like energy levels (battery voltage , load current) or physiological state (internal variables like &amp;quot;ready to feed&amp;quot;. &lt;br /&gt;
::: More advances implementations could look up previous experiences, and rate of change in physiological status as well as brain hormone levels and excitation states (see below under internal states and hormones&amp;quot;).&lt;br /&gt;
:::Development status: To be designed.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing hormone levels&#039;&#039;&#039;&lt;br /&gt;
::: Certain activities or combinations of activities can stimulate the production of hormones. This could be implemented as slow changing values in memory. Hormone levels might modulate the effect of sensory input or behavioural output, and act as a slow form of memory.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing rewards and deterrents&#039;&#039;&#039;&lt;br /&gt;
::: Electronic organisms live on electricity, and are rewarded by sensing the presence of a voltage and current. This sensory organ is just sensing the analog voltage measured by the sensory organ. It simulates the perception of food such as nectar. Most logical position is at the tip of an appendage. &lt;br /&gt;
::: &#039;&#039;Development status: implemented and removed (needs mutiplexing). Mechanical movement (servo) to make electrical contact: testing phase.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Brain ==&lt;br /&gt;
::&#039;&#039;&#039;Subsumption architecture&#039;&#039;&#039;&lt;br /&gt;
:::The Electronic organisms has a software brain that receives sensory input both from the environment and internal status. The brain reads all inputs about every 50 msec, and produces command for actuators that produce behaviour. These behaviours can be as simple as a colour changes of a led (signaling sensory status) or movements of body and body and appendages. The aim is to make the lower levels as stateless as possible i.e. the brain uses its real time vision of the word as a model instead of some abstract internal representation. The processing principle roughly follow the subsumption architecture (Brooks 1986).&lt;br /&gt;
&lt;br /&gt;
:::Wikipedia writes about this technique:&lt;br /&gt;
::::&amp;quot;&#039;&#039;[Behaviours] are organized into a hierarchy of layers. Each layer implements a particular level of behavioral competence, and higher levels are able to subsume lower levels (= integrate/combine lower levels to a more comprehensive whole) in order to create viable behavior. For example, a robot&#039;s lowest layer could be &amp;quot;avoid an object&amp;quot;. The second layer would be &amp;quot;wander around&amp;quot;, which runs beneath the third layer &amp;quot;explore the world&amp;quot;.[...]The subsumption architecture creates a system in which the higher layers utilize the lower-level competencies. The layers, which all receive sensor-information, work in parallel and generate outputs. These outputs can be commands to actuators, or signals that suppress or inhibit other layers.&amp;quot;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::My current implementation uses the opposite order. The high priority levels conduct the simplest behavioural tasks, and when these high priority but simple behavioural levels are happy more complex task can get control. This approach is still experimental, but in any case easy enough to reverse again.&lt;br /&gt;
&lt;br /&gt;
:::The behavioural levels &#039;&#039;all&#039;&#039; compete for control of the robot. Each behavioural layer evaluates its sensory input and determines if it wants to control the outputs (to change its input according to its (implied) goal, e.g. mechanoreceptors (microswitches) will only request control if the switch is closed. After all the behavioural levels are evaluated, and their request flags set or reset an arbitrate routine  selects the highest active layer that will run the robot behaviorual output for the next 50 msec.&lt;br /&gt;
:::See Anderson (2007) for a clear explanations and actual implementation examples.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Brain subsystems&#039;&#039;&#039;&lt;br /&gt;
:::More complicated or slow tasks (like sound processing or US echo detection) can be executed in separate processor boards that report their status  to the main  controller. Conceptually this is not different from subroutines for tasks.&lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Nervous system&#039;&#039;&#039;&lt;br /&gt;
::: The currently (sort of) running implementation of the brain is using a real time loop in a very simple cooperative multitasking system ([https://yiweimao.github.io/blog/async_microcontroller/ YiweiMao scheduler]) and inmplemented on an Arduino Uno &lt;br /&gt;
::: &#039;&#039;Development status: operational, but under active development.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Associative memory&#039;&#039;&#039;&lt;br /&gt;
::: Associative memory in it current, simplest form will be implemented as memory locations for particular sensory input combinations.  inputs that coincide increase a counter for that combination (learning those combinations). This allows both Pawlow  and operand conditioning.&lt;br /&gt;
:::&#039;&#039;Development status: not yet implemented, proof of concept done ~50 years ago :).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Excitation state and hormones&#039;&#039;&#039;&lt;br /&gt;
::: Hormones are internal variables with levels that act as slow changing memory for previous (combinations of) states.&lt;br /&gt;
::: A default breakdown speed can be set that slowly decrease hormone levels. Particular sensory input could increase the levels again. Reaching high levels of certain hormones can be a goal in itself, and subject to learning behaviour.&lt;br /&gt;
::: &#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Satisfaction&#039;&#039;&#039;&lt;br /&gt;
:::Signals to end feeding behaviour can -in addition to electrical food running out- also come from internal signals (satiation, internal hormonal signals, (too) long time periods with little change of events)&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Future prediction&#039;&#039;&#039;&lt;br /&gt;
:::This is currently way out of scope, but neural-net like implementations that store event sequences, predict likely outcomes of current inputs and act accordingly are fully feasible.&lt;br /&gt;
::: See Rickenbacher 1975 for an example that is probably  a bit more traceable than -for instance- modern neural network code like Tensorflow. &lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Effectors ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;main motors&#039;&#039;&#039;&lt;br /&gt;
:::The main moves of the organism are implemented by two wheels driven by two [https://leaphy.store/product/tt-motor-10cm-jumper-female/ DC motors] with build in gearboxes) and a [https://leaphy.store/product/motor-shield/ motor shield]. Motor speed is controlled by pulse width modualation (PMW)) present in the processor. Steering is done by differential motorspeed, a third backside &amp;quot;wheel&amp;quot; is a simple short passive wooden stand. This works well on reasonable flat surfaces, but needs improvement is the next robot (Terzo).&lt;br /&gt;
:::&#039;&#039;Motor development status: Operational at a basic level, PID control and extra power at startup to get smooth startup at low speed is needed.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Movable mouthparts&#039;&#039;&#039;&lt;br /&gt;
:::Appendages like extendable mouthparts controlled by [https://isking-modellbahn.de/modelcraft-es-030-Servo-top-line-steuerelektronik servo]&#039;s can be used for feeding on electrical food. Currently one servo controlling a proboscis (mouthpart for feeding) is present.&lt;br /&gt;
:::&#039;&#039;Development status: Operational in priciple, untested in practice, needs 3D printing of parts&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;[https://leaphy.store/product/rgb-led-single/ Three colour led]&#039;&#039;&#039;&lt;br /&gt;
::: can be used for signaling status of whatever state we want.&lt;br /&gt;
:::&#039;&#039;Development status: Operational &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Piezo beeper &#039;&#039;&#039;&lt;br /&gt;
::: Present on the [https://leaphy.store/product/motor-shield/ motor shield] can be used to create a variety of sounds,for instance to signal happines, distress or alarm.&lt;br /&gt;
:::&#039;&#039;Development status: Operational, but specific sounds need to be designed&lt;br /&gt;
&lt;br /&gt;
== Behavioural levels ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:: Behaviour in subsumption architecture is organised in levels that compete for control, the highest priority behaviour (lowest rank, top of list) will control the robot for 50 msec.&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Overview of current behavioral levels and  their most important inputs for controlling requests&#039;&#039;&#039;. &lt;br /&gt;
:::Layers are only a naming convention, conceptually grouping behaviour with somewhat similar aims. Note that the ultimate goals of the system (here level SLEEP, see below) is determined by the order of the levels. Changing the order evidently will change the behavioural outcomes.  Currently the order is hard coded.&lt;br /&gt;
&lt;br /&gt;
:::High priority behavioural levels take care of the most basic and critical task. When their goals are reached (their requests for control stop), higher behavioural levels, (representing more advanced lower priority tasks will be able to run. Note however that higher levels can explicitly inhibit or even modify lower level behaviours under some circumstances for some time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
::See the actual calls for details.&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;Layer &amp;quot;distress&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::If unable to meet the absolute basic requirement for battery voltage or movement CALL for help. In STUCK, try reflexes to get loose, pause regular. If nothing works eventually HIBERNATE &lt;br /&gt;
&lt;br /&gt;
::::Goal:  deal with the really difficult situations &lt;br /&gt;
::::0  HIBERNATE // hope for better times...&lt;br /&gt;
::::1  STUCK // try to solve non-movement when motors run...&lt;br /&gt;
::::2  CALL  // call for help&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;stay free&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::The primary sensory input activating this level are Bumper sensors and Ultrasonics, but also hormones for high emotional levels reached by an overload of sensory input or a high number of failing tries to reach some goal. FREEZE will stop movement for an serious amount of time to reduce overload FIGHT will move quickly forward and get very close to an object possibly even disregarding US and bumpers and hitting the object. ESCAPE will try to free the bumpers EVADE will try to keep a safe distance from objects. FLIGHT will try to run straight for a relative long time (using a countdown timer) but will subsumed by lower levels.&lt;br /&gt;
&lt;br /&gt;
::::Goal: avoid stressors. &lt;br /&gt;
::::3  FREEZE  // simulated dead&lt;br /&gt;
::::4  FIGHT   // try to intimidate &lt;br /&gt;
::::5  ESCAPE  // escape from touch&lt;br /&gt;
::::6  EVADE   // keep distance&lt;br /&gt;
::::7  FLIGHT  // run away  &lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;external control&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::This level is only requesting control if external commands are present in sensordata. The behaviour is self-reinforcing so once activated it keeps controlling the creature as long as new commands arrive within reasonable time. Note that Escape and Evade and Flight have priority, manual control has limits, the creature is autonomous!&lt;br /&gt;
&lt;br /&gt;
::::Goals: Stay free and prevent distress, but otherwise otherwise obey external commands.&lt;br /&gt;
::::8 MANUAL // How boring...&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;scan and move&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::This level is the heart of the brain. Reaching the first level of this layer (INTEGRATE) is rewarding. :::Everything is (locally) under control and a target goal can been set. This will also increase positive emotional level. INTEGRATE will inspect internal status, like battery level, and emotional states like exhaustion, excitatory state and modify the settings for ORIENT and MOVE accordingly. Options for ORIENTs setting are for instance random turn angles and low speed  for a drunkard&#039;s walk, phototaxis (pos. or neg.), odour pulse count or interval for kinesis behaviour, and PIR input (i. e. human or robot) presence for more interactive behaviour. After this setting, INTEGRATE will inhibit the setting of the the INTEGRATE request flag for some time. Input from rotary encoders and/or motor commands) will re-trigger this inhibition of INTEGRATE so rotate and Orient can work. ROTATE will rotate around the body center until some sensory dead zone for the current target (just picked by INTEGRATE is reached. Move will drive forward and (together with ORIENT) allow the creature to move in the direction of the goal implied by ORIENT. ACCEPT checks sensory input for an acceptable stop position that might have food or a high quality resource. ACCEPT will increase positive emotional levels. FEED will become active when food is indeed available available, for instance, via bottom contacts and feeding will increase positive emotional levels even more.&lt;br /&gt;
&lt;br /&gt;
::::Goal: find out where and when and how to move and set a goal&lt;br /&gt;
::::9 INTEGRATE // combine inputs and decide what to do at this moment.&lt;br /&gt;
::::10 ORIENT // orient towards the current goal&lt;br /&gt;
::::11 MOVE // move forward towards the current goal&lt;br /&gt;
::::12 ACCEPT // accept the current position and stop&lt;br /&gt;
::::13 FEED // electrical food is the best!&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;appendage use&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::Not all accepted position will directly allow access to resources like a voltage source, or an object to collect. EXTEND will try to reach the resource by (surprise) extending an appendage. PROBE will conduct a local search for the resource, and USE will get or enjoy the resource.&lt;br /&gt;
&lt;br /&gt;
::::Goal: reach a high quality resource by extending an appendage&lt;br /&gt;
::::14  EXTEND // reach for a resource&lt;br /&gt;
::::15 PROBE // probe to make contact&lt;br /&gt;
::::16 USE // this is sooo good!&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;interaction&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::EXPLORE will search for fun, however that is defined at that moment, it might mean going back to some other location to drop a collected object. For more social tasks, it might be finding something or somebody to make contact with. When EXPLORE is successful and switches its request flag off, INTERACT will control the interactive behaviour performed. Both these levels may modify the inputs for the SCAN layer to keep focus. Interact will however also increase exhaustion that eventually will prevent allow SEEKREST to become active.&lt;br /&gt;
&lt;br /&gt;
::::Goal: if all previous goals were reached this is the final goal setting layer&lt;br /&gt;
::::17 EXPLORE // find the fun&lt;br /&gt;
::::18 INTERACT // and love it!&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;rest&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::All fun comes to and end, when exhaustion strikes many higher priority levels that monitor exhaustion levels will become inactive and SEEKREST will modify the the scan layer and the the goal to finding a suitable location to rest. If a suitable location is found SLEEP will get active and stay active until sensory input changes again. At that point it is rinse and repeat.&lt;br /&gt;
&lt;br /&gt;
::::Goal: reduce exhaustion, find a location to rest and sleep there.&lt;br /&gt;
::::19 SEEKREST // after hard work...&lt;br /&gt;
::::20 SLEEP // ... it is time to sleep!&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;default&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::If non of the other levels asks for control WAIT (that always requests control) switches off all motors, reduces power use as much as possible, and waits for input. This is &#039;&#039;never&#039;&#039; expected to happen!&lt;br /&gt;
&lt;br /&gt;
::::Goal: wait for input&lt;br /&gt;
::::21 WAIT // default, always requesting but never getting it... &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;Stay tuned, more comming soon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Implementation details ==&lt;br /&gt;
: &#039;&#039;Stay tuned, more comming soon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Anderson, D.P. (2007)&#039;&#039;&#039; https://www.dprg.org/articles/2007-03a/&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Bettosini et al., 2022&#039;&#039;&#039; Torocó: A Subsumption Architecture Implementation, in: 2022 8th International Conference on Automation, Robotics and Applications (ICARA) IEEE, Prague, Czech Republic, pp. 27–32. . https://doi.org/10.1109/ICARA55094.2022.9738521&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Brooks, R.A. (1986)&#039;&#039;&#039; A Robust Layer Control System for a Mobile Robot, IEEE Journal of Robotics and Automation RA-2, 14-23&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Rickenbacher (1975)&#039;&#039;&#039; Lernen und Motivation als relevanzgesteuerte Datenverarbeitung: Ein Computer-Simulationsmodell elementarer kognitiv-affektiver Prozesse. Birkhäuser Verag Basel.&lt;/div&gt;</summary>
		<author><name>Peterr</name></author>
	</entry>
	<entry>
		<id>https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15312</id>
		<title>Leaphy Robot</title>
		<link rel="alternate" type="text/html" href="https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15312"/>
		<updated>2025-10-01T22:42:18Z</updated>

		<summary type="html">&lt;p&gt;Peterr: /* Sensory inputs */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Name=Leaphy robot with subsumption architecture&lt;br /&gt;
|Skills=software hardware electronics biology&lt;br /&gt;
|Status=Active&lt;br /&gt;
|Niche=robotics&lt;br /&gt;
|Purpose=Fun&lt;br /&gt;
|Picture=Leaphy back side view.jpg&lt;br /&gt;
|Tool=No&lt;br /&gt;
|Location=Space, home&lt;br /&gt;
|Cost=Very small given what is already present and what is available in the space (everything!!)&lt;br /&gt;
|Category=Electronics&lt;br /&gt;
}}&lt;br /&gt;
== Electronic insect-like creature ==&lt;br /&gt;
&#039;&#039;&#039;Physiological, Behavioural and environmental overview&#039;&#039;&#039; &amp;lt;br&amp;gt;&lt;br /&gt;
peterr 2022- 2025 (with &#039;&#039;very&#039;&#039; long pauses)&lt;br /&gt;
&lt;br /&gt;
====Document history====&lt;br /&gt;
* Currently this is a living document and this wiki contains the latest version&lt;br /&gt;
* September 2025 subsumption architecture design &amp;amp; transfer to nurdspace wiki&lt;br /&gt;
* August    2025 Documentation for scheduler&lt;br /&gt;
* March     2023 Draft version 0.2  - terminology cleanup and scope&lt;br /&gt;
* November  2022 First document sketches &amp;amp; ideas&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project==&lt;br /&gt;
The insect like creature based on the original [https://leaphy.store/product/leaphy-original-los/ leaphyrobot] has a set of functionalities that together allow it to effectively find, and feed on targets that provides electricity as a reward.&lt;br /&gt;
Learning strategies to improve success rate can be implemented.&lt;br /&gt;
Sexual signaling, event prediction, mating behaviour, genetic exchange and evolution are in principle possible but are currently still (far) out of scope. The system at it&#039;s highest level can be seen as a feedback loop: sensory input =&amp;gt; behavioural selection =&amp;gt; motor output =&amp;gt; new sensory input. The original design (2022) was meant to live in wind tunnel, and find odour sources to feed, but currently the emphasis has shifted from odour detection to more general sensory processing using subsumption architecture, [https://nurdspace.nl/Leaphy_Robot#Brain see below].&lt;br /&gt;
&lt;br /&gt;
== Sensory inputs ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Mechanoreceptor - sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
:::Micro switch based tactile hairs. &lt;br /&gt;
:::&#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Ultrasound - Distance sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
::: Ultrasonic pulses detect obstacles and trigger reflex avoidance behaviour&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Better directional responses would be possible with more than one US sensor. &lt;br /&gt;
:::: This would need a dedicated embedded processor. &lt;br /&gt;
:::: &#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing light intensity&#039;&#039;&#039;&lt;br /&gt;
::: Two LDR photoreceptors measure front-left light level and front-right light level&lt;br /&gt;
::: Total light intensity (sum) is available as an analog voltage&lt;br /&gt;
::: The difference between the inputs is also available, and signals what side to turn to, to approach or avoid the light.&lt;br /&gt;
::: &#039;&#039;Development status: working well in priciple, but due to mounting problems actually not functioning currently.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing sound (audio)&#039;&#039;&#039;&lt;br /&gt;
::: A subunit with its own processor, containing an [https://en.wikipedia.org/wiki/Electret_microphone Electret microphone] to measure ambiant sound level, frequency and sound patterns. &lt;br /&gt;
::: Can be used in classical (Pawlow) and operand conditioning experiments. Will detect both absolute sound levels (for startle or avoidance responses) and can contain feature detectors (e.g. chirp intervals for leaf hopper like  communication and courting  behaviour of two leaphy&#039;s).  &lt;br /&gt;
::: In addition, an Audeme Movi speech recognition shield (see https://www.audeme.com/movi.html) could be used to process voice commands&lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented, but Movi shield &amp;quot;proof of concept&amp;quot; done&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;PIR movement sensor&#039;&#039;&#039;&lt;br /&gt;
::: In addition to light intensity, an infra red motion sensors can be used to detect movements (humans, or the cat for that matter) &lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented but PIR (similar to this [https://www.adafruit.com/product/189 adafruit thingy]) is available&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Sensing wind direction &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based tactile hairs?  Something like https://www.instructables.com/Low-Cost-Low-Speed-Wind-Sensor-1/ with shielding? or sensitive temperature measurements?&lt;br /&gt;
:::; Note: Wind direction sensing in the wind tunnel is currently replaced by sensing light gradients parallel to the wind direction because the wind sensor is not available yet. &lt;br /&gt;
:::: &#039;&#039;Development status: To be designed, high priority for the windtunnel version with odour processing as a main goal, low priority for the a free walking space/nurdspace version described here.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Volatiles (odours) &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based perception of volatiles like alcohol (fruit-fly like behaviours), Carbon dioxide (mosquito like behaviour), or VOC&#039;s (most plant eating insects). The sensor produces a voltage level proportional to the intensity of the stimulus. Using a threshold can generate a presence/absence signal. &lt;br /&gt;
::: The interval between odour pulses is a proxy for the distance to the source. Note that an odour &amp;quot;gradient&amp;quot; does not exist!&lt;br /&gt;
&lt;br /&gt;
::: Current implementation uses a SGP30 board. The time constant of the the sensor is in the order of 1 second, but &amp;quot;whiffs&amp;quot; of odour could be detected faster by using a feature detector that looks for sudden steps in the signal. This will also act as an sensory adaptation mechanism: in the absence of change the output go&#039;s to zero.&lt;br /&gt;
::: &#039;&#039;Development status: Sensor: worked, currently broken&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground color&#039;&#039;&#039;&lt;br /&gt;
::: This sensor measures ground colour and the output can be used to test for a particular condition (e.g. being at a target position). It can also be used to simulate trail pheromones implemented as colors next to the  trail followed. This sense can also take the role of short distance &amp;quot; present at target&amp;quot; stimuli.&lt;br /&gt;
::: &#039;&#039; Development status: Operational &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground reflection level&#039;&#039;&#039;&lt;br /&gt;
::: Two sensors &#039;line followers&#039; that both provide a binary present/absent signal of ground reflection.&lt;br /&gt;
::: Can be used to simulate trail following behaviour on a network of lines  (combined with (led) ground colours.&lt;br /&gt;
::: &#039;&#039;Development status: testing phase&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Future extensions: A combination of voltage levels and pulse frequency coding in the source could be used to simulate a spectrum of &amp;quot;chemical&amp;quot; inputs.  &lt;br /&gt;
:::: Feature detectors could extract particular frequencies and/or patterns to recognise for instance &amp;quot;&#039;&#039;toxic&#039;&#039;&amp;quot; substances. &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Proprioception (internal &amp;quot;feeling&amp;quot;)&#039;&#039;&#039;&lt;br /&gt;
::: Checking for instance for body movement when motors move, or for force feedback when extending electrical honey sucking mouthparts&lt;br /&gt;
::: Development status:To be developed, as yet low priority. &lt;br /&gt;
 &lt;br /&gt;
:: &#039;&#039;&#039;Sensing internal physiological states &#039;&#039;&#039;&lt;br /&gt;
:::To place electric reward information in perspective, some internal status information is needed, that is supplied by reading internal variables like energy levels (battery voltage , load current) or physiological state (internal variables like &amp;quot;ready to feed&amp;quot;. &lt;br /&gt;
::: More advances implementations could look up previous experiences, and rate of change in physiological status as well as brain hormone levels and excitation states (see below under internal states and hormones&amp;quot;).&lt;br /&gt;
:::Development status: To be designed.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing hormone levels&#039;&#039;&#039;&lt;br /&gt;
::: Certain activities or combinations of activities can stimulate the production of hormones. This could be implemented as slow changing values in memory. Hormone levels might modulate the effect of sensory input or behavioural output, and act as a slow form of memory.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing rewards and deterrents&#039;&#039;&#039;&lt;br /&gt;
::: Electronic organisms live on electricity, and are rewarded by sensing the presence of a voltage and current. This sensory organ is just sensing the analog voltage measured by the sensory organ. It simulates the perception of food such as nectar. Most logical position is at the tip of an appendage. &lt;br /&gt;
::: &#039;&#039;Development status: implemented and removed (needs mutiplexing). Mechanical movement (servo) to make electrical contact: testing phase.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Brain ==&lt;br /&gt;
::&#039;&#039;&#039;Subsumption architecture&#039;&#039;&#039;&lt;br /&gt;
:::The Electronic organisms has a software brain that receives sensory input both from the environment and internal status. The brain reads all inputs about every 50 msec, and produces command for actuators that produce behaviour. These behaviours can be as simple as a colour changes of a led (signaling sensory status) or movements of body and body and appendages. The aim is to make the lower levels as stateless as possible i.e. the brain uses its real time vision of the word as a model instead of some abstract internal representation. The processing principle roughly follow the subsumption architecture (Brooks 1986).&lt;br /&gt;
&lt;br /&gt;
:::Wikipedia writes about this technique:&lt;br /&gt;
::::&amp;quot;&#039;&#039;[Behaviours] are organized into a hierarchy of layers. Each layer implements a particular level of behavioral competence, and higher levels are able to subsume lower levels (= integrate/combine lower levels to a more comprehensive whole) in order to create viable behavior. For example, a robot&#039;s lowest layer could be &amp;quot;avoid an object&amp;quot;. The second layer would be &amp;quot;wander around&amp;quot;, which runs beneath the third layer &amp;quot;explore the world&amp;quot;.[...]The subsumption architecture creates a system in which the higher layers utilize the lower-level competencies. The layers, which all receive sensor-information, work in parallel and generate outputs. These outputs can be commands to actuators, or signals that suppress or inhibit other layers.&amp;quot;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::My current implementation uses the opposite order. The high priority levels conduct the simplest behavioural tasks, and when these high priority but simple behavioural levels are happy more complex task can get control. This approach is still experimental, but in any case easy enough to reverse again.&lt;br /&gt;
&lt;br /&gt;
:::The behavioural levels &#039;&#039;all&#039;&#039; compete for control of the robot. Each behavioural layer evaluates its sensory input and determines if it wants to control the outputs (to change its input according to its (implied) goal, e.g. mechanoreceptors (microswitches) will only request control if the switch is closed. After all the behavioural levels are evaluated, and their request flags set or reset an arbitrate routine  selects the highest active layer that will run the robot behaviorual output for the next 50 msec.&lt;br /&gt;
:::See Anderson (2007) for a clear explanations and actual implementation examples.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Brain subsystems&#039;&#039;&#039;&lt;br /&gt;
:::More complicated or slow tasks (like sound processing or US echo detection) can be executed in separate processor boards that report their status  to the main  controller. Conceptually this is not different from subroutines for tasks.&lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Nervous system&#039;&#039;&#039;&lt;br /&gt;
::: The currently (sort of) running implementation of the brain is using a real time loop in a very simple cooperative multitasking system ([https://yiweimao.github.io/blog/async_microcontroller/ YiweiMao scheduler]) and inmplemented on an Arduino Uno &lt;br /&gt;
::: &#039;&#039;Development status: operational, but under active development.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Associative memory&#039;&#039;&#039;&lt;br /&gt;
::: Associative memory in it current, simplest form will be implemented as memory locations for particular sensory input combinations.  inputs that coincide increase a counter for that combination (learning those combinations). This allows both Pawlow  and operand conditioning.&lt;br /&gt;
:::&#039;&#039;Development status: not yet implemented, proof of concept done ~50 years ago :).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Excitation state and hormones&#039;&#039;&#039;&lt;br /&gt;
::: Hormones are internal variables with levels that act as slow changing memory for previous (combinations of) states.&lt;br /&gt;
::: A default breakdown speed can be set that slowly decrease hormone levels. Particular sensory input could increase the levels again. Reaching high levels of certain hormones can be a goal in itself, and subject to learning behaviour.&lt;br /&gt;
::: &#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Satisfaction&#039;&#039;&#039;&lt;br /&gt;
:::Signals to end feeding behaviour can -in addition to electrical food running out- also come from internal signals (satiation, internal hormonal signals, (too) long time periods with little change of events)&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Future prediction&#039;&#039;&#039;&lt;br /&gt;
:::This is currently way out of scope, but neural-net like implementations that store event sequences, predict likely outcomes of current inputs and act accordingly are fully feasible.&lt;br /&gt;
::: See Rickenbacher 1975 for an example that is probably  a bit more traceable than -for instance- modern neural network code like Tensorflow. &lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Effectors ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;main motors&#039;&#039;&#039;&lt;br /&gt;
:::The main moves of the organism are implemented by two wheels driven by two [https://leaphy.store/product/tt-motor-10cm-jumper-female/ DC motors] with build in gearboxes) and a [https://leaphy.store/product/motor-shield/ motor shield]. Motor speed is controlled by pulse width modualation (PMW)) present in the processor. Steering is done by differential motorspeed, a third backside &amp;quot;wheel&amp;quot; is a simple short passive wooden stand. This works well on reasonable flat surfaces, but needs improvement is the next robot (Terzo).&lt;br /&gt;
:::&#039;&#039;Motor development status: Operational at a basic level, PID control and extra power at startup to get smooth startup at low speed is needed.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Movable mouthparts&#039;&#039;&#039;&lt;br /&gt;
:::Appendages like extendable mouthparts controlled by [https://isking-modellbahn.de/modelcraft-es-030-Servo-top-line-steuerelektronik servo]&#039;s can be used for feeding on electrical food. Currently one servo controlling a proboscis (mouthpart for feeding) is present.&lt;br /&gt;
:::&#039;&#039;Development status: Operational in priciple, untested in practice, needs 3D printing of parts&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;[https://leaphy.store/product/rgb-led-single/ Three colour led]&#039;&#039;&#039;&lt;br /&gt;
::: can be used for signaling status of whatever state we want.&lt;br /&gt;
:::&#039;&#039;Development status: Operational &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Piezo beeper &#039;&#039;&#039;&lt;br /&gt;
::: Present on the [https://leaphy.store/product/motor-shield/ motor shield] can be used to create a variety of sounds,for instance to signal happines, distress or alarm.&lt;br /&gt;
:::&#039;&#039;Development status: Operational, but specific sounds need to be designed&lt;br /&gt;
&lt;br /&gt;
== Behavioural levels ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:: Behaviour in subsumption architecture is organised in levels that compete for control, the highest priority behaviour (lowest rank, top of list) will control the robot for 50 msec.&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Overview of current behavioral levels and  their most important inputs for controlling requests&#039;&#039;&#039;. &lt;br /&gt;
:::Layers are only a naming convention, conceptually grouping behaviour with somewhat similar aims. Note that the ultimate goals of the system (here level SLEEP, see below) is determined by the order of the levels. Changing the order evidently will change the behavioural outcomes.  Currently the order is hard coded.&lt;br /&gt;
&lt;br /&gt;
:::High priority behavioural levels take care of the most basic and critical task. When their goals are reached (their requests for control stop), higher behavioural levels, (representing more advanced lower priority tasks will be able to run. Note however that higher levels can explicitly inhibit or even modify lower level behaviours under some circumstances for some time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
::See the actual calls for details.&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;Layer &amp;quot;distress&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::If unable to meet the absolute basic requirement for battery voltage or movement CALL for help. In STUCK, try reflexes to get loose, pause regular. If nothing works eventually HIBERNATE &lt;br /&gt;
&lt;br /&gt;
::::Goal:  deal with the really difficult situations &lt;br /&gt;
::::0  HIBERNATE // hope for better times...&lt;br /&gt;
::::1  STUCK // try to solve non-movement when motors run...&lt;br /&gt;
::::2  CALL  // call for help&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;stay free&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::The primary sensory input activating this level are Bumper sensors and Ultrasonics, but also hormones for high emotional levels reached by an overload of sensory input or a high number of failing tries to reach some goal. FREEZE will stop movement for an serious amount of time to reduce overload FIGHT will move quickly forward and get very close to an object possibly even disregarding US and bumpers and hitting the object. ESCAPE will try to free the bumpers EVADE will try to keep a safe distance from objects. FLIGHT will try to run straight for a relative long time (using a countdown timer) but will subsumed by lower levels.&lt;br /&gt;
&lt;br /&gt;
::::Goal: avoid stressors. &lt;br /&gt;
::::3  FREEZE  // simulated dead&lt;br /&gt;
::::4  FIGHT   // try to intimidate &lt;br /&gt;
::::5  ESCAPE  // escape from touch&lt;br /&gt;
::::6  EVADE   // keep distance&lt;br /&gt;
::::7  FLIGHT  // run away  &lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;external control&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::This level is only requesting control if external commands are present in sensordata. The behaviour is self-reinforcing so once activated it keeps controlling the creature as long as new commands arrive within reasonable time. Note that Escape and Evade and Flight have priority, manual control has limits, the creature is autonomous!&lt;br /&gt;
&lt;br /&gt;
::::Goals: Stay free and prevent distress, but otherwise otherwise obey external commands.&lt;br /&gt;
::::8 MANUAL // How boring...&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;scan and move&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::This level is the heart of the brain. Reaching the first level of this layer (INTEGRATE) is rewarding. :::Everything is (locally) under control and a target goal can been set. This will also increase positive emotional level. INTEGRATE will inspect internal status, like battery level, and emotional states like exhaustion, excitatory state and modify the settings for ORIENT and MOVE accordingly. Options for ORIENTs setting are for instance random turn angles and low speed  for a drunkard&#039;s walk, phototaxis (pos. or neg.), odour pulse count or interval for kinesis behaviour, and PIR input (i. e. human or robot) presence for more interactive behaviour. After this setting, INTEGRATE will inhibit the setting of the the INTEGRATE request flag for some time. Input from rotary encoders and/or motor commands) will re-trigger this inhibition of INTEGRATE so rotate and Orient can work. ROTATE will rotate around the body center until some sensory dead zone for the current target (just picked by INTEGRATE is reached. Move will drive forward and (together with ORIENT) allow the creature to move in the direction of the goal implied by ORIENT. ACCEPT checks sensory input for an acceptable stop position that might have food or a high quality resource. ACCEPT will increase positive emotional levels. FEED will become active when food is indeed available available, for instance, via bottom contacts and feeding will increase positive emotional levels even more.&lt;br /&gt;
&lt;br /&gt;
::::Goal: find out where and when and how to move and set a goal&lt;br /&gt;
::::9 INTEGRATE // combine inputs and decide what to do at this moment.&lt;br /&gt;
::::10 ORIENT // orient towards the current goal&lt;br /&gt;
::::11 MOVE // move forward towards the current goal&lt;br /&gt;
::::12 ACCEPT // accept the current position and stop&lt;br /&gt;
::::13 FEED // electrical food is the best!&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;appendage use&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::Not all accepted position will directly allow access to resources like a voltage source, or an object to collect. EXTEND will try to reach the resource by (surprise) extending an appendage. PROBE will conduct a local search for the resource, and USE will get or enjoy the resource.&lt;br /&gt;
&lt;br /&gt;
::::Goal: reach a high quality resource by extending an appendage&lt;br /&gt;
::::14  EXTEND // reach for a resource&lt;br /&gt;
::::15 PROBE // probe to make contact&lt;br /&gt;
::::16 USE // this is sooo good!&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;interaction&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::EXPLORE will search for fun, however that is defined at that moment, it might mean going back to some other location to drop a collected object. For more social tasks, it might be finding something or somebody to make contact with. When EXPLORE is successful and switches its request flag off, INTERACT will control the interactive behaviour performed. Both these levels may modify the inputs for the SCAN layer to keep focus. Interact will however also increase exhaustion that eventually will prevent allow SEEKREST to become active.&lt;br /&gt;
&lt;br /&gt;
::::Goal: if all previous goals were reached this is the final goal setting layer&lt;br /&gt;
::::17 EXPLORE // find the fun&lt;br /&gt;
::::18 INTERACT // and love it!&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;rest&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::All fun comes to and end, when exhaustion strikes many higher priority levels that monitor exhaustion levels will become inactive and SEEKREST will modify the the scan layer and the the goal to finding a suitable location to rest. If a suitable location is found SLEEP will get active and stay active until sensory input changes again. At that point it is rinse and repeat.&lt;br /&gt;
&lt;br /&gt;
::::Goal: reduce exhaustion, find a location to rest and sleep there.&lt;br /&gt;
::::19 SEEKREST // after hard work...&lt;br /&gt;
::::20 SLEEP // ... it is time to sleep!&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;default&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::If non of the other levels asks for control WAIT (that always requests control) switches off all motors, reduces power use as much as possible, and waits for input. This is &#039;&#039;never&#039;&#039; expected to happen!&lt;br /&gt;
&lt;br /&gt;
::::Goal: wait for input&lt;br /&gt;
::::21 WAIT // default, always requesting but never getting it... &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;Stay tuned, more comming soon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Implementation details ==&lt;br /&gt;
: &#039;&#039;Stay tuned, more comming soon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Anderson, D.P. (2007)&#039;&#039;&#039; https://www.dprg.org/articles/2007-03a/&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Bettosini et al., 2022&#039;&#039;&#039; Torocó: A Subsumption Architecture Implementation, in: 2022 8th International Conference on Automation, Robotics and Applications (ICARA) IEEE, Prague, Czech Republic, pp. 27–32. . https://doi.org/10.1109/ICARA55094.2022.9738521&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Brooks, R.A. (1986)&#039;&#039;&#039; A Robust Layer Control System for a Mobile Robot, IEEE Journal of Robotics and Automation RA-2, 14-23&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Rickenbacher (1975)&#039;&#039;&#039; Lernen und Motivation als relevanzgesteuerte Datenverarbeitung: Ein Computer-Simulationsmodell elementarer kognitiv-affektiver Prozesse. Birkhäuser Verag Basel.&lt;/div&gt;</summary>
		<author><name>Peterr</name></author>
	</entry>
	<entry>
		<id>https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15311</id>
		<title>Leaphy Robot</title>
		<link rel="alternate" type="text/html" href="https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15311"/>
		<updated>2025-10-01T22:37:26Z</updated>

		<summary type="html">&lt;p&gt;Peterr: /* Sensory inputs */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Name=Leaphy robot with subsumption architecture&lt;br /&gt;
|Skills=software hardware electronics biology&lt;br /&gt;
|Status=Active&lt;br /&gt;
|Niche=robotics&lt;br /&gt;
|Purpose=Fun&lt;br /&gt;
|Picture=Leaphy back side view.jpg&lt;br /&gt;
|Tool=No&lt;br /&gt;
|Location=Space, home&lt;br /&gt;
|Cost=Very small given what is already present and what is available in the space (everything!!)&lt;br /&gt;
|Category=Electronics&lt;br /&gt;
}}&lt;br /&gt;
== Electronic insect-like creature ==&lt;br /&gt;
&#039;&#039;&#039;Physiological, Behavioural and environmental overview&#039;&#039;&#039; &amp;lt;br&amp;gt;&lt;br /&gt;
peterr 2022- 2025 (with &#039;&#039;very&#039;&#039; long pauses)&lt;br /&gt;
&lt;br /&gt;
====Document history====&lt;br /&gt;
* Currently this is a living document and this wiki contains the latest version&lt;br /&gt;
* September 2025 subsumption architecture design &amp;amp; transfer to nurdspace wiki&lt;br /&gt;
* August    2025 Documentation for scheduler&lt;br /&gt;
* March     2023 Draft version 0.2  - terminology cleanup and scope&lt;br /&gt;
* November  2022 First document sketches &amp;amp; ideas&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project==&lt;br /&gt;
The insect like creature based on the original [https://leaphy.store/product/leaphy-original-los/ leaphyrobot] has a set of functionalities that together allow it to effectively find, and feed on targets that provides electricity as a reward.&lt;br /&gt;
Learning strategies to improve success rate can be implemented.&lt;br /&gt;
Sexual signaling, event prediction, mating behaviour, genetic exchange and evolution are in principle possible but are currently still (far) out of scope. The system at it&#039;s highest level can be seen as a feedback loop: sensory input =&amp;gt; behavioural selection =&amp;gt; motor output =&amp;gt; new sensory input. The original design (2022) was meant to live in wind tunnel, and find odour sources to feed, but currently the emphasis has shifted from odour detection to more general sensory processing using subsumption architecture, [https://nurdspace.nl/Leaphy_Robot#Brain see below].&lt;br /&gt;
&lt;br /&gt;
== Sensory inputs ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Mechanoreceptor - sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
:::Micro switch based tactile hairs. &lt;br /&gt;
:::&#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Ultrasound - Distance sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
::: Ultrasonic pulses detect obstacles and trigger reflex avoidance behaviour&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Better directional responses would be possible with more than one US sensor. &lt;br /&gt;
:::: This would need a dedicated embedded processor. &lt;br /&gt;
:::: &#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing light intensity&#039;&#039;&#039;&lt;br /&gt;
::: Two LDR photoreceptors measure front-left light level and front-right light level&lt;br /&gt;
::: Total light intensity (sum) is available as an analog voltage&lt;br /&gt;
::: The difference between the inputs is also available, and signals what side to turn to, to approach or avoid the light.&lt;br /&gt;
::: &#039;&#039;Development status: working well in priciple, but due to mounting problems actually not functioning currently.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing sound (audio)&#039;&#039;&#039;&lt;br /&gt;
::: A subunit with its own processor, containing an [https://en.wikipedia.org/wiki/Electret_microphone Electret microphone] to measure ambiant sound level, frequency and sound patterns. &lt;br /&gt;
::: Can be used in classical (Pawlow) and operand conditioning experiments. Will detect both absolute sound levels (for startle or avoidance responses) and can contain feature detectors (e.g. chirp intervals for leaf hopper like  communication and courting  behaviour of two leaphy&#039;s).  &lt;br /&gt;
::: In addition, an Audeme Movi speech recognition shield (see https://www.audeme.com/movi.html) could be used to process voice commands&lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented, but Movi shield &amp;quot;proof of concept&amp;quot; done&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;PIR movement sensor&#039;&#039;&#039;&lt;br /&gt;
::: In addition to light intensity, an infra red motion sensors can be used to detect movements (humans, or the cat for that matter) see for instance https://www.adafruit.com/product/4871 &lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented but PIR (similar to the [https://www.adafruit.com/product/189 adafruit thingy]) available&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Sensing wind direction &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based tactile hairs?  Something like https://www.instructables.com/Low-Cost-Low-Speed-Wind-Sensor-1/ with shielding? or sensitive temperature measurements?&lt;br /&gt;
:::; Note: Wind direction sensing in the wind tunnel is currently replaced by sensing light gradients parallel to the wind direction because the wind sensor is not available yet. &lt;br /&gt;
:::: &#039;&#039;Development status: To be designed, high priority for the windtunnel version with odour processing as a main goal, low priority for the a free walking space/nurdspace version described here.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Volatiles (odours) &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based perception of volatiles like alcohol (fruit-fly like behaviours), Carbon dioxide (mosquito like behaviour), or VOC&#039;s (most plant eating insects). The sensor produces a voltage level proportional to the intensity of the stimulus. Using a threshold can generate a presence/absence signal. &lt;br /&gt;
::: The interval between odour pulses is a proxy for the distance to the source. Note that an odour &amp;quot;gradient&amp;quot; does not exist!&lt;br /&gt;
&lt;br /&gt;
::: Current implementation uses a SGP30 board. The time constant of the the sensor is in the order of 1 second, but &amp;quot;whiffs&amp;quot; of odour could be detected faster by using a feature detector that looks for sudden steps in the signal. This will also act as an sensory adaptation mechanism: in the absence of change the output go&#039;s to zero.&lt;br /&gt;
::: &#039;&#039;Development status: Sensor: worked, currently broken&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground color&#039;&#039;&#039;&lt;br /&gt;
::: This sensor measures ground colour and the output can be used to test for a particular condition (e.g. being at a target position). It can also be used to simulate trail pheromones implemented as colors next to the  trail followed. This sense can also take the role of short distance &amp;quot; present at target&amp;quot; stimuli.&lt;br /&gt;
::: &#039;&#039; Development status: Operational &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground reflection level&#039;&#039;&#039;&lt;br /&gt;
::: Two sensors &#039;line followers&#039; that both provide a binary present/absent signal of ground reflection.&lt;br /&gt;
::: Can be used to simulate trail following behaviour on a network of lines  (combined with (led) ground colours.&lt;br /&gt;
::: &#039;&#039;Development status: testing phase&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Future extensions: A combination of voltage levels and pulse frequency coding in the source could be used to simulate a spectrum of &amp;quot;chemical&amp;quot; inputs.  &lt;br /&gt;
:::: Feature detectors could extract particular frequencies and/or patterns to recognise for instance &amp;quot;&#039;&#039;toxic&#039;&#039;&amp;quot; substances. &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Proprioception (internal &amp;quot;feeling&amp;quot;)&#039;&#039;&#039;&lt;br /&gt;
::: Checking for instance for body movement when motors move, or for force feedback when extending electrical honey sucking mouthparts&lt;br /&gt;
::: Development status:To be developed, as yet low priority. &lt;br /&gt;
 &lt;br /&gt;
:: &#039;&#039;&#039;Sensing internal physiological states &#039;&#039;&#039;&lt;br /&gt;
:::To place electric reward information in perspective, some internal status information is needed, that is supplied by reading internal variables like energy levels (battery voltage , load current) or physiological state (internal variables like &amp;quot;ready to feed&amp;quot;. &lt;br /&gt;
::: More advances implementations could look up previous experiences, and rate of change in physiological status as well as brain hormone levels and excitation states (see below under internal states and hormones&amp;quot;).&lt;br /&gt;
:::Development status: To be designed.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing hormone levels&#039;&#039;&#039;&lt;br /&gt;
::: Certain activities or combinations of activities can stimulate the production of hormones. This could be implemented as slow changing values in memory. Hormone levels might modulate the effect of sensory input or behavioural output, and act as a slow form of memory.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing rewards and deterrents&#039;&#039;&#039;&lt;br /&gt;
::: Electronic organisms live on electricity, and are rewarded by sensing the presence of a voltage and current. This sensory organ is just sensing the analog voltage measured by the sensory organ. It simulates the perception of food such as nectar. Most logical position is at the tip of an appendage. &lt;br /&gt;
::: &#039;&#039;Development status: implemented and removed (needs mutiplexing). Mechanical movement (servo) to make electrical contact: testing phase.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Brain ==&lt;br /&gt;
::&#039;&#039;&#039;Subsumption architecture&#039;&#039;&#039;&lt;br /&gt;
:::The Electronic organisms has a software brain that receives sensory input both from the environment and internal status. The brain reads all inputs about every 50 msec, and produces command for actuators that produce behaviour. These behaviours can be as simple as a colour changes of a led (signaling sensory status) or movements of body and body and appendages. The aim is to make the lower levels as stateless as possible i.e. the brain uses its real time vision of the word as a model instead of some abstract internal representation. The processing principle roughly follow the subsumption architecture (Brooks 1986).&lt;br /&gt;
&lt;br /&gt;
:::Wikipedia writes about this technique:&lt;br /&gt;
::::&amp;quot;&#039;&#039;[Behaviours] are organized into a hierarchy of layers. Each layer implements a particular level of behavioral competence, and higher levels are able to subsume lower levels (= integrate/combine lower levels to a more comprehensive whole) in order to create viable behavior. For example, a robot&#039;s lowest layer could be &amp;quot;avoid an object&amp;quot;. The second layer would be &amp;quot;wander around&amp;quot;, which runs beneath the third layer &amp;quot;explore the world&amp;quot;.[...]The subsumption architecture creates a system in which the higher layers utilize the lower-level competencies. The layers, which all receive sensor-information, work in parallel and generate outputs. These outputs can be commands to actuators, or signals that suppress or inhibit other layers.&amp;quot;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::My current implementation uses the opposite order. The high priority levels conduct the simplest behavioural tasks, and when these high priority but simple behavioural levels are happy more complex task can get control. This approach is still experimental, but in any case easy enough to reverse again.&lt;br /&gt;
&lt;br /&gt;
:::The behavioural levels &#039;&#039;all&#039;&#039; compete for control of the robot. Each behavioural layer evaluates its sensory input and determines if it wants to control the outputs (to change its input according to its (implied) goal, e.g. mechanoreceptors (microswitches) will only request control if the switch is closed. After all the behavioural levels are evaluated, and their request flags set or reset an arbitrate routine  selects the highest active layer that will run the robot behaviorual output for the next 50 msec.&lt;br /&gt;
:::See Anderson (2007) for a clear explanations and actual implementation examples.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Brain subsystems&#039;&#039;&#039;&lt;br /&gt;
:::More complicated or slow tasks (like sound processing or US echo detection) can be executed in separate processor boards that report their status  to the main  controller. Conceptually this is not different from subroutines for tasks.&lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Nervous system&#039;&#039;&#039;&lt;br /&gt;
::: The currently (sort of) running implementation of the brain is using a real time loop in a very simple cooperative multitasking system ([https://yiweimao.github.io/blog/async_microcontroller/ YiweiMao scheduler]) and inmplemented on an Arduino Uno &lt;br /&gt;
::: &#039;&#039;Development status: operational, but under active development.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Associative memory&#039;&#039;&#039;&lt;br /&gt;
::: Associative memory in it current, simplest form will be implemented as memory locations for particular sensory input combinations.  inputs that coincide increase a counter for that combination (learning those combinations). This allows both Pawlow  and operand conditioning.&lt;br /&gt;
:::&#039;&#039;Development status: not yet implemented, proof of concept done ~50 years ago :).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Excitation state and hormones&#039;&#039;&#039;&lt;br /&gt;
::: Hormones are internal variables with levels that act as slow changing memory for previous (combinations of) states.&lt;br /&gt;
::: A default breakdown speed can be set that slowly decrease hormone levels. Particular sensory input could increase the levels again. Reaching high levels of certain hormones can be a goal in itself, and subject to learning behaviour.&lt;br /&gt;
::: &#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Satisfaction&#039;&#039;&#039;&lt;br /&gt;
:::Signals to end feeding behaviour can -in addition to electrical food running out- also come from internal signals (satiation, internal hormonal signals, (too) long time periods with little change of events)&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Future prediction&#039;&#039;&#039;&lt;br /&gt;
:::This is currently way out of scope, but neural-net like implementations that store event sequences, predict likely outcomes of current inputs and act accordingly are fully feasible.&lt;br /&gt;
::: See Rickenbacher 1975 for an example that is probably  a bit more traceable than -for instance- modern neural network code like Tensorflow. &lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Effectors ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;main motors&#039;&#039;&#039;&lt;br /&gt;
:::The main moves of the organism are implemented by two wheels driven by two [https://leaphy.store/product/tt-motor-10cm-jumper-female/ DC motors] with build in gearboxes) and a [https://leaphy.store/product/motor-shield/ motor shield]. Motor speed is controlled by pulse width modualation (PMW)) present in the processor. Steering is done by differential motorspeed, a third backside &amp;quot;wheel&amp;quot; is a simple short passive wooden stand. This works well on reasonable flat surfaces, but needs improvement is the next robot (Terzo).&lt;br /&gt;
:::&#039;&#039;Motor development status: Operational at a basic level, PID control and extra power at startup to get smooth startup at low speed is needed.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Movable mouthparts&#039;&#039;&#039;&lt;br /&gt;
:::Appendages like extendable mouthparts controlled by [https://isking-modellbahn.de/modelcraft-es-030-Servo-top-line-steuerelektronik servo]&#039;s can be used for feeding on electrical food. Currently one servo controlling a proboscis (mouthpart for feeding) is present.&lt;br /&gt;
:::&#039;&#039;Development status: Operational in priciple, untested in practice, needs 3D printing of parts&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;[https://leaphy.store/product/rgb-led-single/ Three colour led]&#039;&#039;&#039;&lt;br /&gt;
::: can be used for signaling status of whatever state we want.&lt;br /&gt;
:::&#039;&#039;Development status: Operational &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Piezo beeper &#039;&#039;&#039;&lt;br /&gt;
::: Present on the [https://leaphy.store/product/motor-shield/ motor shield] can be used to create a variety of sounds,for instance to signal happines, distress or alarm.&lt;br /&gt;
:::&#039;&#039;Development status: Operational, but specific sounds need to be designed&lt;br /&gt;
&lt;br /&gt;
== Behavioural levels ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:: Behaviour in subsumption architecture is organised in levels that compete for control, the highest priority behaviour (lowest rank, top of list) will control the robot for 50 msec.&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Overview of current behavioral levels and  their most important inputs for controlling requests&#039;&#039;&#039;. &lt;br /&gt;
:::Layers are only a naming convention, conceptually grouping behaviour with somewhat similar aims. Note that the ultimate goals of the system (here level SLEEP, see below) is determined by the order of the levels. Changing the order evidently will change the behavioural outcomes.  Currently the order is hard coded.&lt;br /&gt;
&lt;br /&gt;
:::High priority behavioural levels take care of the most basic and critical task. When their goals are reached (their requests for control stop), higher behavioural levels, (representing more advanced lower priority tasks will be able to run. Note however that higher levels can explicitly inhibit or even modify lower level behaviours under some circumstances for some time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
::See the actual calls for details.&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;Layer &amp;quot;distress&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::If unable to meet the absolute basic requirement for battery voltage or movement CALL for help. In STUCK, try reflexes to get loose, pause regular. If nothing works eventually HIBERNATE &lt;br /&gt;
&lt;br /&gt;
::::Goal:  deal with the really difficult situations &lt;br /&gt;
::::0  HIBERNATE // hope for better times...&lt;br /&gt;
::::1  STUCK // try to solve non-movement when motors run...&lt;br /&gt;
::::2  CALL  // call for help&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;stay free&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::The primary sensory input activating this level are Bumper sensors and Ultrasonics, but also hormones for high emotional levels reached by an overload of sensory input or a high number of failing tries to reach some goal. FREEZE will stop movement for an serious amount of time to reduce overload FIGHT will move quickly forward and get very close to an object possibly even disregarding US and bumpers and hitting the object. ESCAPE will try to free the bumpers EVADE will try to keep a safe distance from objects. FLIGHT will try to run straight for a relative long time (using a countdown timer) but will subsumed by lower levels.&lt;br /&gt;
&lt;br /&gt;
::::Goal: avoid stressors. &lt;br /&gt;
::::3  FREEZE  // simulated dead&lt;br /&gt;
::::4  FIGHT   // try to intimidate &lt;br /&gt;
::::5  ESCAPE  // escape from touch&lt;br /&gt;
::::6  EVADE   // keep distance&lt;br /&gt;
::::7  FLIGHT  // run away  &lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;external control&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::This level is only requesting control if external commands are present in sensordata. The behaviour is self-reinforcing so once activated it keeps controlling the creature as long as new commands arrive within reasonable time. Note that Escape and Evade and Flight have priority, manual control has limits, the creature is autonomous!&lt;br /&gt;
&lt;br /&gt;
::::Goals: Stay free and prevent distress, but otherwise otherwise obey external commands.&lt;br /&gt;
::::8 MANUAL // How boring...&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;scan and move&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::This level is the heart of the brain. Reaching the first level of this layer (INTEGRATE) is rewarding. :::Everything is (locally) under control and a target goal can been set. This will also increase positive emotional level. INTEGRATE will inspect internal status, like battery level, and emotional states like exhaustion, excitatory state and modify the settings for ORIENT and MOVE accordingly. Options for ORIENTs setting are for instance random turn angles and low speed  for a drunkard&#039;s walk, phototaxis (pos. or neg.), odour pulse count or interval for kinesis behaviour, and PIR input (i. e. human or robot) presence for more interactive behaviour. After this setting, INTEGRATE will inhibit the setting of the the INTEGRATE request flag for some time. Input from rotary encoders and/or motor commands) will re-trigger this inhibition of INTEGRATE so rotate and Orient can work. ROTATE will rotate around the body center until some sensory dead zone for the current target (just picked by INTEGRATE is reached. Move will drive forward and (together with ORIENT) allow the creature to move in the direction of the goal implied by ORIENT. ACCEPT checks sensory input for an acceptable stop position that might have food or a high quality resource. ACCEPT will increase positive emotional levels. FEED will become active when food is indeed available available, for instance, via bottom contacts and feeding will increase positive emotional levels even more.&lt;br /&gt;
&lt;br /&gt;
::::Goal: find out where and when and how to move and set a goal&lt;br /&gt;
::::9 INTEGRATE // combine inputs and decide what to do at this moment.&lt;br /&gt;
::::10 ORIENT // orient towards the current goal&lt;br /&gt;
::::11 MOVE // move forward towards the current goal&lt;br /&gt;
::::12 ACCEPT // accept the current position and stop&lt;br /&gt;
::::13 FEED // electrical food is the best!&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;appendage use&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::Not all accepted position will directly allow access to resources like a voltage source, or an object to collect. EXTEND will try to reach the resource by (surprise) extending an appendage. PROBE will conduct a local search for the resource, and USE will get or enjoy the resource.&lt;br /&gt;
&lt;br /&gt;
::::Goal: reach a high quality resource by extending an appendage&lt;br /&gt;
::::14  EXTEND // reach for a resource&lt;br /&gt;
::::15 PROBE // probe to make contact&lt;br /&gt;
::::16 USE // this is sooo good!&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;interaction&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::EXPLORE will search for fun, however that is defined at that moment, it might mean going back to some other location to drop a collected object. For more social tasks, it might be finding something or somebody to make contact with. When EXPLORE is successful and switches its request flag off, INTERACT will control the interactive behaviour performed. Both these levels may modify the inputs for the SCAN layer to keep focus. Interact will however also increase exhaustion that eventually will prevent allow SEEKREST to become active.&lt;br /&gt;
&lt;br /&gt;
::::Goal: if all previous goals were reached this is the final goal setting layer&lt;br /&gt;
::::17 EXPLORE // find the fun&lt;br /&gt;
::::18 INTERACT // and love it!&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;rest&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::All fun comes to and end, when exhaustion strikes many higher priority levels that monitor exhaustion levels will become inactive and SEEKREST will modify the the scan layer and the the goal to finding a suitable location to rest. If a suitable location is found SLEEP will get active and stay active until sensory input changes again. At that point it is rinse and repeat.&lt;br /&gt;
&lt;br /&gt;
::::Goal: reduce exhaustion, find a location to rest and sleep there.&lt;br /&gt;
::::19 SEEKREST // after hard work...&lt;br /&gt;
::::20 SLEEP // ... it is time to sleep!&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;default&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::If non of the other levels asks for control WAIT (that always requests control) switches off all motors, reduces power use as much as possible, and waits for input. This is &#039;&#039;never&#039;&#039; expected to happen!&lt;br /&gt;
&lt;br /&gt;
::::Goal: wait for input&lt;br /&gt;
::::21 WAIT // default, always requesting but never getting it... &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;Stay tuned, more comming soon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Implementation details ==&lt;br /&gt;
: &#039;&#039;Stay tuned, more comming soon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Anderson, D.P. (2007)&#039;&#039;&#039; https://www.dprg.org/articles/2007-03a/&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Bettosini et al., 2022&#039;&#039;&#039; Torocó: A Subsumption Architecture Implementation, in: 2022 8th International Conference on Automation, Robotics and Applications (ICARA) IEEE, Prague, Czech Republic, pp. 27–32. . https://doi.org/10.1109/ICARA55094.2022.9738521&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Brooks, R.A. (1986)&#039;&#039;&#039; A Robust Layer Control System for a Mobile Robot, IEEE Journal of Robotics and Automation RA-2, 14-23&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Rickenbacher (1975)&#039;&#039;&#039; Lernen und Motivation als relevanzgesteuerte Datenverarbeitung: Ein Computer-Simulationsmodell elementarer kognitiv-affektiver Prozesse. Birkhäuser Verag Basel.&lt;/div&gt;</summary>
		<author><name>Peterr</name></author>
	</entry>
	<entry>
		<id>https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15310</id>
		<title>Leaphy Robot</title>
		<link rel="alternate" type="text/html" href="https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15310"/>
		<updated>2025-10-01T22:34:11Z</updated>

		<summary type="html">&lt;p&gt;Peterr: /* Sensory inputs */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Name=Leaphy robot with subsumption architecture&lt;br /&gt;
|Skills=software hardware electronics biology&lt;br /&gt;
|Status=Active&lt;br /&gt;
|Niche=robotics&lt;br /&gt;
|Purpose=Fun&lt;br /&gt;
|Picture=Leaphy back side view.jpg&lt;br /&gt;
|Tool=No&lt;br /&gt;
|Location=Space, home&lt;br /&gt;
|Cost=Very small given what is already present and what is available in the space (everything!!)&lt;br /&gt;
|Category=Electronics&lt;br /&gt;
}}&lt;br /&gt;
== Electronic insect-like creature ==&lt;br /&gt;
&#039;&#039;&#039;Physiological, Behavioural and environmental overview&#039;&#039;&#039; &amp;lt;br&amp;gt;&lt;br /&gt;
peterr 2022- 2025 (with &#039;&#039;very&#039;&#039; long pauses)&lt;br /&gt;
&lt;br /&gt;
====Document history====&lt;br /&gt;
* Currently this is a living document and this wiki contains the latest version&lt;br /&gt;
* September 2025 subsumption architecture design &amp;amp; transfer to nurdspace wiki&lt;br /&gt;
* August    2025 Documentation for scheduler&lt;br /&gt;
* March     2023 Draft version 0.2  - terminology cleanup and scope&lt;br /&gt;
* November  2022 First document sketches &amp;amp; ideas&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project==&lt;br /&gt;
The insect like creature based on the original [https://leaphy.store/product/leaphy-original-los/ leaphyrobot] has a set of functionalities that together allow it to effectively find, and feed on targets that provides electricity as a reward.&lt;br /&gt;
Learning strategies to improve success rate can be implemented.&lt;br /&gt;
Sexual signaling, event prediction, mating behaviour, genetic exchange and evolution are in principle possible but are currently still (far) out of scope. The system at it&#039;s highest level can be seen as a feedback loop: sensory input =&amp;gt; behavioural selection =&amp;gt; motor output =&amp;gt; new sensory input. The original design (2022) was meant to live in wind tunnel, and find odour sources to feed, but currently the emphasis has shifted from odour detection to more general sensory processing using subsumption architecture, [https://nurdspace.nl/Leaphy_Robot#Brain see below].&lt;br /&gt;
&lt;br /&gt;
== Sensory inputs ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Mechanoreceptor - sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
:::Micro switch based tactile hairs. &lt;br /&gt;
:::&#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Ultrasound - Distance sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
::: Ultrasonic pulses detect obstacles and trigger reflex avoidance behaviour&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Better directional responses would be possible with more than one US sensor. &lt;br /&gt;
:::: This would need a dedicated embedded processor. &lt;br /&gt;
:::: &#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing light intensity&#039;&#039;&#039;&lt;br /&gt;
::: Two LDR photoreceptors measure front-left light level and front-right light level&lt;br /&gt;
::: Total light intensity (sum) is available as an analog voltage&lt;br /&gt;
::: The difference between the inputs is also available, and signals what side to turn to, to approach or avoid the light.&lt;br /&gt;
::: &#039;&#039;Development status: working well in priciple, but due to mounting problems actually not functioning currently.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing sound (audio)&#039;&#039;&#039;&lt;br /&gt;
::: A subunit with its own processor, containing an [https://en.wikipedia.org/wiki/Electret_microphone Electret microphone] to measure ambiant sound level, frequency and sound patterns. &lt;br /&gt;
::: Can be used in classical (Pawlow) and operand conditioning experiments. Will detect both absolute sound levels (for startle or avoidance responses) and can contain feature detectors (e.g. chirp intervals for leaf hopper like  communication and courting  behaviour of two leaphy&#039;s).  &lt;br /&gt;
::: In addition, an Audeme Movi speech recognition shield (see https://www.audeme.com/movi.html) could be used to process voice commands&lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented, but Movi shield &amp;quot;proof of concept&amp;quot; done&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;PIR movement sensor&#039;&#039;&#039;&lt;br /&gt;
::: In addition to light intensity, an infra red motion sensors can be used to detect movements (humans, or the cat for that matter) see for instance https://www.adafruit.com/product/4871 &lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented but PIR (similar to the adafruit thingy) available&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Sensing wind direction &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based tactile hairs?  Something like https://www.instructables.com/Low-Cost-Low-Speed-Wind-Sensor-1/ with shielding? or sensitive temperature measurements?&lt;br /&gt;
:::; Note: Wind direction sensing in the wind tunnel is currently replaced by sensing light gradients parallel to the wind direction because the wind sensor is not available yet. &lt;br /&gt;
:::: &#039;&#039;Development status: To be designed, high priority for the windtunnel version with odour processing as a main goal, low priority for the a free walking space/nurdspace version described here.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Volatiles (odours) &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based perception of volatiles like alcohol (fruit-fly like behaviours), Carbon dioxide (mosquito like behaviour), or VOC&#039;s (most plant eating insects). The sensor produces a voltage level proportional to the intensity of the stimulus. Using a threshold can generate a presence/absence signal. &lt;br /&gt;
::: The interval between odour pulses is a proxy for the distance to the source. Note that an odour &amp;quot;gradient&amp;quot; does not exist!&lt;br /&gt;
&lt;br /&gt;
::: Current implementation uses a SGP30 board. The time constant of the the sensor is in the order of 1 second, but &amp;quot;whiffs&amp;quot; of odour could be detected faster by using a feature detector that looks for sudden steps in the signal. This will also act as an sensory adaptation mechanism: in the absence of change the output go&#039;s to zero.&lt;br /&gt;
::: &#039;&#039;Development status: Sensor: worked, currently broken&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground color&#039;&#039;&#039;&lt;br /&gt;
::: This sensor measures ground colour and the output can be used to test for a particular condition (e.g. being at a target position). It can also be used to simulate trail pheromones implemented as colors next to the  trail followed. This sense can also take the role of short distance &amp;quot; present at target&amp;quot; stimuli.&lt;br /&gt;
::: &#039;&#039; Development status: Operational &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground reflection level&#039;&#039;&#039;&lt;br /&gt;
::: Two sensors &#039;line followers&#039; that both provide a binary present/absent signal of ground reflection.&lt;br /&gt;
::: Can be used to simulate trail following behaviour on a network of lines  (combined with (led) ground colours.&lt;br /&gt;
::: &#039;&#039;Development status: testing phase&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Future extensions: A combination of voltage levels and pulse frequency coding in the source could be used to simulate a spectrum of &amp;quot;chemical&amp;quot; inputs.  &lt;br /&gt;
:::: Feature detectors could extract particular frequencies and/or patterns to recognise for instance &amp;quot;&#039;&#039;toxic&#039;&#039;&amp;quot; substances. &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Proprioception (internal &amp;quot;feeling&amp;quot;)&#039;&#039;&#039;&lt;br /&gt;
::: Checking for instance for body movement when motors move, or for force feedback when extending electrical honey sucking mouthparts&lt;br /&gt;
::: Development status:To be developed, as yet low priority. &lt;br /&gt;
 &lt;br /&gt;
:: &#039;&#039;&#039;Sensing internal physiological states &#039;&#039;&#039;&lt;br /&gt;
:::To place electric reward information in perspective, some internal status information is needed, that is supplied by reading internal variables like energy levels (battery voltage , load current) or physiological state (internal variables like &amp;quot;ready to feed&amp;quot;. &lt;br /&gt;
::: More advances implementations could look up previous experiences, and rate of change in physiological status as well as brain hormone levels and excitation states (see below under internal states and hormones&amp;quot;).&lt;br /&gt;
:::Development status: To be designed.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing hormone levels&#039;&#039;&#039;&lt;br /&gt;
::: Certain activities or combinations of activities can stimulate the production of hormones. This could be implemented as slow changing values in memory. Hormone levels might modulate the effect of sensory input or behavioural output, and act as a slow form of memory.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing rewards and deterrents&#039;&#039;&#039;&lt;br /&gt;
::: Electronic organisms live on electricity, and are rewarded by sensing the presence of a voltage and current. This sensory organ is just sensing the analog voltage measured by the sensory organ. It simulates the perception of food such as nectar. Most logical position is at the tip of an appendage. &lt;br /&gt;
::: &#039;&#039;Development status: implemented and removed (needs mutiplexing). Mechanical movement (servo) to make electrical contact: testing phase.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Brain ==&lt;br /&gt;
::&#039;&#039;&#039;Subsumption architecture&#039;&#039;&#039;&lt;br /&gt;
:::The Electronic organisms has a software brain that receives sensory input both from the environment and internal status. The brain reads all inputs about every 50 msec, and produces command for actuators that produce behaviour. These behaviours can be as simple as a colour changes of a led (signaling sensory status) or movements of body and body and appendages. The aim is to make the lower levels as stateless as possible i.e. the brain uses its real time vision of the word as a model instead of some abstract internal representation. The processing principle roughly follow the subsumption architecture (Brooks 1986).&lt;br /&gt;
&lt;br /&gt;
:::Wikipedia writes about this technique:&lt;br /&gt;
::::&amp;quot;&#039;&#039;[Behaviours] are organized into a hierarchy of layers. Each layer implements a particular level of behavioral competence, and higher levels are able to subsume lower levels (= integrate/combine lower levels to a more comprehensive whole) in order to create viable behavior. For example, a robot&#039;s lowest layer could be &amp;quot;avoid an object&amp;quot;. The second layer would be &amp;quot;wander around&amp;quot;, which runs beneath the third layer &amp;quot;explore the world&amp;quot;.[...]The subsumption architecture creates a system in which the higher layers utilize the lower-level competencies. The layers, which all receive sensor-information, work in parallel and generate outputs. These outputs can be commands to actuators, or signals that suppress or inhibit other layers.&amp;quot;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::My current implementation uses the opposite order. The high priority levels conduct the simplest behavioural tasks, and when these high priority but simple behavioural levels are happy more complex task can get control. This approach is still experimental, but in any case easy enough to reverse again.&lt;br /&gt;
&lt;br /&gt;
:::The behavioural levels &#039;&#039;all&#039;&#039; compete for control of the robot. Each behavioural layer evaluates its sensory input and determines if it wants to control the outputs (to change its input according to its (implied) goal, e.g. mechanoreceptors (microswitches) will only request control if the switch is closed. After all the behavioural levels are evaluated, and their request flags set or reset an arbitrate routine  selects the highest active layer that will run the robot behaviorual output for the next 50 msec.&lt;br /&gt;
:::See Anderson (2007) for a clear explanations and actual implementation examples.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Brain subsystems&#039;&#039;&#039;&lt;br /&gt;
:::More complicated or slow tasks (like sound processing or US echo detection) can be executed in separate processor boards that report their status  to the main  controller. Conceptually this is not different from subroutines for tasks.&lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Nervous system&#039;&#039;&#039;&lt;br /&gt;
::: The currently (sort of) running implementation of the brain is using a real time loop in a very simple cooperative multitasking system ([https://yiweimao.github.io/blog/async_microcontroller/ YiweiMao scheduler]) and inmplemented on an Arduino Uno &lt;br /&gt;
::: &#039;&#039;Development status: operational, but under active development.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Associative memory&#039;&#039;&#039;&lt;br /&gt;
::: Associative memory in it current, simplest form will be implemented as memory locations for particular sensory input combinations.  inputs that coincide increase a counter for that combination (learning those combinations). This allows both Pawlow  and operand conditioning.&lt;br /&gt;
:::&#039;&#039;Development status: not yet implemented, proof of concept done ~50 years ago :).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Excitation state and hormones&#039;&#039;&#039;&lt;br /&gt;
::: Hormones are internal variables with levels that act as slow changing memory for previous (combinations of) states.&lt;br /&gt;
::: A default breakdown speed can be set that slowly decrease hormone levels. Particular sensory input could increase the levels again. Reaching high levels of certain hormones can be a goal in itself, and subject to learning behaviour.&lt;br /&gt;
::: &#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Satisfaction&#039;&#039;&#039;&lt;br /&gt;
:::Signals to end feeding behaviour can -in addition to electrical food running out- also come from internal signals (satiation, internal hormonal signals, (too) long time periods with little change of events)&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Future prediction&#039;&#039;&#039;&lt;br /&gt;
:::This is currently way out of scope, but neural-net like implementations that store event sequences, predict likely outcomes of current inputs and act accordingly are fully feasible.&lt;br /&gt;
::: See Rickenbacher 1975 for an example that is probably  a bit more traceable than -for instance- modern neural network code like Tensorflow. &lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Effectors ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;main motors&#039;&#039;&#039;&lt;br /&gt;
:::The main moves of the organism are implemented by two wheels driven by two [https://leaphy.store/product/tt-motor-10cm-jumper-female/ DC motors] with build in gearboxes) and a [https://leaphy.store/product/motor-shield/ motor shield]. Motor speed is controlled by pulse width modualation (PMW)) present in the processor. Steering is done by differential motorspeed, a third backside &amp;quot;wheel&amp;quot; is a simple short passive wooden stand. This works well on reasonable flat surfaces, but needs improvement is the next robot (Terzo).&lt;br /&gt;
:::&#039;&#039;Motor development status: Operational at a basic level, PID control and extra power at startup to get smooth startup at low speed is needed.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Movable mouthparts&#039;&#039;&#039;&lt;br /&gt;
:::Appendages like extendable mouthparts controlled by [https://isking-modellbahn.de/modelcraft-es-030-Servo-top-line-steuerelektronik servo]&#039;s can be used for feeding on electrical food. Currently one servo controlling a proboscis (mouthpart for feeding) is present.&lt;br /&gt;
:::&#039;&#039;Development status: Operational in priciple, untested in practice, needs 3D printing of parts&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;[https://leaphy.store/product/rgb-led-single/ Three colour led]&#039;&#039;&#039;&lt;br /&gt;
::: can be used for signaling status of whatever state we want.&lt;br /&gt;
:::&#039;&#039;Development status: Operational &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Piezo beeper &#039;&#039;&#039;&lt;br /&gt;
::: Present on the [https://leaphy.store/product/motor-shield/ motor shield] can be used to create a variety of sounds,for instance to signal happines, distress or alarm.&lt;br /&gt;
:::&#039;&#039;Development status: Operational, but specific sounds need to be designed&lt;br /&gt;
&lt;br /&gt;
== Behavioural levels ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:: Behaviour in subsumption architecture is organised in levels that compete for control, the highest priority behaviour (lowest rank, top of list) will control the robot for 50 msec.&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Overview of current behavioral levels and  their most important inputs for controlling requests&#039;&#039;&#039;. &lt;br /&gt;
:::Layers are only a naming convention, conceptually grouping behaviour with somewhat similar aims. Note that the ultimate goals of the system (here level SLEEP, see below) is determined by the order of the levels. Changing the order evidently will change the behavioural outcomes.  Currently the order is hard coded.&lt;br /&gt;
&lt;br /&gt;
:::High priority behavioural levels take care of the most basic and critical task. When their goals are reached (their requests for control stop), higher behavioural levels, (representing more advanced lower priority tasks will be able to run. Note however that higher levels can explicitly inhibit or even modify lower level behaviours under some circumstances for some time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
::See the actual calls for details.&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;Layer &amp;quot;distress&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::If unable to meet the absolute basic requirement for battery voltage or movement CALL for help. In STUCK, try reflexes to get loose, pause regular. If nothing works eventually HIBERNATE &lt;br /&gt;
&lt;br /&gt;
::::Goal:  deal with the really difficult situations &lt;br /&gt;
::::0  HIBERNATE // hope for better times...&lt;br /&gt;
::::1  STUCK // try to solve non-movement when motors run...&lt;br /&gt;
::::2  CALL  // call for help&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;stay free&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::The primary sensory input activating this level are Bumper sensors and Ultrasonics, but also hormones for high emotional levels reached by an overload of sensory input or a high number of failing tries to reach some goal. FREEZE will stop movement for an serious amount of time to reduce overload FIGHT will move quickly forward and get very close to an object possibly even disregarding US and bumpers and hitting the object. ESCAPE will try to free the bumpers EVADE will try to keep a safe distance from objects. FLIGHT will try to run straight for a relative long time (using a countdown timer) but will subsumed by lower levels.&lt;br /&gt;
&lt;br /&gt;
::::Goal: avoid stressors. &lt;br /&gt;
::::3  FREEZE  // simulated dead&lt;br /&gt;
::::4  FIGHT   // try to intimidate &lt;br /&gt;
::::5  ESCAPE  // escape from touch&lt;br /&gt;
::::6  EVADE   // keep distance&lt;br /&gt;
::::7  FLIGHT  // run away  &lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;external control&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::This level is only requesting control if external commands are present in sensordata. The behaviour is self-reinforcing so once activated it keeps controlling the creature as long as new commands arrive within reasonable time. Note that Escape and Evade and Flight have priority, manual control has limits, the creature is autonomous!&lt;br /&gt;
&lt;br /&gt;
::::Goals: Stay free and prevent distress, but otherwise otherwise obey external commands.&lt;br /&gt;
::::8 MANUAL // How boring...&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;scan and move&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::This level is the heart of the brain. Reaching the first level of this layer (INTEGRATE) is rewarding. :::Everything is (locally) under control and a target goal can been set. This will also increase positive emotional level. INTEGRATE will inspect internal status, like battery level, and emotional states like exhaustion, excitatory state and modify the settings for ORIENT and MOVE accordingly. Options for ORIENTs setting are for instance random turn angles and low speed  for a drunkard&#039;s walk, phototaxis (pos. or neg.), odour pulse count or interval for kinesis behaviour, and PIR input (i. e. human or robot) presence for more interactive behaviour. After this setting, INTEGRATE will inhibit the setting of the the INTEGRATE request flag for some time. Input from rotary encoders and/or motor commands) will re-trigger this inhibition of INTEGRATE so rotate and Orient can work. ROTATE will rotate around the body center until some sensory dead zone for the current target (just picked by INTEGRATE is reached. Move will drive forward and (together with ORIENT) allow the creature to move in the direction of the goal implied by ORIENT. ACCEPT checks sensory input for an acceptable stop position that might have food or a high quality resource. ACCEPT will increase positive emotional levels. FEED will become active when food is indeed available available, for instance, via bottom contacts and feeding will increase positive emotional levels even more.&lt;br /&gt;
&lt;br /&gt;
::::Goal: find out where and when and how to move and set a goal&lt;br /&gt;
::::9 INTEGRATE // combine inputs and decide what to do at this moment.&lt;br /&gt;
::::10 ORIENT // orient towards the current goal&lt;br /&gt;
::::11 MOVE // move forward towards the current goal&lt;br /&gt;
::::12 ACCEPT // accept the current position and stop&lt;br /&gt;
::::13 FEED // electrical food is the best!&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;appendage use&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::Not all accepted position will directly allow access to resources like a voltage source, or an object to collect. EXTEND will try to reach the resource by (surprise) extending an appendage. PROBE will conduct a local search for the resource, and USE will get or enjoy the resource.&lt;br /&gt;
&lt;br /&gt;
::::Goal: reach a high quality resource by extending an appendage&lt;br /&gt;
::::14  EXTEND // reach for a resource&lt;br /&gt;
::::15 PROBE // probe to make contact&lt;br /&gt;
::::16 USE // this is sooo good!&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;interaction&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::EXPLORE will search for fun, however that is defined at that moment, it might mean going back to some other location to drop a collected object. For more social tasks, it might be finding something or somebody to make contact with. When EXPLORE is successful and switches its request flag off, INTERACT will control the interactive behaviour performed. Both these levels may modify the inputs for the SCAN layer to keep focus. Interact will however also increase exhaustion that eventually will prevent allow SEEKREST to become active.&lt;br /&gt;
&lt;br /&gt;
::::Goal: if all previous goals were reached this is the final goal setting layer&lt;br /&gt;
::::17 EXPLORE // find the fun&lt;br /&gt;
::::18 INTERACT // and love it!&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;rest&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::All fun comes to and end, when exhaustion strikes many higher priority levels that monitor exhaustion levels will become inactive and SEEKREST will modify the the scan layer and the the goal to finding a suitable location to rest. If a suitable location is found SLEEP will get active and stay active until sensory input changes again. At that point it is rinse and repeat.&lt;br /&gt;
&lt;br /&gt;
::::Goal: reduce exhaustion, find a location to rest and sleep there.&lt;br /&gt;
::::19 SEEKREST // after hard work...&lt;br /&gt;
::::20 SLEEP // ... it is time to sleep!&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;default&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::If non of the other levels asks for control WAIT (that always requests control) switches off all motors, reduces power use as much as possible, and waits for input. This is &#039;&#039;never&#039;&#039; expected to happen!&lt;br /&gt;
&lt;br /&gt;
::::Goal: wait for input&lt;br /&gt;
::::21 WAIT // default, always requesting but never getting it... &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;Stay tuned, more comming soon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Implementation details ==&lt;br /&gt;
: &#039;&#039;Stay tuned, more comming soon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Anderson, D.P. (2007)&#039;&#039;&#039; https://www.dprg.org/articles/2007-03a/&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Bettosini et al., 2022&#039;&#039;&#039; Torocó: A Subsumption Architecture Implementation, in: 2022 8th International Conference on Automation, Robotics and Applications (ICARA) IEEE, Prague, Czech Republic, pp. 27–32. . https://doi.org/10.1109/ICARA55094.2022.9738521&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Brooks, R.A. (1986)&#039;&#039;&#039; A Robust Layer Control System for a Mobile Robot, IEEE Journal of Robotics and Automation RA-2, 14-23&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Rickenbacher (1975)&#039;&#039;&#039; Lernen und Motivation als relevanzgesteuerte Datenverarbeitung: Ein Computer-Simulationsmodell elementarer kognitiv-affektiver Prozesse. Birkhäuser Verag Basel.&lt;/div&gt;</summary>
		<author><name>Peterr</name></author>
	</entry>
	<entry>
		<id>https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15309</id>
		<title>Leaphy Robot</title>
		<link rel="alternate" type="text/html" href="https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15309"/>
		<updated>2025-10-01T21:52:07Z</updated>

		<summary type="html">&lt;p&gt;Peterr: /* Behavioural levels */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Name=Leaphy robot with subsumption architecture&lt;br /&gt;
|Skills=software hardware electronics biology&lt;br /&gt;
|Status=Active&lt;br /&gt;
|Niche=robotics&lt;br /&gt;
|Purpose=Fun&lt;br /&gt;
|Picture=Leaphy back side view.jpg&lt;br /&gt;
|Tool=No&lt;br /&gt;
|Location=Space, home&lt;br /&gt;
|Cost=Very small given what is already present and what is available in the space (everything!!)&lt;br /&gt;
|Category=Electronics&lt;br /&gt;
}}&lt;br /&gt;
== Electronic insect-like creature ==&lt;br /&gt;
&#039;&#039;&#039;Physiological, Behavioural and environmental overview&#039;&#039;&#039; &amp;lt;br&amp;gt;&lt;br /&gt;
peterr 2022- 2025 (with &#039;&#039;very&#039;&#039; long pauses)&lt;br /&gt;
&lt;br /&gt;
====Document history====&lt;br /&gt;
* Currently this is a living document and this wiki contains the latest version&lt;br /&gt;
* September 2025 subsumption architecture design &amp;amp; transfer to nurdspace wiki&lt;br /&gt;
* August    2025 Documentation for scheduler&lt;br /&gt;
* March     2023 Draft version 0.2  - terminology cleanup and scope&lt;br /&gt;
* November  2022 First document sketches &amp;amp; ideas&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project==&lt;br /&gt;
The insect like creature based on the original [https://leaphy.store/product/leaphy-original-los/ leaphyrobot] has a set of functionalities that together allow it to effectively find, and feed on targets that provides electricity as a reward.&lt;br /&gt;
Learning strategies to improve success rate can be implemented.&lt;br /&gt;
Sexual signaling, event prediction, mating behaviour, genetic exchange and evolution are in principle possible but are currently still (far) out of scope. The system at it&#039;s highest level can be seen as a feedback loop: sensory input =&amp;gt; behavioural selection =&amp;gt; motor output =&amp;gt; new sensory input. The original design (2022) was meant to live in wind tunnel, and find odour sources to feed, but currently the emphasis has shifted from odour detection to more general sensory processing using subsumption architecture, [https://nurdspace.nl/Leaphy_Robot#Brain see below].&lt;br /&gt;
&lt;br /&gt;
== Sensory inputs ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Mechanoreceptor - sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
:::Micro switch based tactile hairs. &lt;br /&gt;
:::&#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Ultrasound - Distance sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
::: Ultrasonic pulses detect obstacles and trigger reflex avoidance behaviour&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Better directional responses would be possible with more than one US sensor. &lt;br /&gt;
:::: This would need a dedicated embedded processor. &lt;br /&gt;
:::: &#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing light intensity&#039;&#039;&#039;&lt;br /&gt;
::: Two LDR photoreceptors measure front-left light level and front-right light level&lt;br /&gt;
::: Total light intensity (sum) is available as an analog voltage&lt;br /&gt;
::: The difference between the inputs is also available, and signals what side to turn to, to approach or avoid the light.&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing sound (audio)&#039;&#039;&#039;&lt;br /&gt;
::: A subunit with its own processor, containing an Electret microphone to measure ambiant sound level, frequency and sound patterns. &lt;br /&gt;
::: Can be used in classical (Pawlow) and operand conditioning experiments. Will detect both absolute sound levels (for startle or avoidance responses) and can contain feature detectors (e.g. chirp intervals for leaf hopper like  communication and courting  behaviour of two leaphy&#039;s).  &lt;br /&gt;
::: In addition, an Audeme Movi speech recognition shield (see https://www.audeme.com/movi.html) could be used to process voice commands&lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented, but Movi shield &amp;quot;proof of concept&amp;quot; done&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;PIR movement sensor&#039;&#039;&#039;&lt;br /&gt;
::: In addition to light intensity, an infra red motion sensors can be used to detect movements (humans, or the cat for that matter) see for instance https://www.adafruit.com/product/4871 &lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented but PIR (similar to the adafruit thingy) available&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Sensing wind direction &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based tactile hairs?  Something like https://www.instructables.com/Low-Cost-Low-Speed-Wind-Sensor-1/ with shielding? or sensitive temperature measurements?&lt;br /&gt;
:::; Note: Wind direction sensing in the wind tunnel is currently replaced by sensing light gradients parallel to the wind direction because the wind sensor is not available yet. &lt;br /&gt;
:::: &#039;&#039;Development status: To be designed, high priority for the windtunnel version with odour processing as a main goal, low priority for the a free walking space/nurdspace version described here.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Volatiles (odours) &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based perception of volatiles like alcohol (fruit-fly like behaviours), Carbon dioxide (mosquito like behaviour), or VOC&#039;s (most plant eating insects). The sensor produces a voltage level proportional to the intensity of the stimulus. Using a threshold can generate a presence/absence signal. &lt;br /&gt;
::: The interval between odour pulses is a proxy for the distance to the source. Note that an odour &amp;quot;gradient&amp;quot; does not exist!&lt;br /&gt;
&lt;br /&gt;
::: Current implementation uses a SGP30 board. The time constant of the the sensor is in the order of 1 second, but &amp;quot;whiffs&amp;quot; of odour could be detected faster by using a feature detector that looks for sudden steps in the signal. This will also act as an sensory adaptation mechanism: in the absence of change the output go&#039;s to zero.&lt;br /&gt;
::: &#039;&#039;Development status: Sensor: worked, currently broken&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground color&#039;&#039;&#039;&lt;br /&gt;
::: This sensor measures ground colour and the output can be used to test for a particular condition (e.g. being at a target position). It can also be used to simulate trail pheromones implemented as colors next to the  trail followed. This sense can also take the role of short distance &amp;quot; present at target&amp;quot; stimuli.&lt;br /&gt;
::: &#039;&#039; Development status: Operational &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground reflection level&#039;&#039;&#039;&lt;br /&gt;
::: Two sensors &#039;line followers&#039; that both provide a binary present/absent signal of ground reflection.&lt;br /&gt;
::: Can be used to simulate trail following behaviour on a network of lines  (combined with (led) ground colours.&lt;br /&gt;
::: &#039;&#039;Development status: testing phase&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Future extensions: A combination of voltage levels and pulse frequency coding in the source could be used to simulate a spectrum of &amp;quot;chemical&amp;quot; inputs.  &lt;br /&gt;
:::: Feature detectors could extract particular frequencies and/or patterns to recognise for instance &amp;quot;&#039;&#039;toxic&#039;&#039;&amp;quot; substances. &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Proprioception (internal &amp;quot;feeling&amp;quot;)&#039;&#039;&#039;&lt;br /&gt;
::: Checking for instance for body movement when motors move, or for force feedback when extending electrical honey sucking mouthparts&lt;br /&gt;
::: Development status:To be developed, as yet low priority. &lt;br /&gt;
 &lt;br /&gt;
:: &#039;&#039;&#039;Sensing internal physiological states &#039;&#039;&#039;&lt;br /&gt;
:::To place electric reward information in perspective, some internal status information is needed, that is supplied by reading internal variables like energy levels (battery voltage , load current) or physiological state (internal variables like &amp;quot;ready to feed&amp;quot;. &lt;br /&gt;
::: More advances implementations could look up previous experiences, and rate of change in physiological status as well as brain hormone levels and excitation states (see below under internal states and hormones&amp;quot;).&lt;br /&gt;
:::Development status: To be designed.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing hormone levels&#039;&#039;&#039;&lt;br /&gt;
::: Certain activities or combinations of activities can stimulate the production of hormones. This could be implemented as slow changing values in memory. Hormone levels might modulate the effect of sensory input or behavioural output, and act as a slow form of memory.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing rewards and deterrents&#039;&#039;&#039;&lt;br /&gt;
::: Electronic organisms live on electricity, and are rewarded by sensing the presence of a voltage and current. This sensory organ is just sensing the analog voltage measured by the sensory organ. It simulates the perception of food such as nectar. Most logical position is at the tip of an appendage. &lt;br /&gt;
::: &#039;&#039;Development status: implemented and removed (needs mutiplexing). Mechanical movement (servo) to make electrical contact: testing phase.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Brain ==&lt;br /&gt;
::&#039;&#039;&#039;Subsumption architecture&#039;&#039;&#039;&lt;br /&gt;
:::The Electronic organisms has a software brain that receives sensory input both from the environment and internal status. The brain reads all inputs about every 50 msec, and produces command for actuators that produce behaviour. These behaviours can be as simple as a colour changes of a led (signaling sensory status) or movements of body and body and appendages. The aim is to make the lower levels as stateless as possible i.e. the brain uses its real time vision of the word as a model instead of some abstract internal representation. The processing principle roughly follow the subsumption architecture (Brooks 1986).&lt;br /&gt;
&lt;br /&gt;
:::Wikipedia writes about this technique:&lt;br /&gt;
::::&amp;quot;&#039;&#039;[Behaviours] are organized into a hierarchy of layers. Each layer implements a particular level of behavioral competence, and higher levels are able to subsume lower levels (= integrate/combine lower levels to a more comprehensive whole) in order to create viable behavior. For example, a robot&#039;s lowest layer could be &amp;quot;avoid an object&amp;quot;. The second layer would be &amp;quot;wander around&amp;quot;, which runs beneath the third layer &amp;quot;explore the world&amp;quot;.[...]The subsumption architecture creates a system in which the higher layers utilize the lower-level competencies. The layers, which all receive sensor-information, work in parallel and generate outputs. These outputs can be commands to actuators, or signals that suppress or inhibit other layers.&amp;quot;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::My current implementation uses the opposite order. The high priority levels conduct the simplest behavioural tasks, and when these high priority but simple behavioural levels are happy more complex task can get control. This approach is still experimental, but in any case easy enough to reverse again.&lt;br /&gt;
&lt;br /&gt;
:::The behavioural levels &#039;&#039;all&#039;&#039; compete for control of the robot. Each behavioural layer evaluates its sensory input and determines if it wants to control the outputs (to change its input according to its (implied) goal, e.g. mechanoreceptors (microswitches) will only request control if the switch is closed. After all the behavioural levels are evaluated, and their request flags set or reset an arbitrate routine  selects the highest active layer that will run the robot behaviorual output for the next 50 msec.&lt;br /&gt;
:::See Anderson (2007) for a clear explanations and actual implementation examples.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Brain subsystems&#039;&#039;&#039;&lt;br /&gt;
:::More complicated or slow tasks (like sound processing or US echo detection) can be executed in separate processor boards that report their status  to the main  controller. Conceptually this is not different from subroutines for tasks.&lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Nervous system&#039;&#039;&#039;&lt;br /&gt;
::: The currently (sort of) running implementation of the brain is using a real time loop in a very simple cooperative multitasking system ([https://yiweimao.github.io/blog/async_microcontroller/ YiweiMao scheduler]) and inmplemented on an Arduino Uno &lt;br /&gt;
::: &#039;&#039;Development status: operational, but under active development.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Associative memory&#039;&#039;&#039;&lt;br /&gt;
::: Associative memory in it current, simplest form will be implemented as memory locations for particular sensory input combinations.  inputs that coincide increase a counter for that combination (learning those combinations). This allows both Pawlow  and operand conditioning.&lt;br /&gt;
:::&#039;&#039;Development status: not yet implemented, proof of concept done ~50 years ago :).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Excitation state and hormones&#039;&#039;&#039;&lt;br /&gt;
::: Hormones are internal variables with levels that act as slow changing memory for previous (combinations of) states.&lt;br /&gt;
::: A default breakdown speed can be set that slowly decrease hormone levels. Particular sensory input could increase the levels again. Reaching high levels of certain hormones can be a goal in itself, and subject to learning behaviour.&lt;br /&gt;
::: &#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Satisfaction&#039;&#039;&#039;&lt;br /&gt;
:::Signals to end feeding behaviour can -in addition to electrical food running out- also come from internal signals (satiation, internal hormonal signals, (too) long time periods with little change of events)&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Future prediction&#039;&#039;&#039;&lt;br /&gt;
:::This is currently way out of scope, but neural-net like implementations that store event sequences, predict likely outcomes of current inputs and act accordingly are fully feasible.&lt;br /&gt;
::: See Rickenbacher 1975 for an example that is probably  a bit more traceable than -for instance- modern neural network code like Tensorflow. &lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Effectors ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;main motors&#039;&#039;&#039;&lt;br /&gt;
:::The main moves of the organism are implemented by two wheels driven by two [https://leaphy.store/product/tt-motor-10cm-jumper-female/ DC motors] with build in gearboxes) and a [https://leaphy.store/product/motor-shield/ motor shield]. Motor speed is controlled by pulse width modualation (PMW)) present in the processor. Steering is done by differential motorspeed, a third backside &amp;quot;wheel&amp;quot; is a simple short passive wooden stand. This works well on reasonable flat surfaces, but needs improvement is the next robot (Terzo).&lt;br /&gt;
:::&#039;&#039;Motor development status: Operational at a basic level, PID control and extra power at startup to get smooth startup at low speed is needed.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Movable mouthparts&#039;&#039;&#039;&lt;br /&gt;
:::Appendages like extendable mouthparts controlled by [https://isking-modellbahn.de/modelcraft-es-030-Servo-top-line-steuerelektronik servo]&#039;s can be used for feeding on electrical food. Currently one servo controlling a proboscis (mouthpart for feeding) is present.&lt;br /&gt;
:::&#039;&#039;Development status: Operational in priciple, untested in practice, needs 3D printing of parts&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;[https://leaphy.store/product/rgb-led-single/ Three colour led]&#039;&#039;&#039;&lt;br /&gt;
::: can be used for signaling status of whatever state we want.&lt;br /&gt;
:::&#039;&#039;Development status: Operational &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Piezo beeper &#039;&#039;&#039;&lt;br /&gt;
::: Present on the [https://leaphy.store/product/motor-shield/ motor shield] can be used to create a variety of sounds,for instance to signal happines, distress or alarm.&lt;br /&gt;
:::&#039;&#039;Development status: Operational, but specific sounds need to be designed&lt;br /&gt;
&lt;br /&gt;
== Behavioural levels ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:: Behaviour in subsumption architecture is organised in levels that compete for control, the highest priority behaviour (lowest rank, top of list) will control the robot for 50 msec.&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Overview of current behavioral levels and  their most important inputs for controlling requests&#039;&#039;&#039;. &lt;br /&gt;
:::Layers are only a naming convention, conceptually grouping behaviour with somewhat similar aims. Note that the ultimate goals of the system (here level SLEEP, see below) is determined by the order of the levels. Changing the order evidently will change the behavioural outcomes.  Currently the order is hard coded.&lt;br /&gt;
&lt;br /&gt;
:::High priority behavioural levels take care of the most basic and critical task. When their goals are reached (their requests for control stop), higher behavioural levels, (representing more advanced lower priority tasks will be able to run. Note however that higher levels can explicitly inhibit or even modify lower level behaviours under some circumstances for some time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
::See the actual calls for details.&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;Layer &amp;quot;distress&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::If unable to meet the absolute basic requirement for battery voltage or movement CALL for help. In STUCK, try reflexes to get loose, pause regular. If nothing works eventually HIBERNATE &lt;br /&gt;
&lt;br /&gt;
::::Goal:  deal with the really difficult situations &lt;br /&gt;
::::0  HIBERNATE // hope for better times...&lt;br /&gt;
::::1  STUCK // try to solve non-movement when motors run...&lt;br /&gt;
::::2  CALL  // call for help&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;stay free&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::The primary sensory input activating this level are Bumper sensors and Ultrasonics, but also hormones for high emotional levels reached by an overload of sensory input or a high number of failing tries to reach some goal. FREEZE will stop movement for an serious amount of time to reduce overload FIGHT will move quickly forward and get very close to an object possibly even disregarding US and bumpers and hitting the object. ESCAPE will try to free the bumpers EVADE will try to keep a safe distance from objects. FLIGHT will try to run straight for a relative long time (using a countdown timer) but will subsumed by lower levels.&lt;br /&gt;
&lt;br /&gt;
::::Goal: avoid stressors. &lt;br /&gt;
::::3  FREEZE  // simulated dead&lt;br /&gt;
::::4  FIGHT   // try to intimidate &lt;br /&gt;
::::5  ESCAPE  // escape from touch&lt;br /&gt;
::::6  EVADE   // keep distance&lt;br /&gt;
::::7  FLIGHT  // run away  &lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;external control&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::This level is only requesting control if external commands are present in sensordata. The behaviour is self-reinforcing so once activated it keeps controlling the creature as long as new commands arrive within reasonable time. Note that Escape and Evade and Flight have priority, manual control has limits, the creature is autonomous!&lt;br /&gt;
&lt;br /&gt;
::::Goals: Stay free and prevent distress, but otherwise otherwise obey external commands.&lt;br /&gt;
::::8 MANUAL // How boring...&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;scan and move&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::This level is the heart of the brain. Reaching the first level of this layer (INTEGRATE) is rewarding. :::Everything is (locally) under control and a target goal can been set. This will also increase positive emotional level. INTEGRATE will inspect internal status, like battery level, and emotional states like exhaustion, excitatory state and modify the settings for ORIENT and MOVE accordingly. Options for ORIENTs setting are for instance random turn angles and low speed  for a drunkard&#039;s walk, phototaxis (pos. or neg.), odour pulse count or interval for kinesis behaviour, and PIR input (i. e. human or robot) presence for more interactive behaviour. After this setting, INTEGRATE will inhibit the setting of the the INTEGRATE request flag for some time. Input from rotary encoders and/or motor commands) will re-trigger this inhibition of INTEGRATE so rotate and Orient can work. ROTATE will rotate around the body center until some sensory dead zone for the current target (just picked by INTEGRATE is reached. Move will drive forward and (together with ORIENT) allow the creature to move in the direction of the goal implied by ORIENT. ACCEPT checks sensory input for an acceptable stop position that might have food or a high quality resource. ACCEPT will increase positive emotional levels. FEED will become active when food is indeed available available, for instance, via bottom contacts and feeding will increase positive emotional levels even more.&lt;br /&gt;
&lt;br /&gt;
::::Goal: find out where and when and how to move and set a goal&lt;br /&gt;
::::9 INTEGRATE // combine inputs and decide what to do at this moment.&lt;br /&gt;
::::10 ORIENT // orient towards the current goal&lt;br /&gt;
::::11 MOVE // move forward towards the current goal&lt;br /&gt;
::::12 ACCEPT // accept the current position and stop&lt;br /&gt;
::::13 FEED // electrical food is the best!&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;appendage use&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::Not all accepted position will directly allow access to resources like a voltage source, or an object to collect. EXTEND will try to reach the resource by (surprise) extending an appendage. PROBE will conduct a local search for the resource, and USE will get or enjoy the resource.&lt;br /&gt;
&lt;br /&gt;
::::Goal: reach a high quality resource by extending an appendage&lt;br /&gt;
::::14  EXTEND // reach for a resource&lt;br /&gt;
::::15 PROBE // probe to make contact&lt;br /&gt;
::::16 USE // this is sooo good!&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;interaction&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::EXPLORE will search for fun, however that is defined at that moment, it might mean going back to some other location to drop a collected object. For more social tasks, it might be finding something or somebody to make contact with. When EXPLORE is successful and switches its request flag off, INTERACT will control the interactive behaviour performed. Both these levels may modify the inputs for the SCAN layer to keep focus. Interact will however also increase exhaustion that eventually will prevent allow SEEKREST to become active.&lt;br /&gt;
&lt;br /&gt;
::::Goal: if all previous goals were reached this is the final goal setting layer&lt;br /&gt;
::::17 EXPLORE // find the fun&lt;br /&gt;
::::18 INTERACT // and love it!&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;rest&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::All fun comes to and end, when exhaustion strikes many higher priority levels that monitor exhaustion levels will become inactive and SEEKREST will modify the the scan layer and the the goal to finding a suitable location to rest. If a suitable location is found SLEEP will get active and stay active until sensory input changes again. At that point it is rinse and repeat.&lt;br /&gt;
&lt;br /&gt;
::::Goal: reduce exhaustion, find a location to rest and sleep there.&lt;br /&gt;
::::19 SEEKREST // after hard work...&lt;br /&gt;
::::20 SLEEP // ... it is time to sleep!&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;default&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::If non of the other levels asks for control WAIT (that always requests control) switches off all motors, reduces power use as much as possible, and waits for input. This is &#039;&#039;never&#039;&#039; expected to happen!&lt;br /&gt;
&lt;br /&gt;
::::Goal: wait for input&lt;br /&gt;
::::21 WAIT // default, always requesting but never getting it... &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;Stay tuned, more comming soon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Implementation details ==&lt;br /&gt;
: &#039;&#039;Stay tuned, more comming soon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Anderson, D.P. (2007)&#039;&#039;&#039; https://www.dprg.org/articles/2007-03a/&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Bettosini et al., 2022&#039;&#039;&#039; Torocó: A Subsumption Architecture Implementation, in: 2022 8th International Conference on Automation, Robotics and Applications (ICARA) IEEE, Prague, Czech Republic, pp. 27–32. . https://doi.org/10.1109/ICARA55094.2022.9738521&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Brooks, R.A. (1986)&#039;&#039;&#039; A Robust Layer Control System for a Mobile Robot, IEEE Journal of Robotics and Automation RA-2, 14-23&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Rickenbacher (1975)&#039;&#039;&#039; Lernen und Motivation als relevanzgesteuerte Datenverarbeitung: Ein Computer-Simulationsmodell elementarer kognitiv-affektiver Prozesse. Birkhäuser Verag Basel.&lt;/div&gt;</summary>
		<author><name>Peterr</name></author>
	</entry>
	<entry>
		<id>https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15308</id>
		<title>Leaphy Robot</title>
		<link rel="alternate" type="text/html" href="https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15308"/>
		<updated>2025-10-01T21:51:38Z</updated>

		<summary type="html">&lt;p&gt;Peterr: /* Behavioural levels */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Name=Leaphy robot with subsumption architecture&lt;br /&gt;
|Skills=software hardware electronics biology&lt;br /&gt;
|Status=Active&lt;br /&gt;
|Niche=robotics&lt;br /&gt;
|Purpose=Fun&lt;br /&gt;
|Picture=Leaphy back side view.jpg&lt;br /&gt;
|Tool=No&lt;br /&gt;
|Location=Space, home&lt;br /&gt;
|Cost=Very small given what is already present and what is available in the space (everything!!)&lt;br /&gt;
|Category=Electronics&lt;br /&gt;
}}&lt;br /&gt;
== Electronic insect-like creature ==&lt;br /&gt;
&#039;&#039;&#039;Physiological, Behavioural and environmental overview&#039;&#039;&#039; &amp;lt;br&amp;gt;&lt;br /&gt;
peterr 2022- 2025 (with &#039;&#039;very&#039;&#039; long pauses)&lt;br /&gt;
&lt;br /&gt;
====Document history====&lt;br /&gt;
* Currently this is a living document and this wiki contains the latest version&lt;br /&gt;
* September 2025 subsumption architecture design &amp;amp; transfer to nurdspace wiki&lt;br /&gt;
* August    2025 Documentation for scheduler&lt;br /&gt;
* March     2023 Draft version 0.2  - terminology cleanup and scope&lt;br /&gt;
* November  2022 First document sketches &amp;amp; ideas&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project==&lt;br /&gt;
The insect like creature based on the original [https://leaphy.store/product/leaphy-original-los/ leaphyrobot] has a set of functionalities that together allow it to effectively find, and feed on targets that provides electricity as a reward.&lt;br /&gt;
Learning strategies to improve success rate can be implemented.&lt;br /&gt;
Sexual signaling, event prediction, mating behaviour, genetic exchange and evolution are in principle possible but are currently still (far) out of scope. The system at it&#039;s highest level can be seen as a feedback loop: sensory input =&amp;gt; behavioural selection =&amp;gt; motor output =&amp;gt; new sensory input. The original design (2022) was meant to live in wind tunnel, and find odour sources to feed, but currently the emphasis has shifted from odour detection to more general sensory processing using subsumption architecture, [https://nurdspace.nl/Leaphy_Robot#Brain see below].&lt;br /&gt;
&lt;br /&gt;
== Sensory inputs ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Mechanoreceptor - sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
:::Micro switch based tactile hairs. &lt;br /&gt;
:::&#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Ultrasound - Distance sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
::: Ultrasonic pulses detect obstacles and trigger reflex avoidance behaviour&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Better directional responses would be possible with more than one US sensor. &lt;br /&gt;
:::: This would need a dedicated embedded processor. &lt;br /&gt;
:::: &#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing light intensity&#039;&#039;&#039;&lt;br /&gt;
::: Two LDR photoreceptors measure front-left light level and front-right light level&lt;br /&gt;
::: Total light intensity (sum) is available as an analog voltage&lt;br /&gt;
::: The difference between the inputs is also available, and signals what side to turn to, to approach or avoid the light.&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing sound (audio)&#039;&#039;&#039;&lt;br /&gt;
::: A subunit with its own processor, containing an Electret microphone to measure ambiant sound level, frequency and sound patterns. &lt;br /&gt;
::: Can be used in classical (Pawlow) and operand conditioning experiments. Will detect both absolute sound levels (for startle or avoidance responses) and can contain feature detectors (e.g. chirp intervals for leaf hopper like  communication and courting  behaviour of two leaphy&#039;s).  &lt;br /&gt;
::: In addition, an Audeme Movi speech recognition shield (see https://www.audeme.com/movi.html) could be used to process voice commands&lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented, but Movi shield &amp;quot;proof of concept&amp;quot; done&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;PIR movement sensor&#039;&#039;&#039;&lt;br /&gt;
::: In addition to light intensity, an infra red motion sensors can be used to detect movements (humans, or the cat for that matter) see for instance https://www.adafruit.com/product/4871 &lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented but PIR (similar to the adafruit thingy) available&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Sensing wind direction &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based tactile hairs?  Something like https://www.instructables.com/Low-Cost-Low-Speed-Wind-Sensor-1/ with shielding? or sensitive temperature measurements?&lt;br /&gt;
:::; Note: Wind direction sensing in the wind tunnel is currently replaced by sensing light gradients parallel to the wind direction because the wind sensor is not available yet. &lt;br /&gt;
:::: &#039;&#039;Development status: To be designed, high priority for the windtunnel version with odour processing as a main goal, low priority for the a free walking space/nurdspace version described here.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Volatiles (odours) &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based perception of volatiles like alcohol (fruit-fly like behaviours), Carbon dioxide (mosquito like behaviour), or VOC&#039;s (most plant eating insects). The sensor produces a voltage level proportional to the intensity of the stimulus. Using a threshold can generate a presence/absence signal. &lt;br /&gt;
::: The interval between odour pulses is a proxy for the distance to the source. Note that an odour &amp;quot;gradient&amp;quot; does not exist!&lt;br /&gt;
&lt;br /&gt;
::: Current implementation uses a SGP30 board. The time constant of the the sensor is in the order of 1 second, but &amp;quot;whiffs&amp;quot; of odour could be detected faster by using a feature detector that looks for sudden steps in the signal. This will also act as an sensory adaptation mechanism: in the absence of change the output go&#039;s to zero.&lt;br /&gt;
::: &#039;&#039;Development status: Sensor: worked, currently broken&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground color&#039;&#039;&#039;&lt;br /&gt;
::: This sensor measures ground colour and the output can be used to test for a particular condition (e.g. being at a target position). It can also be used to simulate trail pheromones implemented as colors next to the  trail followed. This sense can also take the role of short distance &amp;quot; present at target&amp;quot; stimuli.&lt;br /&gt;
::: &#039;&#039; Development status: Operational &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground reflection level&#039;&#039;&#039;&lt;br /&gt;
::: Two sensors &#039;line followers&#039; that both provide a binary present/absent signal of ground reflection.&lt;br /&gt;
::: Can be used to simulate trail following behaviour on a network of lines  (combined with (led) ground colours.&lt;br /&gt;
::: &#039;&#039;Development status: testing phase&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Future extensions: A combination of voltage levels and pulse frequency coding in the source could be used to simulate a spectrum of &amp;quot;chemical&amp;quot; inputs.  &lt;br /&gt;
:::: Feature detectors could extract particular frequencies and/or patterns to recognise for instance &amp;quot;&#039;&#039;toxic&#039;&#039;&amp;quot; substances. &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Proprioception (internal &amp;quot;feeling&amp;quot;)&#039;&#039;&#039;&lt;br /&gt;
::: Checking for instance for body movement when motors move, or for force feedback when extending electrical honey sucking mouthparts&lt;br /&gt;
::: Development status:To be developed, as yet low priority. &lt;br /&gt;
 &lt;br /&gt;
:: &#039;&#039;&#039;Sensing internal physiological states &#039;&#039;&#039;&lt;br /&gt;
:::To place electric reward information in perspective, some internal status information is needed, that is supplied by reading internal variables like energy levels (battery voltage , load current) or physiological state (internal variables like &amp;quot;ready to feed&amp;quot;. &lt;br /&gt;
::: More advances implementations could look up previous experiences, and rate of change in physiological status as well as brain hormone levels and excitation states (see below under internal states and hormones&amp;quot;).&lt;br /&gt;
:::Development status: To be designed.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing hormone levels&#039;&#039;&#039;&lt;br /&gt;
::: Certain activities or combinations of activities can stimulate the production of hormones. This could be implemented as slow changing values in memory. Hormone levels might modulate the effect of sensory input or behavioural output, and act as a slow form of memory.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing rewards and deterrents&#039;&#039;&#039;&lt;br /&gt;
::: Electronic organisms live on electricity, and are rewarded by sensing the presence of a voltage and current. This sensory organ is just sensing the analog voltage measured by the sensory organ. It simulates the perception of food such as nectar. Most logical position is at the tip of an appendage. &lt;br /&gt;
::: &#039;&#039;Development status: implemented and removed (needs mutiplexing). Mechanical movement (servo) to make electrical contact: testing phase.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Brain ==&lt;br /&gt;
::&#039;&#039;&#039;Subsumption architecture&#039;&#039;&#039;&lt;br /&gt;
:::The Electronic organisms has a software brain that receives sensory input both from the environment and internal status. The brain reads all inputs about every 50 msec, and produces command for actuators that produce behaviour. These behaviours can be as simple as a colour changes of a led (signaling sensory status) or movements of body and body and appendages. The aim is to make the lower levels as stateless as possible i.e. the brain uses its real time vision of the word as a model instead of some abstract internal representation. The processing principle roughly follow the subsumption architecture (Brooks 1986).&lt;br /&gt;
&lt;br /&gt;
:::Wikipedia writes about this technique:&lt;br /&gt;
::::&amp;quot;&#039;&#039;[Behaviours] are organized into a hierarchy of layers. Each layer implements a particular level of behavioral competence, and higher levels are able to subsume lower levels (= integrate/combine lower levels to a more comprehensive whole) in order to create viable behavior. For example, a robot&#039;s lowest layer could be &amp;quot;avoid an object&amp;quot;. The second layer would be &amp;quot;wander around&amp;quot;, which runs beneath the third layer &amp;quot;explore the world&amp;quot;.[...]The subsumption architecture creates a system in which the higher layers utilize the lower-level competencies. The layers, which all receive sensor-information, work in parallel and generate outputs. These outputs can be commands to actuators, or signals that suppress or inhibit other layers.&amp;quot;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::My current implementation uses the opposite order. The high priority levels conduct the simplest behavioural tasks, and when these high priority but simple behavioural levels are happy more complex task can get control. This approach is still experimental, but in any case easy enough to reverse again.&lt;br /&gt;
&lt;br /&gt;
:::The behavioural levels &#039;&#039;all&#039;&#039; compete for control of the robot. Each behavioural layer evaluates its sensory input and determines if it wants to control the outputs (to change its input according to its (implied) goal, e.g. mechanoreceptors (microswitches) will only request control if the switch is closed. After all the behavioural levels are evaluated, and their request flags set or reset an arbitrate routine  selects the highest active layer that will run the robot behaviorual output for the next 50 msec.&lt;br /&gt;
:::See Anderson (2007) for a clear explanations and actual implementation examples.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Brain subsystems&#039;&#039;&#039;&lt;br /&gt;
:::More complicated or slow tasks (like sound processing or US echo detection) can be executed in separate processor boards that report their status  to the main  controller. Conceptually this is not different from subroutines for tasks.&lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Nervous system&#039;&#039;&#039;&lt;br /&gt;
::: The currently (sort of) running implementation of the brain is using a real time loop in a very simple cooperative multitasking system ([https://yiweimao.github.io/blog/async_microcontroller/ YiweiMao scheduler]) and inmplemented on an Arduino Uno &lt;br /&gt;
::: &#039;&#039;Development status: operational, but under active development.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Associative memory&#039;&#039;&#039;&lt;br /&gt;
::: Associative memory in it current, simplest form will be implemented as memory locations for particular sensory input combinations.  inputs that coincide increase a counter for that combination (learning those combinations). This allows both Pawlow  and operand conditioning.&lt;br /&gt;
:::&#039;&#039;Development status: not yet implemented, proof of concept done ~50 years ago :).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Excitation state and hormones&#039;&#039;&#039;&lt;br /&gt;
::: Hormones are internal variables with levels that act as slow changing memory for previous (combinations of) states.&lt;br /&gt;
::: A default breakdown speed can be set that slowly decrease hormone levels. Particular sensory input could increase the levels again. Reaching high levels of certain hormones can be a goal in itself, and subject to learning behaviour.&lt;br /&gt;
::: &#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Satisfaction&#039;&#039;&#039;&lt;br /&gt;
:::Signals to end feeding behaviour can -in addition to electrical food running out- also come from internal signals (satiation, internal hormonal signals, (too) long time periods with little change of events)&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Future prediction&#039;&#039;&#039;&lt;br /&gt;
:::This is currently way out of scope, but neural-net like implementations that store event sequences, predict likely outcomes of current inputs and act accordingly are fully feasible.&lt;br /&gt;
::: See Rickenbacher 1975 for an example that is probably  a bit more traceable than -for instance- modern neural network code like Tensorflow. &lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Effectors ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;main motors&#039;&#039;&#039;&lt;br /&gt;
:::The main moves of the organism are implemented by two wheels driven by two [https://leaphy.store/product/tt-motor-10cm-jumper-female/ DC motors] with build in gearboxes) and a [https://leaphy.store/product/motor-shield/ motor shield]. Motor speed is controlled by pulse width modualation (PMW)) present in the processor. Steering is done by differential motorspeed, a third backside &amp;quot;wheel&amp;quot; is a simple short passive wooden stand. This works well on reasonable flat surfaces, but needs improvement is the next robot (Terzo).&lt;br /&gt;
:::&#039;&#039;Motor development status: Operational at a basic level, PID control and extra power at startup to get smooth startup at low speed is needed.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Movable mouthparts&#039;&#039;&#039;&lt;br /&gt;
:::Appendages like extendable mouthparts controlled by [https://isking-modellbahn.de/modelcraft-es-030-Servo-top-line-steuerelektronik servo]&#039;s can be used for feeding on electrical food. Currently one servo controlling a proboscis (mouthpart for feeding) is present.&lt;br /&gt;
:::&#039;&#039;Development status: Operational in priciple, untested in practice, needs 3D printing of parts&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;[https://leaphy.store/product/rgb-led-single/ Three colour led]&#039;&#039;&#039;&lt;br /&gt;
::: can be used for signaling status of whatever state we want.&lt;br /&gt;
:::&#039;&#039;Development status: Operational &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Piezo beeper &#039;&#039;&#039;&lt;br /&gt;
::: Present on the [https://leaphy.store/product/motor-shield/ motor shield] can be used to create a variety of sounds,for instance to signal happines, distress or alarm.&lt;br /&gt;
:::&#039;&#039;Development status: Operational, but specific sounds need to be designed&lt;br /&gt;
&lt;br /&gt;
== Behavioural levels ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:: Behaviour in subsumption architecture is organised in levels that compete for control, the highest priority behaviour (lowest rank, top of list) will control the robot for 50 msec.&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Overview of current behavioral levels and  their most important inputs for controlling requests&#039;&#039;&#039;. &lt;br /&gt;
:::Layers are only a naming convention, conceptually grouping behaviour with somewhat similar aims. Note that the ultimate goals of the system (here level SLEEP, see below) is determined by the order of the levels. Changing the order evidently will change the behavioural outcomes.  Currently the order is hard coded.&lt;br /&gt;
&lt;br /&gt;
:::High priority behavioural levels take care of the most basic and critical task. When their goals are reached (their requests for control stop), higher behavioural levels, (representing more advanced lower priority tasks will be able to run. Note however that higher levels can explicitly inhibit or even modify lower level behaviours under some circumstances for some time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
::See the actual calls for details.&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;Layer &amp;quot;distress&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::If unable to meet the absolute basic requirement for battery voltage or movement CALL for help. In STUCK, try reflexes to get loose, pause regular. If nothing works eventually HIBERNATE &lt;br /&gt;
&lt;br /&gt;
::::Goal:  deal with the really difficult situations &lt;br /&gt;
::::0  HIBERNATE // hope for better times...&lt;br /&gt;
::::1  STUCK // try to solve non-movement when motors run...&lt;br /&gt;
::::2  CALL  // call for help&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;stay free&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::The primary sensory input activating this level are Bumper sensors and Ultrasonics, but also hormones for high emotional levels reached by an overload of sensory input or a high number of failing tries to reach some goal. FREEZE will stop movement for an serious amount of time to reduce overload FIGHT will move quickly forward and get very close to an object possibly even disregarding US and bumpers and hitting the object. ESCAPE will try to free the bumpers EVADE will try to keep a safe distance from objects. FLIGHT will try to run straight for a relative long time (using a countdown timer) but will subsumed by lower levels.&lt;br /&gt;
&lt;br /&gt;
::::Goal: avoid stressors. &lt;br /&gt;
::::3  FREEZE  // simulated dead&lt;br /&gt;
::::4  FIGHT   // try to intimidate &lt;br /&gt;
::::5  ESCAPE  // escape from touch&lt;br /&gt;
::::6  EVADE   // keep distance&lt;br /&gt;
::::7  FLIGHT  // run away  &lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;external control&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::This level is only requesting control if external commands are present in sensordata. The behaviour is self-reinforcing so once activated it keeps controlling the creature as long as new commands arrive within reasonable time. Note that Escape and Evade and Flight have priority, manual control has limits, the creature is autonomous!&lt;br /&gt;
&lt;br /&gt;
::::Goals: Stay free and prevent distress, but otherwise otherwise obey external commands.&lt;br /&gt;
::::8 MANUAL // How boring...&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;scan and move&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::This level is the heart of the brain. Reaching the first level of this layer (INTEGRATE) is rewarding. :::Everything is (locally) under control and a target goal can been set. This will also increase positive emotional level. INTEGRATE will inspect internal status, like battery level, and emotional states like exhaustion, excitatory state and modify the settings for ORIENT and MOVE accordingly. Options for ORIENTs setting are for instance random turn angles and low speed  for a drunkard&#039;s walk, phototaxis (pos. or neg.), odour pulse count or interval for kinesis behaviour, and PIR input (i. e. human or robot) presence for more interactive behaviour. After this setting, INTEGRATE will inhibit the setting of the the INTEGRATE request flag for some time. Input from rotary encoders and/or motor commands) will re-trigger this inhibition of INTEGRATE so rotate and Orient can work. ROTATE will rotate around the body center until some sensory dead zone for the current target (just picked by INTEGRATE is reached. Move will drive forward and (together with ORIENT) allow the creature to move in the direction of the goal implied by ORIENT. ACCEPT checks sensory input for an acceptable stop position that might have food or a high quality resource. ACCEPT will increase positive emotional levels. FEED will become active when food is indeed available available, for instance, via bottom contacts and feeding will increase positive emotional levels even more.&lt;br /&gt;
&lt;br /&gt;
::::Goal: find out where and when and how to move and set a goal&lt;br /&gt;
::::9 INTEGRATE // combine inputs and decide what to do at this moment.&lt;br /&gt;
::::10 ORIENT // orient towards the current goal&lt;br /&gt;
::::11 MOVE // move forward towards the current goal&lt;br /&gt;
::::12 ACCEPT // accept the current position and stop&lt;br /&gt;
::::13 FEED // electrical food is the best!&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;appendage use&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::Not all accepted position will directly allow access to resources like a voltage source, or an object to collect. EXTEND will try to reach the resource by (surprise) extending an appendage. PROBE will conduct a local search for the resource, and USE will get or enjoy the resource.&lt;br /&gt;
&lt;br /&gt;
::::Goal: reach a high quality resource by extending an appendage&lt;br /&gt;
::::14  EXTEND // reach for a resource&lt;br /&gt;
::::15 PROBE // probe to make contact&lt;br /&gt;
::::16 USE // this is sooo good!&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;interaction&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::EXPLORE will search for fun, however that is defined at that moment, it might mean going back to some other location to drop a collected object. For more social tasks, it might be finding something or somebody to make contact with. When EXPLORE is successful and switches its request flag off, INTERACT will control the interactive behaviour performed. Both these levels may modify the inputs for the SCAN layer to keep focus. Interact will however also increase exhaustion that eventually will prevent allow SEEKREST to become active.&lt;br /&gt;
&lt;br /&gt;
::::Goal: if all previous goals were reached this is the final goal setting layer&lt;br /&gt;
::::17 EXPLORE // find the fun&lt;br /&gt;
::::18 INTERACT // and love it!&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;rest&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::All fun comes to and end, when exhaustion strikes many higher priority levels that monitor exhaustion levels will become inactive and SEEKREST will modify the the scan layer and the the goal to finding a suitable location to rest. If a suitable location is found SLEEP will get active and stay active until sensory input changes again. At that point it is rinse and repeat.&lt;br /&gt;
&lt;br /&gt;
::::Goal: reduce exhaustion, find a location to rest and sleep there.&lt;br /&gt;
::::19 SEEKREST // after hard work...&lt;br /&gt;
::::20 SLEEP // ... it is time to sleep!&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;default&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::If non of the other levels asks for control WAIT (that always requests control) switches off all motors, reduces power use as much as possible, and waits for input. This is &#039;&#039;never&#039;&#039; expected to happen!&lt;br /&gt;
&lt;br /&gt;
::::Goal: wait for input&lt;br /&gt;
::::21 WAIT // default, always requesting but never getting it... &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:: Stay tuned, more comming soon&lt;br /&gt;
&lt;br /&gt;
== Implementation details ==&lt;br /&gt;
: &#039;&#039;Stay tuned, more comming soon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Anderson, D.P. (2007)&#039;&#039;&#039; https://www.dprg.org/articles/2007-03a/&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Bettosini et al., 2022&#039;&#039;&#039; Torocó: A Subsumption Architecture Implementation, in: 2022 8th International Conference on Automation, Robotics and Applications (ICARA) IEEE, Prague, Czech Republic, pp. 27–32. . https://doi.org/10.1109/ICARA55094.2022.9738521&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Brooks, R.A. (1986)&#039;&#039;&#039; A Robust Layer Control System for a Mobile Robot, IEEE Journal of Robotics and Automation RA-2, 14-23&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Rickenbacher (1975)&#039;&#039;&#039; Lernen und Motivation als relevanzgesteuerte Datenverarbeitung: Ein Computer-Simulationsmodell elementarer kognitiv-affektiver Prozesse. Birkhäuser Verag Basel.&lt;/div&gt;</summary>
		<author><name>Peterr</name></author>
	</entry>
	<entry>
		<id>https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15307</id>
		<title>Leaphy Robot</title>
		<link rel="alternate" type="text/html" href="https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15307"/>
		<updated>2025-10-01T21:49:36Z</updated>

		<summary type="html">&lt;p&gt;Peterr: /* Implementation details */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Name=Leaphy robot with subsumption architecture&lt;br /&gt;
|Skills=software hardware electronics biology&lt;br /&gt;
|Status=Active&lt;br /&gt;
|Niche=robotics&lt;br /&gt;
|Purpose=Fun&lt;br /&gt;
|Picture=Leaphy back side view.jpg&lt;br /&gt;
|Tool=No&lt;br /&gt;
|Location=Space, home&lt;br /&gt;
|Cost=Very small given what is already present and what is available in the space (everything!!)&lt;br /&gt;
|Category=Electronics&lt;br /&gt;
}}&lt;br /&gt;
== Electronic insect-like creature ==&lt;br /&gt;
&#039;&#039;&#039;Physiological, Behavioural and environmental overview&#039;&#039;&#039; &amp;lt;br&amp;gt;&lt;br /&gt;
peterr 2022- 2025 (with &#039;&#039;very&#039;&#039; long pauses)&lt;br /&gt;
&lt;br /&gt;
====Document history====&lt;br /&gt;
* Currently this is a living document and this wiki contains the latest version&lt;br /&gt;
* September 2025 subsumption architecture design &amp;amp; transfer to nurdspace wiki&lt;br /&gt;
* August    2025 Documentation for scheduler&lt;br /&gt;
* March     2023 Draft version 0.2  - terminology cleanup and scope&lt;br /&gt;
* November  2022 First document sketches &amp;amp; ideas&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project==&lt;br /&gt;
The insect like creature based on the original [https://leaphy.store/product/leaphy-original-los/ leaphyrobot] has a set of functionalities that together allow it to effectively find, and feed on targets that provides electricity as a reward.&lt;br /&gt;
Learning strategies to improve success rate can be implemented.&lt;br /&gt;
Sexual signaling, event prediction, mating behaviour, genetic exchange and evolution are in principle possible but are currently still (far) out of scope. The system at it&#039;s highest level can be seen as a feedback loop: sensory input =&amp;gt; behavioural selection =&amp;gt; motor output =&amp;gt; new sensory input. The original design (2022) was meant to live in wind tunnel, and find odour sources to feed, but currently the emphasis has shifted from odour detection to more general sensory processing using subsumption architecture, [https://nurdspace.nl/Leaphy_Robot#Brain see below].&lt;br /&gt;
&lt;br /&gt;
== Sensory inputs ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Mechanoreceptor - sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
:::Micro switch based tactile hairs. &lt;br /&gt;
:::&#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Ultrasound - Distance sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
::: Ultrasonic pulses detect obstacles and trigger reflex avoidance behaviour&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Better directional responses would be possible with more than one US sensor. &lt;br /&gt;
:::: This would need a dedicated embedded processor. &lt;br /&gt;
:::: &#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing light intensity&#039;&#039;&#039;&lt;br /&gt;
::: Two LDR photoreceptors measure front-left light level and front-right light level&lt;br /&gt;
::: Total light intensity (sum) is available as an analog voltage&lt;br /&gt;
::: The difference between the inputs is also available, and signals what side to turn to, to approach or avoid the light.&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing sound (audio)&#039;&#039;&#039;&lt;br /&gt;
::: A subunit with its own processor, containing an Electret microphone to measure ambiant sound level, frequency and sound patterns. &lt;br /&gt;
::: Can be used in classical (Pawlow) and operand conditioning experiments. Will detect both absolute sound levels (for startle or avoidance responses) and can contain feature detectors (e.g. chirp intervals for leaf hopper like  communication and courting  behaviour of two leaphy&#039;s).  &lt;br /&gt;
::: In addition, an Audeme Movi speech recognition shield (see https://www.audeme.com/movi.html) could be used to process voice commands&lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented, but Movi shield &amp;quot;proof of concept&amp;quot; done&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;PIR movement sensor&#039;&#039;&#039;&lt;br /&gt;
::: In addition to light intensity, an infra red motion sensors can be used to detect movements (humans, or the cat for that matter) see for instance https://www.adafruit.com/product/4871 &lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented but PIR (similar to the adafruit thingy) available&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Sensing wind direction &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based tactile hairs?  Something like https://www.instructables.com/Low-Cost-Low-Speed-Wind-Sensor-1/ with shielding? or sensitive temperature measurements?&lt;br /&gt;
:::; Note: Wind direction sensing in the wind tunnel is currently replaced by sensing light gradients parallel to the wind direction because the wind sensor is not available yet. &lt;br /&gt;
:::: &#039;&#039;Development status: To be designed, high priority for the windtunnel version with odour processing as a main goal, low priority for the a free walking space/nurdspace version described here.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Volatiles (odours) &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based perception of volatiles like alcohol (fruit-fly like behaviours), Carbon dioxide (mosquito like behaviour), or VOC&#039;s (most plant eating insects). The sensor produces a voltage level proportional to the intensity of the stimulus. Using a threshold can generate a presence/absence signal. &lt;br /&gt;
::: The interval between odour pulses is a proxy for the distance to the source. Note that an odour &amp;quot;gradient&amp;quot; does not exist!&lt;br /&gt;
&lt;br /&gt;
::: Current implementation uses a SGP30 board. The time constant of the the sensor is in the order of 1 second, but &amp;quot;whiffs&amp;quot; of odour could be detected faster by using a feature detector that looks for sudden steps in the signal. This will also act as an sensory adaptation mechanism: in the absence of change the output go&#039;s to zero.&lt;br /&gt;
::: &#039;&#039;Development status: Sensor: worked, currently broken&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground color&#039;&#039;&#039;&lt;br /&gt;
::: This sensor measures ground colour and the output can be used to test for a particular condition (e.g. being at a target position). It can also be used to simulate trail pheromones implemented as colors next to the  trail followed. This sense can also take the role of short distance &amp;quot; present at target&amp;quot; stimuli.&lt;br /&gt;
::: &#039;&#039; Development status: Operational &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground reflection level&#039;&#039;&#039;&lt;br /&gt;
::: Two sensors &#039;line followers&#039; that both provide a binary present/absent signal of ground reflection.&lt;br /&gt;
::: Can be used to simulate trail following behaviour on a network of lines  (combined with (led) ground colours.&lt;br /&gt;
::: &#039;&#039;Development status: testing phase&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Future extensions: A combination of voltage levels and pulse frequency coding in the source could be used to simulate a spectrum of &amp;quot;chemical&amp;quot; inputs.  &lt;br /&gt;
:::: Feature detectors could extract particular frequencies and/or patterns to recognise for instance &amp;quot;&#039;&#039;toxic&#039;&#039;&amp;quot; substances. &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Proprioception (internal &amp;quot;feeling&amp;quot;)&#039;&#039;&#039;&lt;br /&gt;
::: Checking for instance for body movement when motors move, or for force feedback when extending electrical honey sucking mouthparts&lt;br /&gt;
::: Development status:To be developed, as yet low priority. &lt;br /&gt;
 &lt;br /&gt;
:: &#039;&#039;&#039;Sensing internal physiological states &#039;&#039;&#039;&lt;br /&gt;
:::To place electric reward information in perspective, some internal status information is needed, that is supplied by reading internal variables like energy levels (battery voltage , load current) or physiological state (internal variables like &amp;quot;ready to feed&amp;quot;. &lt;br /&gt;
::: More advances implementations could look up previous experiences, and rate of change in physiological status as well as brain hormone levels and excitation states (see below under internal states and hormones&amp;quot;).&lt;br /&gt;
:::Development status: To be designed.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing hormone levels&#039;&#039;&#039;&lt;br /&gt;
::: Certain activities or combinations of activities can stimulate the production of hormones. This could be implemented as slow changing values in memory. Hormone levels might modulate the effect of sensory input or behavioural output, and act as a slow form of memory.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing rewards and deterrents&#039;&#039;&#039;&lt;br /&gt;
::: Electronic organisms live on electricity, and are rewarded by sensing the presence of a voltage and current. This sensory organ is just sensing the analog voltage measured by the sensory organ. It simulates the perception of food such as nectar. Most logical position is at the tip of an appendage. &lt;br /&gt;
::: &#039;&#039;Development status: implemented and removed (needs mutiplexing). Mechanical movement (servo) to make electrical contact: testing phase.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Brain ==&lt;br /&gt;
::&#039;&#039;&#039;Subsumption architecture&#039;&#039;&#039;&lt;br /&gt;
:::The Electronic organisms has a software brain that receives sensory input both from the environment and internal status. The brain reads all inputs about every 50 msec, and produces command for actuators that produce behaviour. These behaviours can be as simple as a colour changes of a led (signaling sensory status) or movements of body and body and appendages. The aim is to make the lower levels as stateless as possible i.e. the brain uses its real time vision of the word as a model instead of some abstract internal representation. The processing principle roughly follow the subsumption architecture (Brooks 1986).&lt;br /&gt;
&lt;br /&gt;
:::Wikipedia writes about this technique:&lt;br /&gt;
::::&amp;quot;&#039;&#039;[Behaviours] are organized into a hierarchy of layers. Each layer implements a particular level of behavioral competence, and higher levels are able to subsume lower levels (= integrate/combine lower levels to a more comprehensive whole) in order to create viable behavior. For example, a robot&#039;s lowest layer could be &amp;quot;avoid an object&amp;quot;. The second layer would be &amp;quot;wander around&amp;quot;, which runs beneath the third layer &amp;quot;explore the world&amp;quot;.[...]The subsumption architecture creates a system in which the higher layers utilize the lower-level competencies. The layers, which all receive sensor-information, work in parallel and generate outputs. These outputs can be commands to actuators, or signals that suppress or inhibit other layers.&amp;quot;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::My current implementation uses the opposite order. The high priority levels conduct the simplest behavioural tasks, and when these high priority but simple behavioural levels are happy more complex task can get control. This approach is still experimental, but in any case easy enough to reverse again.&lt;br /&gt;
&lt;br /&gt;
:::The behavioural levels &#039;&#039;all&#039;&#039; compete for control of the robot. Each behavioural layer evaluates its sensory input and determines if it wants to control the outputs (to change its input according to its (implied) goal, e.g. mechanoreceptors (microswitches) will only request control if the switch is closed. After all the behavioural levels are evaluated, and their request flags set or reset an arbitrate routine  selects the highest active layer that will run the robot behaviorual output for the next 50 msec.&lt;br /&gt;
:::See Anderson (2007) for a clear explanations and actual implementation examples.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Brain subsystems&#039;&#039;&#039;&lt;br /&gt;
:::More complicated or slow tasks (like sound processing or US echo detection) can be executed in separate processor boards that report their status  to the main  controller. Conceptually this is not different from subroutines for tasks.&lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Nervous system&#039;&#039;&#039;&lt;br /&gt;
::: The currently (sort of) running implementation of the brain is using a real time loop in a very simple cooperative multitasking system ([https://yiweimao.github.io/blog/async_microcontroller/ YiweiMao scheduler]) and inmplemented on an Arduino Uno &lt;br /&gt;
::: &#039;&#039;Development status: operational, but under active development.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Associative memory&#039;&#039;&#039;&lt;br /&gt;
::: Associative memory in it current, simplest form will be implemented as memory locations for particular sensory input combinations.  inputs that coincide increase a counter for that combination (learning those combinations). This allows both Pawlow  and operand conditioning.&lt;br /&gt;
:::&#039;&#039;Development status: not yet implemented, proof of concept done ~50 years ago :).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Excitation state and hormones&#039;&#039;&#039;&lt;br /&gt;
::: Hormones are internal variables with levels that act as slow changing memory for previous (combinations of) states.&lt;br /&gt;
::: A default breakdown speed can be set that slowly decrease hormone levels. Particular sensory input could increase the levels again. Reaching high levels of certain hormones can be a goal in itself, and subject to learning behaviour.&lt;br /&gt;
::: &#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Satisfaction&#039;&#039;&#039;&lt;br /&gt;
:::Signals to end feeding behaviour can -in addition to electrical food running out- also come from internal signals (satiation, internal hormonal signals, (too) long time periods with little change of events)&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Future prediction&#039;&#039;&#039;&lt;br /&gt;
:::This is currently way out of scope, but neural-net like implementations that store event sequences, predict likely outcomes of current inputs and act accordingly are fully feasible.&lt;br /&gt;
::: See Rickenbacher 1975 for an example that is probably  a bit more traceable than -for instance- modern neural network code like Tensorflow. &lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Effectors ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;main motors&#039;&#039;&#039;&lt;br /&gt;
:::The main moves of the organism are implemented by two wheels driven by two [https://leaphy.store/product/tt-motor-10cm-jumper-female/ DC motors] with build in gearboxes) and a [https://leaphy.store/product/motor-shield/ motor shield]. Motor speed is controlled by pulse width modualation (PMW)) present in the processor. Steering is done by differential motorspeed, a third backside &amp;quot;wheel&amp;quot; is a simple short passive wooden stand. This works well on reasonable flat surfaces, but needs improvement is the next robot (Terzo).&lt;br /&gt;
:::&#039;&#039;Motor development status: Operational at a basic level, PID control and extra power at startup to get smooth startup at low speed is needed.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Movable mouthparts&#039;&#039;&#039;&lt;br /&gt;
:::Appendages like extendable mouthparts controlled by [https://isking-modellbahn.de/modelcraft-es-030-Servo-top-line-steuerelektronik servo]&#039;s can be used for feeding on electrical food. Currently one servo controlling a proboscis (mouthpart for feeding) is present.&lt;br /&gt;
:::&#039;&#039;Development status: Operational in priciple, untested in practice, needs 3D printing of parts&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;[https://leaphy.store/product/rgb-led-single/ Three colour led]&#039;&#039;&#039;&lt;br /&gt;
::: can be used for signaling status of whatever state we want.&lt;br /&gt;
:::&#039;&#039;Development status: Operational &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Piezo beeper &#039;&#039;&#039;&lt;br /&gt;
::: Present on the [https://leaphy.store/product/motor-shield/ motor shield] can be used to create a variety of sounds,for instance to signal happines, distress or alarm.&lt;br /&gt;
:::&#039;&#039;Development status: Operational, but specific sounds need to be designed&lt;br /&gt;
&lt;br /&gt;
== Behavioural levels ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:: Behaviour in subsumption architecture is organised in levels that compete for control, the highest priority behaviour (lowest rank, top of list) will control the robot for 50 msec.&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Overview of current behavioral levels and  their most important inputs for controlling requests&#039;&#039;&#039;. &lt;br /&gt;
:::Layers are only a naming convention, conceptually grouping behaviour with somewhat similar aims. Note that the ultimate goals of the system (here level SLEEP, see below) is determined by the order of the levels. Changing the order evidently will change the behavioural outcomes.  Currently the order is hard coded.&lt;br /&gt;
&lt;br /&gt;
:::High priority behavioural levels take care of the most basic and critical task. When their goals are reached (their requests for control stop), higher behavioural levels, (representing more advanced lower priority tasks will be able to run. Note however that higher levels can explicitly inhibit or even modify lower level behaviours under some circumstances for some time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
::See the actual calls for details.&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;Layer &amp;quot;distress&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::If unable to meet the absolute basic requirement for battery voltage or movement CALL for help. In STUCK, try reflexes to get loose, pause regular. If nothing works eventually HIBERNATE &lt;br /&gt;
&lt;br /&gt;
::::Goal:  deal with the really difficult situations &lt;br /&gt;
::::0  HIBERNATE // hope for better times...&lt;br /&gt;
::::1  STUCK // try to solve non-movement when motors run...&lt;br /&gt;
::::2  CALL  // call for help&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;stay free&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::The primary sensory input activating this level are Bumper sensors and Ultrasonics, but also hormones for high emotional levels reached by an overload of sensory input or a high number of failing tries to reach some goal. FREEZE will stop movement for an serious amount of time to reduce overload FIGHT will move quickly forward and get very close to an object possibly even disregarding US and bumpers and hitting the object. ESCAPE will try to free the bumpers EVADE will try to keep a safe distance from objects. FLIGHT will try to run straight for a relative long time (using a countdown timer) but will subsumed by lower levels.&lt;br /&gt;
&lt;br /&gt;
::::Goal: avoid stressors. &lt;br /&gt;
::::3  FREEZE  // simulated dead&lt;br /&gt;
::::4  FIGHT   // try to intimidate &lt;br /&gt;
::::5  ESCAPE  // escape from touch&lt;br /&gt;
::::6  EVADE   // keep distance&lt;br /&gt;
::::7  FLIGHT  // run away  &lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;external control&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::This level is only requesting control if external commands are present in sensordata. The behaviour is self-reinforcing so once activated it keeps controlling the creature as long as new commands arrive within reasonable time. Note that Escape and Evade and Flight have priority, manual control has limits, the creature is autonomous!&lt;br /&gt;
&lt;br /&gt;
::::Goals: Stay free and prevent distress, but otherwise otherwise obey external commands.&lt;br /&gt;
::::8 MANUAL // How boring...&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;scan and move&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::This level is the heart of the brain. Reaching the first level of this layer (INTEGRATE) is rewarding. :::Everything is (locally) under control and a target goal can been set. This will also increase positive emotional level. INTEGRATE will inspect internal status, like battery level, and emotional states like exhaustion, excitatory state and modify the settings for ORIENT and MOVE accordingly. Options for ORIENTs setting are for instance random turn angles and low speed  for a drunkard&#039;s walk, phototaxis (pos. or neg.), odour pulse count or interval for kinesis behaviour, and PIR input (i. e. human) presence for more interactive behaviour. After this setting, INTEGRATE will inhibit the setting of the the INTEGRATE request flag for some time. Input from rotary encoders and/or motor commands) will re-trigger this inhibition of INTEGRATE so rotate and Orient can work. ROTATE will rotate around the body center until some sensory dead zone for the current target (just picked by INTEGRATE is reached. Move will drive forward and (together with ORIENT) allow the creature to move in the direction of the goal implied by ORIENT. ACCEPT checks sensory input for an acceptable stop position that might have food or a high quality resource. ACCEPT will increase positive emotional levels. FEED will become active when food is indeed available available, for instance, via bottom contacts and feeding will increase positive emotional levels even more.&lt;br /&gt;
&lt;br /&gt;
::::Goal: find out where and when and how to move and set a goal&lt;br /&gt;
::::9 INTEGRATE // combine inputs and decide what to do at this moment.&lt;br /&gt;
::::10 ORIENT // orient towards the current goal&lt;br /&gt;
::::11 MOVE // move forward towards the current goal&lt;br /&gt;
::::12 ACCEPT // accept the current position and stop&lt;br /&gt;
::::13 FEED // electrical food is the best!&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;appendage use&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::Not all accepted position will directly allow access to resources like a voltage source, or an object to collect. EXTEND will try to reach the resource by (surprise) extending an appendage. PROBE will conduct a local search for the resource, and USE will get or enjoy the resource.&lt;br /&gt;
&lt;br /&gt;
::::Goal: reach a high quality resource by extending an appendage&lt;br /&gt;
::::14  EXTEND // reach for a resource&lt;br /&gt;
::::15 PROBE // probe to make contact&lt;br /&gt;
::::16 USE // this is sooo good!&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;interaction&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::EXPLORE will search for fun, however that is defined at that moment, it might mean going back to some other location to drop a collected object. For more social tasks, it might be finding something or somebody to make contact with. When EXPLORE is succesfull and switches its request flag off, INTERACT will control the interactive behaviour performed. Both these levels may modify the inputs for the SCAN layer to keep focus. Interact will however also increase exhaustion that eventually will prevent allow SEEKREST to become active.&lt;br /&gt;
&lt;br /&gt;
::::Goal: if all previous goals were reached this is the final goal setting layer&lt;br /&gt;
::::17 EXPLORE // find the fun&lt;br /&gt;
::::18 INTERACT // and love it!&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;rest&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::All fun comes to and end, when exhaustion strikes many higer priority levels that monitor exhaustion levels will become inactive and SEEKREST will modify the the scan layer and the the goal to finding a suitable location to rest. If a suitable location is found SLEEP will get active and stay active until sensory input changes again. At that point it is rinse and repeat.&lt;br /&gt;
&lt;br /&gt;
::::Goal: reduce exhaustion, find a location to rest and sleep there.&lt;br /&gt;
::::19 SEEKREST // after hard work...&lt;br /&gt;
::::20 SLEEP // ... it is time to sleep!&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;Layer &amp;quot;default&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::If non of the other levels asks for control WAIT (that always requests control) switches off all motors, reduces power use as much as possible, and waits for input. This is &#039;&#039;never&#039;&#039; expected to happen!&lt;br /&gt;
&lt;br /&gt;
::::Goal: wait for input&lt;br /&gt;
::::21 WAIT // default, always requesting but never getting it... &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:: Stay tuned, more comming soon&lt;br /&gt;
&lt;br /&gt;
== Implementation details ==&lt;br /&gt;
: &#039;&#039;Stay tuned, more comming soon&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Anderson, D.P. (2007)&#039;&#039;&#039; https://www.dprg.org/articles/2007-03a/&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Bettosini et al., 2022&#039;&#039;&#039; Torocó: A Subsumption Architecture Implementation, in: 2022 8th International Conference on Automation, Robotics and Applications (ICARA) IEEE, Prague, Czech Republic, pp. 27–32. . https://doi.org/10.1109/ICARA55094.2022.9738521&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Brooks, R.A. (1986)&#039;&#039;&#039; A Robust Layer Control System for a Mobile Robot, IEEE Journal of Robotics and Automation RA-2, 14-23&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Rickenbacher (1975)&#039;&#039;&#039; Lernen und Motivation als relevanzgesteuerte Datenverarbeitung: Ein Computer-Simulationsmodell elementarer kognitiv-affektiver Prozesse. Birkhäuser Verag Basel.&lt;/div&gt;</summary>
		<author><name>Peterr</name></author>
	</entry>
	<entry>
		<id>https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15306</id>
		<title>Leaphy Robot</title>
		<link rel="alternate" type="text/html" href="https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15306"/>
		<updated>2025-10-01T21:49:11Z</updated>

		<summary type="html">&lt;p&gt;Peterr: /* Implementation details */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Name=Leaphy robot with subsumption architecture&lt;br /&gt;
|Skills=software hardware electronics biology&lt;br /&gt;
|Status=Active&lt;br /&gt;
|Niche=robotics&lt;br /&gt;
|Purpose=Fun&lt;br /&gt;
|Picture=Leaphy back side view.jpg&lt;br /&gt;
|Tool=No&lt;br /&gt;
|Location=Space, home&lt;br /&gt;
|Cost=Very small given what is already present and what is available in the space (everything!!)&lt;br /&gt;
|Category=Electronics&lt;br /&gt;
}}&lt;br /&gt;
== Electronic insect-like creature ==&lt;br /&gt;
&#039;&#039;&#039;Physiological, Behavioural and environmental overview&#039;&#039;&#039; &amp;lt;br&amp;gt;&lt;br /&gt;
peterr 2022- 2025 (with &#039;&#039;very&#039;&#039; long pauses)&lt;br /&gt;
&lt;br /&gt;
====Document history====&lt;br /&gt;
* Currently this is a living document and this wiki contains the latest version&lt;br /&gt;
* September 2025 subsumption architecture design &amp;amp; transfer to nurdspace wiki&lt;br /&gt;
* August    2025 Documentation for scheduler&lt;br /&gt;
* March     2023 Draft version 0.2  - terminology cleanup and scope&lt;br /&gt;
* November  2022 First document sketches &amp;amp; ideas&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project==&lt;br /&gt;
The insect like creature based on the original [https://leaphy.store/product/leaphy-original-los/ leaphyrobot] has a set of functionalities that together allow it to effectively find, and feed on targets that provides electricity as a reward.&lt;br /&gt;
Learning strategies to improve success rate can be implemented.&lt;br /&gt;
Sexual signaling, event prediction, mating behaviour, genetic exchange and evolution are in principle possible but are currently still (far) out of scope. The system at it&#039;s highest level can be seen as a feedback loop: sensory input =&amp;gt; behavioural selection =&amp;gt; motor output =&amp;gt; new sensory input. The original design (2022) was meant to live in wind tunnel, and find odour sources to feed, but currently the emphasis has shifted from odour detection to more general sensory processing using subsumption architecture, [https://nurdspace.nl/Leaphy_Robot#Brain see below].&lt;br /&gt;
&lt;br /&gt;
== Sensory inputs ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Mechanoreceptor - sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
:::Micro switch based tactile hairs. &lt;br /&gt;
:::&#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Ultrasound - Distance sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
::: Ultrasonic pulses detect obstacles and trigger reflex avoidance behaviour&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Better directional responses would be possible with more than one US sensor. &lt;br /&gt;
:::: This would need a dedicated embedded processor. &lt;br /&gt;
:::: &#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing light intensity&#039;&#039;&#039;&lt;br /&gt;
::: Two LDR photoreceptors measure front-left light level and front-right light level&lt;br /&gt;
::: Total light intensity (sum) is available as an analog voltage&lt;br /&gt;
::: The difference between the inputs is also available, and signals what side to turn to, to approach or avoid the light.&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing sound (audio)&#039;&#039;&#039;&lt;br /&gt;
::: A subunit with its own processor, containing an Electret microphone to measure ambiant sound level, frequency and sound patterns. &lt;br /&gt;
::: Can be used in classical (Pawlow) and operand conditioning experiments. Will detect both absolute sound levels (for startle or avoidance responses) and can contain feature detectors (e.g. chirp intervals for leaf hopper like  communication and courting  behaviour of two leaphy&#039;s).  &lt;br /&gt;
::: In addition, an Audeme Movi speech recognition shield (see https://www.audeme.com/movi.html) could be used to process voice commands&lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented, but Movi shield &amp;quot;proof of concept&amp;quot; done&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;PIR movement sensor&#039;&#039;&#039;&lt;br /&gt;
::: In addition to light intensity, an infra red motion sensors can be used to detect movements (humans, or the cat for that matter) see for instance https://www.adafruit.com/product/4871 &lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented but PIR (similar to the adafruit thingy) available&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Sensing wind direction &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based tactile hairs?  Something like https://www.instructables.com/Low-Cost-Low-Speed-Wind-Sensor-1/ with shielding? or sensitive temperature measurements?&lt;br /&gt;
:::; Note: Wind direction sensing in the wind tunnel is currently replaced by sensing light gradients parallel to the wind direction because the wind sensor is not available yet. &lt;br /&gt;
:::: &#039;&#039;Development status: To be designed, high priority for the windtunnel version with odour processing as a main goal, low priority for the a free walking space/nurdspace version described here.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Volatiles (odours) &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based perception of volatiles like alcohol (fruit-fly like behaviours), Carbon dioxide (mosquito like behaviour), or VOC&#039;s (most plant eating insects). The sensor produces a voltage level proportional to the intensity of the stimulus. Using a threshold can generate a presence/absence signal. &lt;br /&gt;
::: The interval between odour pulses is a proxy for the distance to the source. Note that an odour &amp;quot;gradient&amp;quot; does not exist!&lt;br /&gt;
&lt;br /&gt;
::: Current implementation uses a SGP30 board. The time constant of the the sensor is in the order of 1 second, but &amp;quot;whiffs&amp;quot; of odour could be detected faster by using a feature detector that looks for sudden steps in the signal. This will also act as an sensory adaptation mechanism: in the absence of change the output go&#039;s to zero.&lt;br /&gt;
::: &#039;&#039;Development status: Sensor: worked, currently broken&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground color&#039;&#039;&#039;&lt;br /&gt;
::: This sensor measures ground colour and the output can be used to test for a particular condition (e.g. being at a target position). It can also be used to simulate trail pheromones implemented as colors next to the  trail followed. This sense can also take the role of short distance &amp;quot; present at target&amp;quot; stimuli.&lt;br /&gt;
::: &#039;&#039; Development status: Operational &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground reflection level&#039;&#039;&#039;&lt;br /&gt;
::: Two sensors &#039;line followers&#039; that both provide a binary present/absent signal of ground reflection.&lt;br /&gt;
::: Can be used to simulate trail following behaviour on a network of lines  (combined with (led) ground colours.&lt;br /&gt;
::: &#039;&#039;Development status: testing phase&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Future extensions: A combination of voltage levels and pulse frequency coding in the source could be used to simulate a spectrum of &amp;quot;chemical&amp;quot; inputs.  &lt;br /&gt;
:::: Feature detectors could extract particular frequencies and/or patterns to recognise for instance &amp;quot;&#039;&#039;toxic&#039;&#039;&amp;quot; substances. &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Proprioception (internal &amp;quot;feeling&amp;quot;)&#039;&#039;&#039;&lt;br /&gt;
::: Checking for instance for body movement when motors move, or for force feedback when extending electrical honey sucking mouthparts&lt;br /&gt;
::: Development status:To be developed, as yet low priority. &lt;br /&gt;
 &lt;br /&gt;
:: &#039;&#039;&#039;Sensing internal physiological states &#039;&#039;&#039;&lt;br /&gt;
:::To place electric reward information in perspective, some internal status information is needed, that is supplied by reading internal variables like energy levels (battery voltage , load current) or physiological state (internal variables like &amp;quot;ready to feed&amp;quot;. &lt;br /&gt;
::: More advances implementations could look up previous experiences, and rate of change in physiological status as well as brain hormone levels and excitation states (see below under internal states and hormones&amp;quot;).&lt;br /&gt;
:::Development status: To be designed.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing hormone levels&#039;&#039;&#039;&lt;br /&gt;
::: Certain activities or combinations of activities can stimulate the production of hormones. This could be implemented as slow changing values in memory. Hormone levels might modulate the effect of sensory input or behavioural output, and act as a slow form of memory.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing rewards and deterrents&#039;&#039;&#039;&lt;br /&gt;
::: Electronic organisms live on electricity, and are rewarded by sensing the presence of a voltage and current. This sensory organ is just sensing the analog voltage measured by the sensory organ. It simulates the perception of food such as nectar. Most logical position is at the tip of an appendage. &lt;br /&gt;
::: &#039;&#039;Development status: implemented and removed (needs mutiplexing). Mechanical movement (servo) to make electrical contact: testing phase.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Brain ==&lt;br /&gt;
::&#039;&#039;&#039;Subsumption architecture&#039;&#039;&#039;&lt;br /&gt;
:::The Electronic organisms has a software brain that receives sensory input both from the environment and internal status. The brain reads all inputs about every 50 msec, and produces command for actuators that produce behaviour. These behaviours can be as simple as a colour changes of a led (signaling sensory status) or movements of body and body and appendages. The aim is to make the lower levels as stateless as possible i.e. the brain uses its real time vision of the word as a model instead of some abstract internal representation. The processing principle roughly follow the subsumption architecture (Brooks 1986).&lt;br /&gt;
&lt;br /&gt;
:::Wikipedia writes about this technique:&lt;br /&gt;
::::&amp;quot;&#039;&#039;[Behaviours] are organized into a hierarchy of layers. Each layer implements a particular level of behavioral competence, and higher levels are able to subsume lower levels (= integrate/combine lower levels to a more comprehensive whole) in order to create viable behavior. For example, a robot&#039;s lowest layer could be &amp;quot;avoid an object&amp;quot;. The second layer would be &amp;quot;wander around&amp;quot;, which runs beneath the third layer &amp;quot;explore the world&amp;quot;.[...]The subsumption architecture creates a system in which the higher layers utilize the lower-level competencies. The layers, which all receive sensor-information, work in parallel and generate outputs. These outputs can be commands to actuators, or signals that suppress or inhibit other layers.&amp;quot;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::My current implementation uses the opposite order. The high priority levels conduct the simplest behavioural tasks, and when these high priority but simple behavioural levels are happy more complex task can get control. This approach is still experimental, but in any case easy enough to reverse again.&lt;br /&gt;
&lt;br /&gt;
:::The behavioural levels &#039;&#039;all&#039;&#039; compete for control of the robot. Each behavioural layer evaluates its sensory input and determines if it wants to control the outputs (to change its input according to its (implied) goal, e.g. mechanoreceptors (microswitches) will only request control if the switch is closed. After all the behavioural levels are evaluated, and their request flags set or reset an arbitrate routine  selects the highest active layer that will run the robot behaviorual output for the next 50 msec.&lt;br /&gt;
:::See Anderson (2007) for a clear explanations and actual implementation examples.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Brain subsystems&#039;&#039;&#039;&lt;br /&gt;
:::More complicated or slow tasks (like sound processing or US echo detection) can be executed in separate processor boards that report their status  to the main  controller. Conceptually this is not different from subroutines for tasks.&lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Nervous system&#039;&#039;&#039;&lt;br /&gt;
::: The currently (sort of) running implementation of the brain is using a real time loop in a very simple cooperative multitasking system ([https://yiweimao.github.io/blog/async_microcontroller/ YiweiMao scheduler]) and inmplemented on an Arduino Uno &lt;br /&gt;
::: &#039;&#039;Development status: operational, but under active development.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Associative memory&#039;&#039;&#039;&lt;br /&gt;
::: Associative memory in it current, simplest form will be implemented as memory locations for particular sensory input combinations.  inputs that coincide increase a counter for that combination (learning those combinations). This allows both Pawlow  and operand conditioning.&lt;br /&gt;
:::&#039;&#039;Development status: not yet implemented, proof of concept done ~50 years ago :).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Excitation state and hormones&#039;&#039;&#039;&lt;br /&gt;
::: Hormones are internal variables with levels that act as slow changing memory for previous (combinations of) states.&lt;br /&gt;
::: A default breakdown speed can be set that slowly decrease hormone levels. Particular sensory input could increase the levels again. Reaching high levels of certain hormones can be a goal in itself, and subject to learning behaviour.&lt;br /&gt;
::: &#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Satisfaction&#039;&#039;&#039;&lt;br /&gt;
:::Signals to end feeding behaviour can -in addition to electrical food running out- also come from internal signals (satiation, internal hormonal signals, (too) long time periods with little change of events)&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Future prediction&#039;&#039;&#039;&lt;br /&gt;
:::This is currently way out of scope, but neural-net like implementations that store event sequences, predict likely outcomes of current inputs and act accordingly are fully feasible.&lt;br /&gt;
::: See Rickenbacher 1975 for an example that is probably  a bit more traceable than -for instance- modern neural network code like Tensorflow. &lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Effectors ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;main motors&#039;&#039;&#039;&lt;br /&gt;
:::The main moves of the organism are implemented by two wheels driven by two [https://leaphy.store/product/tt-motor-10cm-jumper-female/ DC motors] with build in gearboxes) and a [https://leaphy.store/product/motor-shield/ motor shield]. Motor speed is controlled by pulse width modualation (PMW)) present in the processor. Steering is done by differential motorspeed, a third backside &amp;quot;wheel&amp;quot; is a simple short passive wooden stand. This works well on reasonable flat surfaces, but needs improvement is the next robot (Terzo).&lt;br /&gt;
:::&#039;&#039;Motor development status: Operational at a basic level, PID control and extra power at startup to get smooth startup at low speed is needed.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Movable mouthparts&#039;&#039;&#039;&lt;br /&gt;
:::Appendages like extendable mouthparts controlled by [https://isking-modellbahn.de/modelcraft-es-030-Servo-top-line-steuerelektronik servo]&#039;s can be used for feeding on electrical food. Currently one servo controlling a proboscis (mouthpart for feeding) is present.&lt;br /&gt;
:::&#039;&#039;Development status: Operational in priciple, untested in practice, needs 3D printing of parts&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;[https://leaphy.store/product/rgb-led-single/ Three colour led]&#039;&#039;&#039;&lt;br /&gt;
::: can be used for signaling status of whatever state we want.&lt;br /&gt;
:::&#039;&#039;Development status: Operational &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Piezo beeper &#039;&#039;&#039;&lt;br /&gt;
::: Present on the [https://leaphy.store/product/motor-shield/ motor shield] can be used to create a variety of sounds,for instance to signal happines, distress or alarm.&lt;br /&gt;
:::&#039;&#039;Development status: Operational, but specific sounds need to be designed&lt;br /&gt;
&lt;br /&gt;
== Behavioural levels ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:: Behaviour in subsumption architecture is organised in levels that compete for control, the highest priority behaviour (lowest rank, top of list) will control the robot for 50 msec.&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Overview of current behavioral levels and  their most important inputs for controlling requests&#039;&#039;&#039;. &lt;br /&gt;
:::Layers are only a naming convention, conceptually grouping behaviour with somewhat similar aims. Note that the ultimate goals of the system (here level SLEEP, see below) is determined by the order of the levels. Changing the order evidently will change the behavioural outcomes.  Currently the order is hard coded.&lt;br /&gt;
&lt;br /&gt;
:::High priority behavioural levels take care of the most basic and critical task. When their goals are reached (their requests for control stop), higher behavioural levels, (representing more advanced lower priority tasks will be able to run. Note however that higher levels can explicitly inhibit or even modify lower level behaviours under some circumstances for some time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
::See the actual calls for details.&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;Layer &amp;quot;distress&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::If unable to meet the absolute basic requirement for battery voltage or movement CALL for help. In STUCK, try reflexes to get loose, pause regular. If nothing works eventually HIBERNATE &lt;br /&gt;
&lt;br /&gt;
::::Goal:  deal with the really difficult situations &lt;br /&gt;
::::0  HIBERNATE // hope for better times...&lt;br /&gt;
::::1  STUCK // try to solve non-movement when motors run...&lt;br /&gt;
::::2  CALL  // call for help&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;stay free&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::The primary sensory input activating this level are Bumper sensors and Ultrasonics, but also hormones for high emotional levels reached by an overload of sensory input or a high number of failing tries to reach some goal. FREEZE will stop movement for an serious amount of time to reduce overload FIGHT will move quickly forward and get very close to an object possibly even disregarding US and bumpers and hitting the object. ESCAPE will try to free the bumpers EVADE will try to keep a safe distance from objects. FLIGHT will try to run straight for a relative long time (using a countdown timer) but will subsumed by lower levels.&lt;br /&gt;
&lt;br /&gt;
::::Goal: avoid stressors. &lt;br /&gt;
::::3  FREEZE  // simulated dead&lt;br /&gt;
::::4  FIGHT   // try to intimidate &lt;br /&gt;
::::5  ESCAPE  // escape from touch&lt;br /&gt;
::::6  EVADE   // keep distance&lt;br /&gt;
::::7  FLIGHT  // run away  &lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;external control&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::This level is only requesting control if external commands are present in sensordata. The behaviour is self-reinforcing so once activated it keeps controlling the creature as long as new commands arrive within reasonable time. Note that Escape and Evade and Flight have priority, manual control has limits, the creature is autonomous!&lt;br /&gt;
&lt;br /&gt;
::::Goals: Stay free and prevent distress, but otherwise otherwise obey external commands.&lt;br /&gt;
::::8 MANUAL // How boring...&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;scan and move&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::This level is the heart of the brain. Reaching the first level of this layer (INTEGRATE) is rewarding. :::Everything is (locally) under control and a target goal can been set. This will also increase positive emotional level. INTEGRATE will inspect internal status, like battery level, and emotional states like exhaustion, excitatory state and modify the settings for ORIENT and MOVE accordingly. Options for ORIENTs setting are for instance random turn angles and low speed  for a drunkard&#039;s walk, phototaxis (pos. or neg.), odour pulse count or interval for kinesis behaviour, and PIR input (i. e. human) presence for more interactive behaviour. After this setting, INTEGRATE will inhibit the setting of the the INTEGRATE request flag for some time. Input from rotary encoders and/or motor commands) will re-trigger this inhibition of INTEGRATE so rotate and Orient can work. ROTATE will rotate around the body center until some sensory dead zone for the current target (just picked by INTEGRATE is reached. Move will drive forward and (together with ORIENT) allow the creature to move in the direction of the goal implied by ORIENT. ACCEPT checks sensory input for an acceptable stop position that might have food or a high quality resource. ACCEPT will increase positive emotional levels. FEED will become active when food is indeed available available, for instance, via bottom contacts and feeding will increase positive emotional levels even more.&lt;br /&gt;
&lt;br /&gt;
::::Goal: find out where and when and how to move and set a goal&lt;br /&gt;
::::9 INTEGRATE // combine inputs and decide what to do at this moment.&lt;br /&gt;
::::10 ORIENT // orient towards the current goal&lt;br /&gt;
::::11 MOVE // move forward towards the current goal&lt;br /&gt;
::::12 ACCEPT // accept the current position and stop&lt;br /&gt;
::::13 FEED // electrical food is the best!&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;appendage use&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::Not all accepted position will directly allow access to resources like a voltage source, or an object to collect. EXTEND will try to reach the resource by (surprise) extending an appendage. PROBE will conduct a local search for the resource, and USE will get or enjoy the resource.&lt;br /&gt;
&lt;br /&gt;
::::Goal: reach a high quality resource by extending an appendage&lt;br /&gt;
::::14  EXTEND // reach for a resource&lt;br /&gt;
::::15 PROBE // probe to make contact&lt;br /&gt;
::::16 USE // this is sooo good!&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;interaction&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::EXPLORE will search for fun, however that is defined at that moment, it might mean going back to some other location to drop a collected object. For more social tasks, it might be finding something or somebody to make contact with. When EXPLORE is succesfull and switches its request flag off, INTERACT will control the interactive behaviour performed. Both these levels may modify the inputs for the SCAN layer to keep focus. Interact will however also increase exhaustion that eventually will prevent allow SEEKREST to become active.&lt;br /&gt;
&lt;br /&gt;
::::Goal: if all previous goals were reached this is the final goal setting layer&lt;br /&gt;
::::17 EXPLORE // find the fun&lt;br /&gt;
::::18 INTERACT // and love it!&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;rest&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::All fun comes to and end, when exhaustion strikes many higer priority levels that monitor exhaustion levels will become inactive and SEEKREST will modify the the scan layer and the the goal to finding a suitable location to rest. If a suitable location is found SLEEP will get active and stay active until sensory input changes again. At that point it is rinse and repeat.&lt;br /&gt;
&lt;br /&gt;
::::Goal: reduce exhaustion, find a location to rest and sleep there.&lt;br /&gt;
::::19 SEEKREST // after hard work...&lt;br /&gt;
::::20 SLEEP // ... it is time to sleep!&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;Layer &amp;quot;default&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::If non of the other levels asks for control WAIT (that always requests control) switches off all motors, reduces power use as much as possible, and waits for input. This is &#039;&#039;never&#039;&#039; expected to happen!&lt;br /&gt;
&lt;br /&gt;
::::Goal: wait for input&lt;br /&gt;
::::21 WAIT // default, always requesting but never getting it... &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:: Stay tuned, more comming soon&lt;br /&gt;
&lt;br /&gt;
== Implementation details ==&lt;br /&gt;
: &#039;&#039;&#039;Stay tuned, more comming soon&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Anderson, D.P. (2007)&#039;&#039;&#039; https://www.dprg.org/articles/2007-03a/&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Bettosini et al., 2022&#039;&#039;&#039; Torocó: A Subsumption Architecture Implementation, in: 2022 8th International Conference on Automation, Robotics and Applications (ICARA) IEEE, Prague, Czech Republic, pp. 27–32. . https://doi.org/10.1109/ICARA55094.2022.9738521&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Brooks, R.A. (1986)&#039;&#039;&#039; A Robust Layer Control System for a Mobile Robot, IEEE Journal of Robotics and Automation RA-2, 14-23&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Rickenbacher (1975)&#039;&#039;&#039; Lernen und Motivation als relevanzgesteuerte Datenverarbeitung: Ein Computer-Simulationsmodell elementarer kognitiv-affektiver Prozesse. Birkhäuser Verag Basel.&lt;/div&gt;</summary>
		<author><name>Peterr</name></author>
	</entry>
	<entry>
		<id>https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15305</id>
		<title>Leaphy Robot</title>
		<link rel="alternate" type="text/html" href="https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15305"/>
		<updated>2025-10-01T21:47:36Z</updated>

		<summary type="html">&lt;p&gt;Peterr: /* Behavioural levels */  major upgrade&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Name=Leaphy robot with subsumption architecture&lt;br /&gt;
|Skills=software hardware electronics biology&lt;br /&gt;
|Status=Active&lt;br /&gt;
|Niche=robotics&lt;br /&gt;
|Purpose=Fun&lt;br /&gt;
|Picture=Leaphy back side view.jpg&lt;br /&gt;
|Tool=No&lt;br /&gt;
|Location=Space, home&lt;br /&gt;
|Cost=Very small given what is already present and what is available in the space (everything!!)&lt;br /&gt;
|Category=Electronics&lt;br /&gt;
}}&lt;br /&gt;
== Electronic insect-like creature ==&lt;br /&gt;
&#039;&#039;&#039;Physiological, Behavioural and environmental overview&#039;&#039;&#039; &amp;lt;br&amp;gt;&lt;br /&gt;
peterr 2022- 2025 (with &#039;&#039;very&#039;&#039; long pauses)&lt;br /&gt;
&lt;br /&gt;
====Document history====&lt;br /&gt;
* Currently this is a living document and this wiki contains the latest version&lt;br /&gt;
* September 2025 subsumption architecture design &amp;amp; transfer to nurdspace wiki&lt;br /&gt;
* August    2025 Documentation for scheduler&lt;br /&gt;
* March     2023 Draft version 0.2  - terminology cleanup and scope&lt;br /&gt;
* November  2022 First document sketches &amp;amp; ideas&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project==&lt;br /&gt;
The insect like creature based on the original [https://leaphy.store/product/leaphy-original-los/ leaphyrobot] has a set of functionalities that together allow it to effectively find, and feed on targets that provides electricity as a reward.&lt;br /&gt;
Learning strategies to improve success rate can be implemented.&lt;br /&gt;
Sexual signaling, event prediction, mating behaviour, genetic exchange and evolution are in principle possible but are currently still (far) out of scope. The system at it&#039;s highest level can be seen as a feedback loop: sensory input =&amp;gt; behavioural selection =&amp;gt; motor output =&amp;gt; new sensory input. The original design (2022) was meant to live in wind tunnel, and find odour sources to feed, but currently the emphasis has shifted from odour detection to more general sensory processing using subsumption architecture, [https://nurdspace.nl/Leaphy_Robot#Brain see below].&lt;br /&gt;
&lt;br /&gt;
== Sensory inputs ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Mechanoreceptor - sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
:::Micro switch based tactile hairs. &lt;br /&gt;
:::&#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Ultrasound - Distance sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
::: Ultrasonic pulses detect obstacles and trigger reflex avoidance behaviour&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Better directional responses would be possible with more than one US sensor. &lt;br /&gt;
:::: This would need a dedicated embedded processor. &lt;br /&gt;
:::: &#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing light intensity&#039;&#039;&#039;&lt;br /&gt;
::: Two LDR photoreceptors measure front-left light level and front-right light level&lt;br /&gt;
::: Total light intensity (sum) is available as an analog voltage&lt;br /&gt;
::: The difference between the inputs is also available, and signals what side to turn to, to approach or avoid the light.&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing sound (audio)&#039;&#039;&#039;&lt;br /&gt;
::: A subunit with its own processor, containing an Electret microphone to measure ambiant sound level, frequency and sound patterns. &lt;br /&gt;
::: Can be used in classical (Pawlow) and operand conditioning experiments. Will detect both absolute sound levels (for startle or avoidance responses) and can contain feature detectors (e.g. chirp intervals for leaf hopper like  communication and courting  behaviour of two leaphy&#039;s).  &lt;br /&gt;
::: In addition, an Audeme Movi speech recognition shield (see https://www.audeme.com/movi.html) could be used to process voice commands&lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented, but Movi shield &amp;quot;proof of concept&amp;quot; done&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;PIR movement sensor&#039;&#039;&#039;&lt;br /&gt;
::: In addition to light intensity, an infra red motion sensors can be used to detect movements (humans, or the cat for that matter) see for instance https://www.adafruit.com/product/4871 &lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented but PIR (similar to the adafruit thingy) available&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Sensing wind direction &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based tactile hairs?  Something like https://www.instructables.com/Low-Cost-Low-Speed-Wind-Sensor-1/ with shielding? or sensitive temperature measurements?&lt;br /&gt;
:::; Note: Wind direction sensing in the wind tunnel is currently replaced by sensing light gradients parallel to the wind direction because the wind sensor is not available yet. &lt;br /&gt;
:::: &#039;&#039;Development status: To be designed, high priority for the windtunnel version with odour processing as a main goal, low priority for the a free walking space/nurdspace version described here.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Volatiles (odours) &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based perception of volatiles like alcohol (fruit-fly like behaviours), Carbon dioxide (mosquito like behaviour), or VOC&#039;s (most plant eating insects). The sensor produces a voltage level proportional to the intensity of the stimulus. Using a threshold can generate a presence/absence signal. &lt;br /&gt;
::: The interval between odour pulses is a proxy for the distance to the source. Note that an odour &amp;quot;gradient&amp;quot; does not exist!&lt;br /&gt;
&lt;br /&gt;
::: Current implementation uses a SGP30 board. The time constant of the the sensor is in the order of 1 second, but &amp;quot;whiffs&amp;quot; of odour could be detected faster by using a feature detector that looks for sudden steps in the signal. This will also act as an sensory adaptation mechanism: in the absence of change the output go&#039;s to zero.&lt;br /&gt;
::: &#039;&#039;Development status: Sensor: worked, currently broken&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground color&#039;&#039;&#039;&lt;br /&gt;
::: This sensor measures ground colour and the output can be used to test for a particular condition (e.g. being at a target position). It can also be used to simulate trail pheromones implemented as colors next to the  trail followed. This sense can also take the role of short distance &amp;quot; present at target&amp;quot; stimuli.&lt;br /&gt;
::: &#039;&#039; Development status: Operational &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground reflection level&#039;&#039;&#039;&lt;br /&gt;
::: Two sensors &#039;line followers&#039; that both provide a binary present/absent signal of ground reflection.&lt;br /&gt;
::: Can be used to simulate trail following behaviour on a network of lines  (combined with (led) ground colours.&lt;br /&gt;
::: &#039;&#039;Development status: testing phase&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Future extensions: A combination of voltage levels and pulse frequency coding in the source could be used to simulate a spectrum of &amp;quot;chemical&amp;quot; inputs.  &lt;br /&gt;
:::: Feature detectors could extract particular frequencies and/or patterns to recognise for instance &amp;quot;&#039;&#039;toxic&#039;&#039;&amp;quot; substances. &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Proprioception (internal &amp;quot;feeling&amp;quot;)&#039;&#039;&#039;&lt;br /&gt;
::: Checking for instance for body movement when motors move, or for force feedback when extending electrical honey sucking mouthparts&lt;br /&gt;
::: Development status:To be developed, as yet low priority. &lt;br /&gt;
 &lt;br /&gt;
:: &#039;&#039;&#039;Sensing internal physiological states &#039;&#039;&#039;&lt;br /&gt;
:::To place electric reward information in perspective, some internal status information is needed, that is supplied by reading internal variables like energy levels (battery voltage , load current) or physiological state (internal variables like &amp;quot;ready to feed&amp;quot;. &lt;br /&gt;
::: More advances implementations could look up previous experiences, and rate of change in physiological status as well as brain hormone levels and excitation states (see below under internal states and hormones&amp;quot;).&lt;br /&gt;
:::Development status: To be designed.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing hormone levels&#039;&#039;&#039;&lt;br /&gt;
::: Certain activities or combinations of activities can stimulate the production of hormones. This could be implemented as slow changing values in memory. Hormone levels might modulate the effect of sensory input or behavioural output, and act as a slow form of memory.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing rewards and deterrents&#039;&#039;&#039;&lt;br /&gt;
::: Electronic organisms live on electricity, and are rewarded by sensing the presence of a voltage and current. This sensory organ is just sensing the analog voltage measured by the sensory organ. It simulates the perception of food such as nectar. Most logical position is at the tip of an appendage. &lt;br /&gt;
::: &#039;&#039;Development status: implemented and removed (needs mutiplexing). Mechanical movement (servo) to make electrical contact: testing phase.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Brain ==&lt;br /&gt;
::&#039;&#039;&#039;Subsumption architecture&#039;&#039;&#039;&lt;br /&gt;
:::The Electronic organisms has a software brain that receives sensory input both from the environment and internal status. The brain reads all inputs about every 50 msec, and produces command for actuators that produce behaviour. These behaviours can be as simple as a colour changes of a led (signaling sensory status) or movements of body and body and appendages. The aim is to make the lower levels as stateless as possible i.e. the brain uses its real time vision of the word as a model instead of some abstract internal representation. The processing principle roughly follow the subsumption architecture (Brooks 1986).&lt;br /&gt;
&lt;br /&gt;
:::Wikipedia writes about this technique:&lt;br /&gt;
::::&amp;quot;&#039;&#039;[Behaviours] are organized into a hierarchy of layers. Each layer implements a particular level of behavioral competence, and higher levels are able to subsume lower levels (= integrate/combine lower levels to a more comprehensive whole) in order to create viable behavior. For example, a robot&#039;s lowest layer could be &amp;quot;avoid an object&amp;quot;. The second layer would be &amp;quot;wander around&amp;quot;, which runs beneath the third layer &amp;quot;explore the world&amp;quot;.[...]The subsumption architecture creates a system in which the higher layers utilize the lower-level competencies. The layers, which all receive sensor-information, work in parallel and generate outputs. These outputs can be commands to actuators, or signals that suppress or inhibit other layers.&amp;quot;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::My current implementation uses the opposite order. The high priority levels conduct the simplest behavioural tasks, and when these high priority but simple behavioural levels are happy more complex task can get control. This approach is still experimental, but in any case easy enough to reverse again.&lt;br /&gt;
&lt;br /&gt;
:::The behavioural levels &#039;&#039;all&#039;&#039; compete for control of the robot. Each behavioural layer evaluates its sensory input and determines if it wants to control the outputs (to change its input according to its (implied) goal, e.g. mechanoreceptors (microswitches) will only request control if the switch is closed. After all the behavioural levels are evaluated, and their request flags set or reset an arbitrate routine  selects the highest active layer that will run the robot behaviorual output for the next 50 msec.&lt;br /&gt;
:::See Anderson (2007) for a clear explanations and actual implementation examples.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Brain subsystems&#039;&#039;&#039;&lt;br /&gt;
:::More complicated or slow tasks (like sound processing or US echo detection) can be executed in separate processor boards that report their status  to the main  controller. Conceptually this is not different from subroutines for tasks.&lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Nervous system&#039;&#039;&#039;&lt;br /&gt;
::: The currently (sort of) running implementation of the brain is using a real time loop in a very simple cooperative multitasking system ([https://yiweimao.github.io/blog/async_microcontroller/ YiweiMao scheduler]) and inmplemented on an Arduino Uno &lt;br /&gt;
::: &#039;&#039;Development status: operational, but under active development.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Associative memory&#039;&#039;&#039;&lt;br /&gt;
::: Associative memory in it current, simplest form will be implemented as memory locations for particular sensory input combinations.  inputs that coincide increase a counter for that combination (learning those combinations). This allows both Pawlow  and operand conditioning.&lt;br /&gt;
:::&#039;&#039;Development status: not yet implemented, proof of concept done ~50 years ago :).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Excitation state and hormones&#039;&#039;&#039;&lt;br /&gt;
::: Hormones are internal variables with levels that act as slow changing memory for previous (combinations of) states.&lt;br /&gt;
::: A default breakdown speed can be set that slowly decrease hormone levels. Particular sensory input could increase the levels again. Reaching high levels of certain hormones can be a goal in itself, and subject to learning behaviour.&lt;br /&gt;
::: &#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Satisfaction&#039;&#039;&#039;&lt;br /&gt;
:::Signals to end feeding behaviour can -in addition to electrical food running out- also come from internal signals (satiation, internal hormonal signals, (too) long time periods with little change of events)&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Future prediction&#039;&#039;&#039;&lt;br /&gt;
:::This is currently way out of scope, but neural-net like implementations that store event sequences, predict likely outcomes of current inputs and act accordingly are fully feasible.&lt;br /&gt;
::: See Rickenbacher 1975 for an example that is probably  a bit more traceable than -for instance- modern neural network code like Tensorflow. &lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Effectors ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;main motors&#039;&#039;&#039;&lt;br /&gt;
:::The main moves of the organism are implemented by two wheels driven by two [https://leaphy.store/product/tt-motor-10cm-jumper-female/ DC motors] with build in gearboxes) and a [https://leaphy.store/product/motor-shield/ motor shield]. Motor speed is controlled by pulse width modualation (PMW)) present in the processor. Steering is done by differential motorspeed, a third backside &amp;quot;wheel&amp;quot; is a simple short passive wooden stand. This works well on reasonable flat surfaces, but needs improvement is the next robot (Terzo).&lt;br /&gt;
:::&#039;&#039;Motor development status: Operational at a basic level, PID control and extra power at startup to get smooth startup at low speed is needed.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Movable mouthparts&#039;&#039;&#039;&lt;br /&gt;
:::Appendages like extendable mouthparts controlled by [https://isking-modellbahn.de/modelcraft-es-030-Servo-top-line-steuerelektronik servo]&#039;s can be used for feeding on electrical food. Currently one servo controlling a proboscis (mouthpart for feeding) is present.&lt;br /&gt;
:::&#039;&#039;Development status: Operational in priciple, untested in practice, needs 3D printing of parts&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;[https://leaphy.store/product/rgb-led-single/ Three colour led]&#039;&#039;&#039;&lt;br /&gt;
::: can be used for signaling status of whatever state we want.&lt;br /&gt;
:::&#039;&#039;Development status: Operational &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Piezo beeper &#039;&#039;&#039;&lt;br /&gt;
::: Present on the [https://leaphy.store/product/motor-shield/ motor shield] can be used to create a variety of sounds,for instance to signal happines, distress or alarm.&lt;br /&gt;
:::&#039;&#039;Development status: Operational, but specific sounds need to be designed&lt;br /&gt;
&lt;br /&gt;
== Behavioural levels ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:: Behaviour in subsumption architecture is organised in levels that compete for control, the highest priority behaviour (lowest rank, top of list) will control the robot for 50 msec.&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Overview of current behavioral levels and  their most important inputs for controlling requests&#039;&#039;&#039;. &lt;br /&gt;
:::Layers are only a naming convention, conceptually grouping behaviour with somewhat similar aims. Note that the ultimate goals of the system (here level SLEEP, see below) is determined by the order of the levels. Changing the order evidently will change the behavioural outcomes.  Currently the order is hard coded.&lt;br /&gt;
&lt;br /&gt;
:::High priority behavioural levels take care of the most basic and critical task. When their goals are reached (their requests for control stop), higher behavioural levels, (representing more advanced lower priority tasks will be able to run. Note however that higher levels can explicitly inhibit or even modify lower level behaviours under some circumstances for some time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
::See the actual calls for details.&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;Layer &amp;quot;distress&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::If unable to meet the absolute basic requirement for battery voltage or movement CALL for help. In STUCK, try reflexes to get loose, pause regular. If nothing works eventually HIBERNATE &lt;br /&gt;
&lt;br /&gt;
::::Goal:  deal with the really difficult situations &lt;br /&gt;
::::0  HIBERNATE // hope for better times...&lt;br /&gt;
::::1  STUCK // try to solve non-movement when motors run...&lt;br /&gt;
::::2  CALL  // call for help&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;stay free&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::The primary sensory input activating this level are Bumper sensors and Ultrasonics, but also hormones for high emotional levels reached by an overload of sensory input or a high number of failing tries to reach some goal. FREEZE will stop movement for an serious amount of time to reduce overload FIGHT will move quickly forward and get very close to an object possibly even disregarding US and bumpers and hitting the object. ESCAPE will try to free the bumpers EVADE will try to keep a safe distance from objects. FLIGHT will try to run straight for a relative long time (using a countdown timer) but will subsumed by lower levels.&lt;br /&gt;
&lt;br /&gt;
::::Goal: avoid stressors. &lt;br /&gt;
::::3  FREEZE  // simulated dead&lt;br /&gt;
::::4  FIGHT   // try to intimidate &lt;br /&gt;
::::5  ESCAPE  // escape from touch&lt;br /&gt;
::::6  EVADE   // keep distance&lt;br /&gt;
::::7  FLIGHT  // run away  &lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;external control&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::This level is only requesting control if external commands are present in sensordata. The behaviour is self-reinforcing so once activated it keeps controlling the creature as long as new commands arrive within reasonable time. Note that Escape and Evade and Flight have priority, manual control has limits, the creature is autonomous!&lt;br /&gt;
&lt;br /&gt;
::::Goals: Stay free and prevent distress, but otherwise otherwise obey external commands.&lt;br /&gt;
::::8 MANUAL // How boring...&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;scan and move&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::This level is the heart of the brain. Reaching the first level of this layer (INTEGRATE) is rewarding. :::Everything is (locally) under control and a target goal can been set. This will also increase positive emotional level. INTEGRATE will inspect internal status, like battery level, and emotional states like exhaustion, excitatory state and modify the settings for ORIENT and MOVE accordingly. Options for ORIENTs setting are for instance random turn angles and low speed  for a drunkard&#039;s walk, phototaxis (pos. or neg.), odour pulse count or interval for kinesis behaviour, and PIR input (i. e. human) presence for more interactive behaviour. After this setting, INTEGRATE will inhibit the setting of the the INTEGRATE request flag for some time. Input from rotary encoders and/or motor commands) will re-trigger this inhibition of INTEGRATE so rotate and Orient can work. ROTATE will rotate around the body center until some sensory dead zone for the current target (just picked by INTEGRATE is reached. Move will drive forward and (together with ORIENT) allow the creature to move in the direction of the goal implied by ORIENT. ACCEPT checks sensory input for an acceptable stop position that might have food or a high quality resource. ACCEPT will increase positive emotional levels. FEED will become active when food is indeed available available, for instance, via bottom contacts and feeding will increase positive emotional levels even more.&lt;br /&gt;
&lt;br /&gt;
::::Goal: find out where and when and how to move and set a goal&lt;br /&gt;
::::9 INTEGRATE // combine inputs and decide what to do at this moment.&lt;br /&gt;
::::10 ORIENT // orient towards the current goal&lt;br /&gt;
::::11 MOVE // move forward towards the current goal&lt;br /&gt;
::::12 ACCEPT // accept the current position and stop&lt;br /&gt;
::::13 FEED // electrical food is the best!&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;appendage use&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::Not all accepted position will directly allow access to resources like a voltage source, or an object to collect. EXTEND will try to reach the resource by (surprise) extending an appendage. PROBE will conduct a local search for the resource, and USE will get or enjoy the resource.&lt;br /&gt;
&lt;br /&gt;
::::Goal: reach a high quality resource by extending an appendage&lt;br /&gt;
::::14  EXTEND // reach for a resource&lt;br /&gt;
::::15 PROBE // probe to make contact&lt;br /&gt;
::::16 USE // this is sooo good!&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;interaction&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::EXPLORE will search for fun, however that is defined at that moment, it might mean going back to some other location to drop a collected object. For more social tasks, it might be finding something or somebody to make contact with. When EXPLORE is succesfull and switches its request flag off, INTERACT will control the interactive behaviour performed. Both these levels may modify the inputs for the SCAN layer to keep focus. Interact will however also increase exhaustion that eventually will prevent allow SEEKREST to become active.&lt;br /&gt;
&lt;br /&gt;
::::Goal: if all previous goals were reached this is the final goal setting layer&lt;br /&gt;
::::17 EXPLORE // find the fun&lt;br /&gt;
::::18 INTERACT // and love it!&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;rest&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::All fun comes to and end, when exhaustion strikes many higer priority levels that monitor exhaustion levels will become inactive and SEEKREST will modify the the scan layer and the the goal to finding a suitable location to rest. If a suitable location is found SLEEP will get active and stay active until sensory input changes again. At that point it is rinse and repeat.&lt;br /&gt;
&lt;br /&gt;
::::Goal: reduce exhaustion, find a location to rest and sleep there.&lt;br /&gt;
::::19 SEEKREST // after hard work...&lt;br /&gt;
::::20 SLEEP // ... it is time to sleep!&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;Layer &amp;quot;default&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::If non of the other levels asks for control WAIT (that always requests control) switches off all motors, reduces power use as much as possible, and waits for input. This is &#039;&#039;never&#039;&#039; expected to happen!&lt;br /&gt;
&lt;br /&gt;
::::Goal: wait for input&lt;br /&gt;
::::21 WAIT // default, always requesting but never getting it... &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:: Stay tuned, more comming soon&lt;br /&gt;
&lt;br /&gt;
== Implementation details ==&lt;br /&gt;
: Stay tuned, more comming soon&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Anderson, D.P. (2007)&#039;&#039;&#039; https://www.dprg.org/articles/2007-03a/&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Bettosini et al., 2022&#039;&#039;&#039; Torocó: A Subsumption Architecture Implementation, in: 2022 8th International Conference on Automation, Robotics and Applications (ICARA) IEEE, Prague, Czech Republic, pp. 27–32. . https://doi.org/10.1109/ICARA55094.2022.9738521&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Brooks, R.A. (1986)&#039;&#039;&#039; A Robust Layer Control System for a Mobile Robot, IEEE Journal of Robotics and Automation RA-2, 14-23&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Rickenbacher (1975)&#039;&#039;&#039; Lernen und Motivation als relevanzgesteuerte Datenverarbeitung: Ein Computer-Simulationsmodell elementarer kognitiv-affektiver Prozesse. Birkhäuser Verag Basel.&lt;/div&gt;</summary>
		<author><name>Peterr</name></author>
	</entry>
	<entry>
		<id>https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15304</id>
		<title>Leaphy Robot</title>
		<link rel="alternate" type="text/html" href="https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15304"/>
		<updated>2025-10-01T21:39:44Z</updated>

		<summary type="html">&lt;p&gt;Peterr: /* Behavioural levels */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Name=Leaphy robot with subsumption architecture&lt;br /&gt;
|Skills=software hardware electronics biology&lt;br /&gt;
|Status=Active&lt;br /&gt;
|Niche=robotics&lt;br /&gt;
|Purpose=Fun&lt;br /&gt;
|Picture=Leaphy back side view.jpg&lt;br /&gt;
|Tool=No&lt;br /&gt;
|Location=Space, home&lt;br /&gt;
|Cost=Very small given what is already present and what is available in the space (everything!!)&lt;br /&gt;
|Category=Electronics&lt;br /&gt;
}}&lt;br /&gt;
== Electronic insect-like creature ==&lt;br /&gt;
&#039;&#039;&#039;Physiological, Behavioural and environmental overview&#039;&#039;&#039; &amp;lt;br&amp;gt;&lt;br /&gt;
peterr 2022- 2025 (with &#039;&#039;very&#039;&#039; long pauses)&lt;br /&gt;
&lt;br /&gt;
====Document history====&lt;br /&gt;
* Currently this is a living document and this wiki contains the latest version&lt;br /&gt;
* September 2025 subsumption architecture design &amp;amp; transfer to nurdspace wiki&lt;br /&gt;
* August    2025 Documentation for scheduler&lt;br /&gt;
* March     2023 Draft version 0.2  - terminology cleanup and scope&lt;br /&gt;
* November  2022 First document sketches &amp;amp; ideas&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project==&lt;br /&gt;
The insect like creature based on the original [https://leaphy.store/product/leaphy-original-los/ leaphyrobot] has a set of functionalities that together allow it to effectively find, and feed on targets that provides electricity as a reward.&lt;br /&gt;
Learning strategies to improve success rate can be implemented.&lt;br /&gt;
Sexual signaling, event prediction, mating behaviour, genetic exchange and evolution are in principle possible but are currently still (far) out of scope. The system at it&#039;s highest level can be seen as a feedback loop: sensory input =&amp;gt; behavioural selection =&amp;gt; motor output =&amp;gt; new sensory input. The original design (2022) was meant to live in wind tunnel, and find odour sources to feed, but currently the emphasis has shifted from odour detection to more general sensory processing using subsumption architecture, [https://nurdspace.nl/Leaphy_Robot#Brain see below].&lt;br /&gt;
&lt;br /&gt;
== Sensory inputs ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Mechanoreceptor - sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
:::Micro switch based tactile hairs. &lt;br /&gt;
:::&#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Ultrasound - Distance sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
::: Ultrasonic pulses detect obstacles and trigger reflex avoidance behaviour&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Better directional responses would be possible with more than one US sensor. &lt;br /&gt;
:::: This would need a dedicated embedded processor. &lt;br /&gt;
:::: &#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing light intensity&#039;&#039;&#039;&lt;br /&gt;
::: Two LDR photoreceptors measure front-left light level and front-right light level&lt;br /&gt;
::: Total light intensity (sum) is available as an analog voltage&lt;br /&gt;
::: The difference between the inputs is also available, and signals what side to turn to, to approach or avoid the light.&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing sound (audio)&#039;&#039;&#039;&lt;br /&gt;
::: A subunit with its own processor, containing an Electret microphone to measure ambiant sound level, frequency and sound patterns. &lt;br /&gt;
::: Can be used in classical (Pawlow) and operand conditioning experiments. Will detect both absolute sound levels (for startle or avoidance responses) and can contain feature detectors (e.g. chirp intervals for leaf hopper like  communication and courting  behaviour of two leaphy&#039;s).  &lt;br /&gt;
::: In addition, an Audeme Movi speech recognition shield (see https://www.audeme.com/movi.html) could be used to process voice commands&lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented, but Movi shield &amp;quot;proof of concept&amp;quot; done&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;PIR movement sensor&#039;&#039;&#039;&lt;br /&gt;
::: In addition to light intensity, an infra red motion sensors can be used to detect movements (humans, or the cat for that matter) see for instance https://www.adafruit.com/product/4871 &lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented but PIR (similar to the adafruit thingy) available&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Sensing wind direction &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based tactile hairs?  Something like https://www.instructables.com/Low-Cost-Low-Speed-Wind-Sensor-1/ with shielding? or sensitive temperature measurements?&lt;br /&gt;
:::; Note: Wind direction sensing in the wind tunnel is currently replaced by sensing light gradients parallel to the wind direction because the wind sensor is not available yet. &lt;br /&gt;
:::: &#039;&#039;Development status: To be designed, high priority for the windtunnel version with odour processing as a main goal, low priority for the a free walking space/nurdspace version described here.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Volatiles (odours) &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based perception of volatiles like alcohol (fruit-fly like behaviours), Carbon dioxide (mosquito like behaviour), or VOC&#039;s (most plant eating insects). The sensor produces a voltage level proportional to the intensity of the stimulus. Using a threshold can generate a presence/absence signal. &lt;br /&gt;
::: The interval between odour pulses is a proxy for the distance to the source. Note that an odour &amp;quot;gradient&amp;quot; does not exist!&lt;br /&gt;
&lt;br /&gt;
::: Current implementation uses a SGP30 board. The time constant of the the sensor is in the order of 1 second, but &amp;quot;whiffs&amp;quot; of odour could be detected faster by using a feature detector that looks for sudden steps in the signal. This will also act as an sensory adaptation mechanism: in the absence of change the output go&#039;s to zero.&lt;br /&gt;
::: &#039;&#039;Development status: Sensor: worked, currently broken&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground color&#039;&#039;&#039;&lt;br /&gt;
::: This sensor measures ground colour and the output can be used to test for a particular condition (e.g. being at a target position). It can also be used to simulate trail pheromones implemented as colors next to the  trail followed. This sense can also take the role of short distance &amp;quot; present at target&amp;quot; stimuli.&lt;br /&gt;
::: &#039;&#039; Development status: Operational &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground reflection level&#039;&#039;&#039;&lt;br /&gt;
::: Two sensors &#039;line followers&#039; that both provide a binary present/absent signal of ground reflection.&lt;br /&gt;
::: Can be used to simulate trail following behaviour on a network of lines  (combined with (led) ground colours.&lt;br /&gt;
::: &#039;&#039;Development status: testing phase&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Future extensions: A combination of voltage levels and pulse frequency coding in the source could be used to simulate a spectrum of &amp;quot;chemical&amp;quot; inputs.  &lt;br /&gt;
:::: Feature detectors could extract particular frequencies and/or patterns to recognise for instance &amp;quot;&#039;&#039;toxic&#039;&#039;&amp;quot; substances. &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Proprioception (internal &amp;quot;feeling&amp;quot;)&#039;&#039;&#039;&lt;br /&gt;
::: Checking for instance for body movement when motors move, or for force feedback when extending electrical honey sucking mouthparts&lt;br /&gt;
::: Development status:To be developed, as yet low priority. &lt;br /&gt;
 &lt;br /&gt;
:: &#039;&#039;&#039;Sensing internal physiological states &#039;&#039;&#039;&lt;br /&gt;
:::To place electric reward information in perspective, some internal status information is needed, that is supplied by reading internal variables like energy levels (battery voltage , load current) or physiological state (internal variables like &amp;quot;ready to feed&amp;quot;. &lt;br /&gt;
::: More advances implementations could look up previous experiences, and rate of change in physiological status as well as brain hormone levels and excitation states (see below under internal states and hormones&amp;quot;).&lt;br /&gt;
:::Development status: To be designed.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing hormone levels&#039;&#039;&#039;&lt;br /&gt;
::: Certain activities or combinations of activities can stimulate the production of hormones. This could be implemented as slow changing values in memory. Hormone levels might modulate the effect of sensory input or behavioural output, and act as a slow form of memory.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing rewards and deterrents&#039;&#039;&#039;&lt;br /&gt;
::: Electronic organisms live on electricity, and are rewarded by sensing the presence of a voltage and current. This sensory organ is just sensing the analog voltage measured by the sensory organ. It simulates the perception of food such as nectar. Most logical position is at the tip of an appendage. &lt;br /&gt;
::: &#039;&#039;Development status: implemented and removed (needs mutiplexing). Mechanical movement (servo) to make electrical contact: testing phase.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Brain ==&lt;br /&gt;
::&#039;&#039;&#039;Subsumption architecture&#039;&#039;&#039;&lt;br /&gt;
:::The Electronic organisms has a software brain that receives sensory input both from the environment and internal status. The brain reads all inputs about every 50 msec, and produces command for actuators that produce behaviour. These behaviours can be as simple as a colour changes of a led (signaling sensory status) or movements of body and body and appendages. The aim is to make the lower levels as stateless as possible i.e. the brain uses its real time vision of the word as a model instead of some abstract internal representation. The processing principle roughly follow the subsumption architecture (Brooks 1986).&lt;br /&gt;
&lt;br /&gt;
:::Wikipedia writes about this technique:&lt;br /&gt;
::::&amp;quot;&#039;&#039;[Behaviours] are organized into a hierarchy of layers. Each layer implements a particular level of behavioral competence, and higher levels are able to subsume lower levels (= integrate/combine lower levels to a more comprehensive whole) in order to create viable behavior. For example, a robot&#039;s lowest layer could be &amp;quot;avoid an object&amp;quot;. The second layer would be &amp;quot;wander around&amp;quot;, which runs beneath the third layer &amp;quot;explore the world&amp;quot;.[...]The subsumption architecture creates a system in which the higher layers utilize the lower-level competencies. The layers, which all receive sensor-information, work in parallel and generate outputs. These outputs can be commands to actuators, or signals that suppress or inhibit other layers.&amp;quot;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::My current implementation uses the opposite order. The high priority levels conduct the simplest behavioural tasks, and when these high priority but simple behavioural levels are happy more complex task can get control. This approach is still experimental, but in any case easy enough to reverse again.&lt;br /&gt;
&lt;br /&gt;
:::The behavioural levels &#039;&#039;all&#039;&#039; compete for control of the robot. Each behavioural layer evaluates its sensory input and determines if it wants to control the outputs (to change its input according to its (implied) goal, e.g. mechanoreceptors (microswitches) will only request control if the switch is closed. After all the behavioural levels are evaluated, and their request flags set or reset an arbitrate routine  selects the highest active layer that will run the robot behaviorual output for the next 50 msec.&lt;br /&gt;
:::See Anderson (2007) for a clear explanations and actual implementation examples.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Brain subsystems&#039;&#039;&#039;&lt;br /&gt;
:::More complicated or slow tasks (like sound processing or US echo detection) can be executed in separate processor boards that report their status  to the main  controller. Conceptually this is not different from subroutines for tasks.&lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Nervous system&#039;&#039;&#039;&lt;br /&gt;
::: The currently (sort of) running implementation of the brain is using a real time loop in a very simple cooperative multitasking system ([https://yiweimao.github.io/blog/async_microcontroller/ YiweiMao scheduler]) and inmplemented on an Arduino Uno &lt;br /&gt;
::: &#039;&#039;Development status: operational, but under active development.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Associative memory&#039;&#039;&#039;&lt;br /&gt;
::: Associative memory in it current, simplest form will be implemented as memory locations for particular sensory input combinations.  inputs that coincide increase a counter for that combination (learning those combinations). This allows both Pawlow  and operand conditioning.&lt;br /&gt;
:::&#039;&#039;Development status: not yet implemented, proof of concept done ~50 years ago :).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Excitation state and hormones&#039;&#039;&#039;&lt;br /&gt;
::: Hormones are internal variables with levels that act as slow changing memory for previous (combinations of) states.&lt;br /&gt;
::: A default breakdown speed can be set that slowly decrease hormone levels. Particular sensory input could increase the levels again. Reaching high levels of certain hormones can be a goal in itself, and subject to learning behaviour.&lt;br /&gt;
::: &#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Satisfaction&#039;&#039;&#039;&lt;br /&gt;
:::Signals to end feeding behaviour can -in addition to electrical food running out- also come from internal signals (satiation, internal hormonal signals, (too) long time periods with little change of events)&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Future prediction&#039;&#039;&#039;&lt;br /&gt;
:::This is currently way out of scope, but neural-net like implementations that store event sequences, predict likely outcomes of current inputs and act accordingly are fully feasible.&lt;br /&gt;
::: See Rickenbacher 1975 for an example that is probably  a bit more traceable than -for instance- modern neural network code like Tensorflow. &lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Effectors ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;main motors&#039;&#039;&#039;&lt;br /&gt;
:::The main moves of the organism are implemented by two wheels driven by two [https://leaphy.store/product/tt-motor-10cm-jumper-female/ DC motors] with build in gearboxes) and a [https://leaphy.store/product/motor-shield/ motor shield]. Motor speed is controlled by pulse width modualation (PMW)) present in the processor. Steering is done by differential motorspeed, a third backside &amp;quot;wheel&amp;quot; is a simple short passive wooden stand. This works well on reasonable flat surfaces, but needs improvement is the next robot (Terzo).&lt;br /&gt;
:::&#039;&#039;Motor development status: Operational at a basic level, PID control and extra power at startup to get smooth startup at low speed is needed.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Movable mouthparts&#039;&#039;&#039;&lt;br /&gt;
:::Appendages like extendable mouthparts controlled by [https://isking-modellbahn.de/modelcraft-es-030-Servo-top-line-steuerelektronik servo]&#039;s can be used for feeding on electrical food. Currently one servo controlling a proboscis (mouthpart for feeding) is present.&lt;br /&gt;
:::&#039;&#039;Development status: Operational in priciple, untested in practice, needs 3D printing of parts&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;[https://leaphy.store/product/rgb-led-single/ Three colour led]&#039;&#039;&#039;&lt;br /&gt;
::: can be used for signaling status of whatever state we want.&lt;br /&gt;
:::&#039;&#039;Development status: Operational &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Piezo beeper &#039;&#039;&#039;&lt;br /&gt;
::: Present on the [https://leaphy.store/product/motor-shield/ motor shield] can be used to create a variety of sounds,for instance to signal happines, distress or alarm.&lt;br /&gt;
:::&#039;&#039;Development status: Operational, but specific sounds need to be designed&lt;br /&gt;
&lt;br /&gt;
== Behavioural levels ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:: Behaviour in subsumption architecture is organised in levels that compete for control, the highest priority behaviour (lowest rank, top of list) will control the robot for 50 msec.&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Overview of current behavioral levels and  their most important inputs for controlling requests&#039;&#039;&#039;. &lt;br /&gt;
:::Layers are only a naming convention, conceptually grouping behaviour with somewhat similar aims. Note that the ultimate goals of the system (here level SLEEP, see below) is determined by the order of the levels. Changing the order evidently will change the behavioural outcomes.  Currently the order is hard coded.&lt;br /&gt;
&lt;br /&gt;
:::High priority behavioural levels take care of the most basic and critical task. When their goals are reached (their requests for control stop), higher behavioural levels, (representing more advanced lower priority tasks will be able to run. Note however that higher levels can explicitly inhibit or even modify lower level behaviours under some circumstances for some time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
::See the actual calls for details.&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;Layer &amp;quot;distress&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::If unable to meet the absolute basic requirement for battery voltage or movement CALL for help. In STUCK, try reflexes to get loose, pause regular. If nothing works eventually HIBERNATE &lt;br /&gt;
&lt;br /&gt;
::::Goal:  deal with the really difficult situations &lt;br /&gt;
::::0  HIBERNATE // hope for better times...&lt;br /&gt;
::::1  STUCK // try to solve non-movement when motors run...&lt;br /&gt;
::::2  CALL  // call for help&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;stay free&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::The primary sensory input activating this level are Bumper sensors and Ultrasonics, but also hormones for high emotional levels reached by an overload of sensory input or a high number of failing tries to reach some goal. FREEZE will stop movement for an serious amount of time to reduce overload FIGHT will move quickly forward and get very close to an object possibly even disregarding US and bumpers and hitting the object. ESCAPE will try to free the bumpers EVADE will try to keep a safe distance from objects. FLIGHT will try to run straight for a relative long time (using a countdown timer) but will subsumed by lower levels.&lt;br /&gt;
&lt;br /&gt;
::::Goal: avoid stressors. &lt;br /&gt;
::::3  FREEZE  // simulated dead&lt;br /&gt;
::::4  FIGHT   // try to intimidate &lt;br /&gt;
::::5  ESCAPE  // escape from touch&lt;br /&gt;
::::6  EVADE   // keep distance&lt;br /&gt;
::::7  FLIGHT  // run away  &lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;external control&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::This level is only requesting control if external commands are present in sensordata. The behaviour is self-reinforcing so once activated it keeps controlling the creature as long as new commands arrive within reasonable time. Note that Escape and Evade and Flight have priority, manual control has limits, the creature is autonomous!&lt;br /&gt;
&lt;br /&gt;
::::Goals: Stay free and prevent distress, but otherwise otherwise obey external commands.&lt;br /&gt;
::::8 MANUAL // How boring...&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;scan and move&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::This level is the heart of the brain. Reaching the first level of this layer (INTEGRATE) is rewarding. :::Everything is (locally) under control and a target goal can been set. This will also increase positive emotional level. INTEGRATE will inspect internal status, like battery level, and emotional states like exhaustion, excitatory state and modify the settings for ORIENT and MOVE accordingly. Options for ORIENTs setting are for instance random turn angles and low speed  for a drunkard&#039;s walk, phototaxis (pos. or neg.), odour pulse count or interval for kinesis behaviour, and PIR input (i. e. human) presence for more interactive behaviour. After this setting, INTEGRATE will inhibit the setting of the the INTEGRATE request flag for some time. Input from rotary encoders and/or motor commands) will re-trigger this inhibition of INTEGRATE so rotate and Orient can work. ROTATE will rotate around the body center until some sensory dead zone for the current target (just picked by INTEGRATE is reached. Move will drive forward and (together with ORIENT) allow the creature to move in the direction of the goal implied by ORIENT. ACCEPT checks sensory input for an acceptable stop position that might have food or a high quality resource. ACCEPT will increase positive emotional levels. FEED will become active when food is indeed available available, for instance, via bottom contacts and feeding will increase positive emotional levels even more.&lt;br /&gt;
&lt;br /&gt;
::::Goal: find out where and when and how to move and set a goal&lt;br /&gt;
::::9 INTEGRATE // combine inputs and decide what to do at this moment.&lt;br /&gt;
::::10 ORIENT // orient towards the current goal&lt;br /&gt;
::::11 MOVE // move forward towards the current goal&lt;br /&gt;
::::12 ACCEPT // accept the current position and stop&lt;br /&gt;
::::13 FEED // electrical food is the best!&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;appendage use&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::Not all accepted position will directly allow access to resources like a voltage source, or an object to collect. EXTEND will try to reach the resource by (surprise) extending an appendage. PROBE will conduct a local search for the resource, and USE will get or enjoy the resource.&lt;br /&gt;
&lt;br /&gt;
::::Goal: reach a high quality resource by extending an appendage&lt;br /&gt;
::::14  EXTEND // reach for a resource&lt;br /&gt;
::::15 PROBE // probe to make contact&lt;br /&gt;
::::16 USE // this is sooo good!&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;interaction&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::EXPLORE will search for fun, however that is defined at that moment, it might mean going back to some other location to drop a collected object. For more social tasks, it might be finding something or somebody to make contact with. When EXPLORE is succesfull and switches its request flag off, INTERACT will control the interactive behaviour performed. Both these levels may modify the inputs for the SCAN layer to keep focus. Interact will however also increase exhaustion that eventually will prevent allow SEEKREST to become active.&lt;br /&gt;
&lt;br /&gt;
::::Goal: if all previous goals were reached this is the final goal setting layer&lt;br /&gt;
::::17 EXPLORE // find the fun&lt;br /&gt;
::::18 INTERACT // and love it!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:: Stay tuned, more comming soon&lt;br /&gt;
&lt;br /&gt;
== Implementation details ==&lt;br /&gt;
: Stay tuned, more comming soon&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Anderson, D.P. (2007)&#039;&#039;&#039; https://www.dprg.org/articles/2007-03a/&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Bettosini et al., 2022&#039;&#039;&#039; Torocó: A Subsumption Architecture Implementation, in: 2022 8th International Conference on Automation, Robotics and Applications (ICARA) IEEE, Prague, Czech Republic, pp. 27–32. . https://doi.org/10.1109/ICARA55094.2022.9738521&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Brooks, R.A. (1986)&#039;&#039;&#039; A Robust Layer Control System for a Mobile Robot, IEEE Journal of Robotics and Automation RA-2, 14-23&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Rickenbacher (1975)&#039;&#039;&#039; Lernen und Motivation als relevanzgesteuerte Datenverarbeitung: Ein Computer-Simulationsmodell elementarer kognitiv-affektiver Prozesse. Birkhäuser Verag Basel.&lt;/div&gt;</summary>
		<author><name>Peterr</name></author>
	</entry>
	<entry>
		<id>https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15303</id>
		<title>Leaphy Robot</title>
		<link rel="alternate" type="text/html" href="https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15303"/>
		<updated>2025-10-01T21:30:23Z</updated>

		<summary type="html">&lt;p&gt;Peterr: /* Behavioural levels */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Name=Leaphy robot with subsumption architecture&lt;br /&gt;
|Skills=software hardware electronics biology&lt;br /&gt;
|Status=Active&lt;br /&gt;
|Niche=robotics&lt;br /&gt;
|Purpose=Fun&lt;br /&gt;
|Picture=Leaphy back side view.jpg&lt;br /&gt;
|Tool=No&lt;br /&gt;
|Location=Space, home&lt;br /&gt;
|Cost=Very small given what is already present and what is available in the space (everything!!)&lt;br /&gt;
|Category=Electronics&lt;br /&gt;
}}&lt;br /&gt;
== Electronic insect-like creature ==&lt;br /&gt;
&#039;&#039;&#039;Physiological, Behavioural and environmental overview&#039;&#039;&#039; &amp;lt;br&amp;gt;&lt;br /&gt;
peterr 2022- 2025 (with &#039;&#039;very&#039;&#039; long pauses)&lt;br /&gt;
&lt;br /&gt;
====Document history====&lt;br /&gt;
* Currently this is a living document and this wiki contains the latest version&lt;br /&gt;
* September 2025 subsumption architecture design &amp;amp; transfer to nurdspace wiki&lt;br /&gt;
* August    2025 Documentation for scheduler&lt;br /&gt;
* March     2023 Draft version 0.2  - terminology cleanup and scope&lt;br /&gt;
* November  2022 First document sketches &amp;amp; ideas&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project==&lt;br /&gt;
The insect like creature based on the original [https://leaphy.store/product/leaphy-original-los/ leaphyrobot] has a set of functionalities that together allow it to effectively find, and feed on targets that provides electricity as a reward.&lt;br /&gt;
Learning strategies to improve success rate can be implemented.&lt;br /&gt;
Sexual signaling, event prediction, mating behaviour, genetic exchange and evolution are in principle possible but are currently still (far) out of scope. The system at it&#039;s highest level can be seen as a feedback loop: sensory input =&amp;gt; behavioural selection =&amp;gt; motor output =&amp;gt; new sensory input. The original design (2022) was meant to live in wind tunnel, and find odour sources to feed, but currently the emphasis has shifted from odour detection to more general sensory processing using subsumption architecture, [https://nurdspace.nl/Leaphy_Robot#Brain see below].&lt;br /&gt;
&lt;br /&gt;
== Sensory inputs ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Mechanoreceptor - sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
:::Micro switch based tactile hairs. &lt;br /&gt;
:::&#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Ultrasound - Distance sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
::: Ultrasonic pulses detect obstacles and trigger reflex avoidance behaviour&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Better directional responses would be possible with more than one US sensor. &lt;br /&gt;
:::: This would need a dedicated embedded processor. &lt;br /&gt;
:::: &#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing light intensity&#039;&#039;&#039;&lt;br /&gt;
::: Two LDR photoreceptors measure front-left light level and front-right light level&lt;br /&gt;
::: Total light intensity (sum) is available as an analog voltage&lt;br /&gt;
::: The difference between the inputs is also available, and signals what side to turn to, to approach or avoid the light.&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing sound (audio)&#039;&#039;&#039;&lt;br /&gt;
::: A subunit with its own processor, containing an Electret microphone to measure ambiant sound level, frequency and sound patterns. &lt;br /&gt;
::: Can be used in classical (Pawlow) and operand conditioning experiments. Will detect both absolute sound levels (for startle or avoidance responses) and can contain feature detectors (e.g. chirp intervals for leaf hopper like  communication and courting  behaviour of two leaphy&#039;s).  &lt;br /&gt;
::: In addition, an Audeme Movi speech recognition shield (see https://www.audeme.com/movi.html) could be used to process voice commands&lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented, but Movi shield &amp;quot;proof of concept&amp;quot; done&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;PIR movement sensor&#039;&#039;&#039;&lt;br /&gt;
::: In addition to light intensity, an infra red motion sensors can be used to detect movements (humans, or the cat for that matter) see for instance https://www.adafruit.com/product/4871 &lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented but PIR (similar to the adafruit thingy) available&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Sensing wind direction &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based tactile hairs?  Something like https://www.instructables.com/Low-Cost-Low-Speed-Wind-Sensor-1/ with shielding? or sensitive temperature measurements?&lt;br /&gt;
:::; Note: Wind direction sensing in the wind tunnel is currently replaced by sensing light gradients parallel to the wind direction because the wind sensor is not available yet. &lt;br /&gt;
:::: &#039;&#039;Development status: To be designed, high priority for the windtunnel version with odour processing as a main goal, low priority for the a free walking space/nurdspace version described here.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Volatiles (odours) &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based perception of volatiles like alcohol (fruit-fly like behaviours), Carbon dioxide (mosquito like behaviour), or VOC&#039;s (most plant eating insects). The sensor produces a voltage level proportional to the intensity of the stimulus. Using a threshold can generate a presence/absence signal. &lt;br /&gt;
::: The interval between odour pulses is a proxy for the distance to the source. Note that an odour &amp;quot;gradient&amp;quot; does not exist!&lt;br /&gt;
&lt;br /&gt;
::: Current implementation uses a SGP30 board. The time constant of the the sensor is in the order of 1 second, but &amp;quot;whiffs&amp;quot; of odour could be detected faster by using a feature detector that looks for sudden steps in the signal. This will also act as an sensory adaptation mechanism: in the absence of change the output go&#039;s to zero.&lt;br /&gt;
::: &#039;&#039;Development status: Sensor: worked, currently broken&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground color&#039;&#039;&#039;&lt;br /&gt;
::: This sensor measures ground colour and the output can be used to test for a particular condition (e.g. being at a target position). It can also be used to simulate trail pheromones implemented as colors next to the  trail followed. This sense can also take the role of short distance &amp;quot; present at target&amp;quot; stimuli.&lt;br /&gt;
::: &#039;&#039; Development status: Operational &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground reflection level&#039;&#039;&#039;&lt;br /&gt;
::: Two sensors &#039;line followers&#039; that both provide a binary present/absent signal of ground reflection.&lt;br /&gt;
::: Can be used to simulate trail following behaviour on a network of lines  (combined with (led) ground colours.&lt;br /&gt;
::: &#039;&#039;Development status: testing phase&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Future extensions: A combination of voltage levels and pulse frequency coding in the source could be used to simulate a spectrum of &amp;quot;chemical&amp;quot; inputs.  &lt;br /&gt;
:::: Feature detectors could extract particular frequencies and/or patterns to recognise for instance &amp;quot;&#039;&#039;toxic&#039;&#039;&amp;quot; substances. &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Proprioception (internal &amp;quot;feeling&amp;quot;)&#039;&#039;&#039;&lt;br /&gt;
::: Checking for instance for body movement when motors move, or for force feedback when extending electrical honey sucking mouthparts&lt;br /&gt;
::: Development status:To be developed, as yet low priority. &lt;br /&gt;
 &lt;br /&gt;
:: &#039;&#039;&#039;Sensing internal physiological states &#039;&#039;&#039;&lt;br /&gt;
:::To place electric reward information in perspective, some internal status information is needed, that is supplied by reading internal variables like energy levels (battery voltage , load current) or physiological state (internal variables like &amp;quot;ready to feed&amp;quot;. &lt;br /&gt;
::: More advances implementations could look up previous experiences, and rate of change in physiological status as well as brain hormone levels and excitation states (see below under internal states and hormones&amp;quot;).&lt;br /&gt;
:::Development status: To be designed.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing hormone levels&#039;&#039;&#039;&lt;br /&gt;
::: Certain activities or combinations of activities can stimulate the production of hormones. This could be implemented as slow changing values in memory. Hormone levels might modulate the effect of sensory input or behavioural output, and act as a slow form of memory.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing rewards and deterrents&#039;&#039;&#039;&lt;br /&gt;
::: Electronic organisms live on electricity, and are rewarded by sensing the presence of a voltage and current. This sensory organ is just sensing the analog voltage measured by the sensory organ. It simulates the perception of food such as nectar. Most logical position is at the tip of an appendage. &lt;br /&gt;
::: &#039;&#039;Development status: implemented and removed (needs mutiplexing). Mechanical movement (servo) to make electrical contact: testing phase.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Brain ==&lt;br /&gt;
::&#039;&#039;&#039;Subsumption architecture&#039;&#039;&#039;&lt;br /&gt;
:::The Electronic organisms has a software brain that receives sensory input both from the environment and internal status. The brain reads all inputs about every 50 msec, and produces command for actuators that produce behaviour. These behaviours can be as simple as a colour changes of a led (signaling sensory status) or movements of body and body and appendages. The aim is to make the lower levels as stateless as possible i.e. the brain uses its real time vision of the word as a model instead of some abstract internal representation. The processing principle roughly follow the subsumption architecture (Brooks 1986).&lt;br /&gt;
&lt;br /&gt;
:::Wikipedia writes about this technique:&lt;br /&gt;
::::&amp;quot;&#039;&#039;[Behaviours] are organized into a hierarchy of layers. Each layer implements a particular level of behavioral competence, and higher levels are able to subsume lower levels (= integrate/combine lower levels to a more comprehensive whole) in order to create viable behavior. For example, a robot&#039;s lowest layer could be &amp;quot;avoid an object&amp;quot;. The second layer would be &amp;quot;wander around&amp;quot;, which runs beneath the third layer &amp;quot;explore the world&amp;quot;.[...]The subsumption architecture creates a system in which the higher layers utilize the lower-level competencies. The layers, which all receive sensor-information, work in parallel and generate outputs. These outputs can be commands to actuators, or signals that suppress or inhibit other layers.&amp;quot;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::My current implementation uses the opposite order. The high priority levels conduct the simplest behavioural tasks, and when these high priority but simple behavioural levels are happy more complex task can get control. This approach is still experimental, but in any case easy enough to reverse again.&lt;br /&gt;
&lt;br /&gt;
:::The behavioural levels &#039;&#039;all&#039;&#039; compete for control of the robot. Each behavioural layer evaluates its sensory input and determines if it wants to control the outputs (to change its input according to its (implied) goal, e.g. mechanoreceptors (microswitches) will only request control if the switch is closed. After all the behavioural levels are evaluated, and their request flags set or reset an arbitrate routine  selects the highest active layer that will run the robot behaviorual output for the next 50 msec.&lt;br /&gt;
:::See Anderson (2007) for a clear explanations and actual implementation examples.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Brain subsystems&#039;&#039;&#039;&lt;br /&gt;
:::More complicated or slow tasks (like sound processing or US echo detection) can be executed in separate processor boards that report their status  to the main  controller. Conceptually this is not different from subroutines for tasks.&lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Nervous system&#039;&#039;&#039;&lt;br /&gt;
::: The currently (sort of) running implementation of the brain is using a real time loop in a very simple cooperative multitasking system ([https://yiweimao.github.io/blog/async_microcontroller/ YiweiMao scheduler]) and inmplemented on an Arduino Uno &lt;br /&gt;
::: &#039;&#039;Development status: operational, but under active development.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Associative memory&#039;&#039;&#039;&lt;br /&gt;
::: Associative memory in it current, simplest form will be implemented as memory locations for particular sensory input combinations.  inputs that coincide increase a counter for that combination (learning those combinations). This allows both Pawlow  and operand conditioning.&lt;br /&gt;
:::&#039;&#039;Development status: not yet implemented, proof of concept done ~50 years ago :).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Excitation state and hormones&#039;&#039;&#039;&lt;br /&gt;
::: Hormones are internal variables with levels that act as slow changing memory for previous (combinations of) states.&lt;br /&gt;
::: A default breakdown speed can be set that slowly decrease hormone levels. Particular sensory input could increase the levels again. Reaching high levels of certain hormones can be a goal in itself, and subject to learning behaviour.&lt;br /&gt;
::: &#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Satisfaction&#039;&#039;&#039;&lt;br /&gt;
:::Signals to end feeding behaviour can -in addition to electrical food running out- also come from internal signals (satiation, internal hormonal signals, (too) long time periods with little change of events)&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Future prediction&#039;&#039;&#039;&lt;br /&gt;
:::This is currently way out of scope, but neural-net like implementations that store event sequences, predict likely outcomes of current inputs and act accordingly are fully feasible.&lt;br /&gt;
::: See Rickenbacher 1975 for an example that is probably  a bit more traceable than -for instance- modern neural network code like Tensorflow. &lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Effectors ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;main motors&#039;&#039;&#039;&lt;br /&gt;
:::The main moves of the organism are implemented by two wheels driven by two [https://leaphy.store/product/tt-motor-10cm-jumper-female/ DC motors] with build in gearboxes) and a [https://leaphy.store/product/motor-shield/ motor shield]. Motor speed is controlled by pulse width modualation (PMW)) present in the processor. Steering is done by differential motorspeed, a third backside &amp;quot;wheel&amp;quot; is a simple short passive wooden stand. This works well on reasonable flat surfaces, but needs improvement is the next robot (Terzo).&lt;br /&gt;
:::&#039;&#039;Motor development status: Operational at a basic level, PID control and extra power at startup to get smooth startup at low speed is needed.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Movable mouthparts&#039;&#039;&#039;&lt;br /&gt;
:::Appendages like extendable mouthparts controlled by [https://isking-modellbahn.de/modelcraft-es-030-Servo-top-line-steuerelektronik servo]&#039;s can be used for feeding on electrical food. Currently one servo controlling a proboscis (mouthpart for feeding) is present.&lt;br /&gt;
:::&#039;&#039;Development status: Operational in priciple, untested in practice, needs 3D printing of parts&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;[https://leaphy.store/product/rgb-led-single/ Three colour led]&#039;&#039;&#039;&lt;br /&gt;
::: can be used for signaling status of whatever state we want.&lt;br /&gt;
:::&#039;&#039;Development status: Operational &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Piezo beeper &#039;&#039;&#039;&lt;br /&gt;
::: Present on the [https://leaphy.store/product/motor-shield/ motor shield] can be used to create a variety of sounds,for instance to signal happines, distress or alarm.&lt;br /&gt;
:::&#039;&#039;Development status: Operational, but specific sounds need to be designed&lt;br /&gt;
&lt;br /&gt;
== Behavioural levels ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:: Behaviour in subsumption architecture is organised in levels that compete for control, the highest priority behaviour (lowest rank, top of list) will control the robot for 50 msec.&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Overview of current behavioral levels and  their most important inputs for controlling requests&#039;&#039;&#039;. &lt;br /&gt;
:::Layers are only a naming convention, conceptually grouping behaviour with somewhat similar aims. Note that the ultimate goals of the system (here level SLEEP, see below) is determined by the order of the levels. Changing the order evidently will change the behavioural outcomes.  Currently the order is hard coded.&lt;br /&gt;
&lt;br /&gt;
:::High priority behavioural levels take care of the most basic and critical task. When their goals are reached (their requests for control stop), higher behavioural levels, (representing more advanced lower priority tasks will be able to run. Note however that higher levels can explicitly inhibit or even modify lower level behaviours under some circumstances for some time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
::See the actual calls for details.&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;Layer &amp;quot;distress&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::If unable to meet the absolute basic requirement for battery voltage or movement CALL for help. In STUCK, try reflexes to get loose, pause regular. If nothing works eventually HIBERNATE &lt;br /&gt;
&lt;br /&gt;
::::Goal:  deal with the really difficult situations &lt;br /&gt;
::::0  HIBERNATE // hope for better times...&lt;br /&gt;
::::1  STUCK // try to solve non-movement when motors run...&lt;br /&gt;
::::2  CALL  // call for help&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;stay free&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::The primary sensory input activating this level are Bumper sensors and Ultrasonics, but also hormones for high emotional levels reached by an overload of sensory input or a high number of failing tries to reach some goal. FREEZE will stop movement for an serious amount of time to reduce overload FIGHT will move quickly forward and get very close to an object possibly even disregarding US and bumpers and hitting the object. ESCAPE will try to free the bumpers EVADE will try to keep a safe distance from objects. FLIGHT will try to run straight for a relative long time (using a countdown timer) but will subsumed by lower levels.&lt;br /&gt;
&lt;br /&gt;
::::Goal: avoid stressors. &lt;br /&gt;
::::3  FREEZE  // simulated dead&lt;br /&gt;
::::4  FIGHT   // try to intimidate &lt;br /&gt;
::::5  ESCAPE  // escape from touch&lt;br /&gt;
::::6  EVADE   // keep distance&lt;br /&gt;
::::7  FLIGHT  // run away  &lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;external control&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::This level is only requesting control if external commands are present in sensordata. The behaviour is self-reinforcing so once activated it keeps controlling the creature as long as new commands arrive within reasonable time. Note that Escape and Evade and Flight have priority, manual control has limits, the creature is autonomous!&lt;br /&gt;
&lt;br /&gt;
::::Goals: Stay free and prevent distress, but otherwise otherwise obey external commands.&lt;br /&gt;
::::8 MANUAL // How boring...&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;scan and move&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::This level is the heart of the brain. Reaching the first level of this layer (INTEGRATE) is rewarding. :::Everything is (locally) under control and a target goal can been set. This will also increase positive emotional level. INTEGRATE will inspect internal status, like battery level, and emotional states like exhaustion, excitatory state and modify the settings for ORIENT and MOVE accordingly. Options for ORIENTs setting are for instance random turn angles and low speed  for a drunkard&#039;s walk, phototaxis (pos. or neg.), odour pulse count or interval for kinesis behaviour, and PIR input (i. e. human) presence for more interactive behaviour. After this setting, INTEGRATE will inhibit the setting of the the INTEGRATE request flag for some time. Input from rotary encoders and/or motor commands) will re-trigger this inhibition of INTEGRATE so rotate and Orient can work. ROTATE will rotate around the body centre until some sensory dead zone for the current target (just picked by INTEGRATE is reached. Move will drive forward and (together with ORIENT) allow the creature to move in the direction of the goal implied by ORIENT. ACCEPT checks sensory input for an acceptable stop position that might have food or a high quality resource. ACCEPT will increase positive emotional levels. FEED will become active when food is indeed available available, for instance, via bottom contacts and feeding will increase positive emotional levels even more.&lt;br /&gt;
&lt;br /&gt;
::::Goal: find out where and when and how to move and set a goal&lt;br /&gt;
::::9 INTEGRATE // combine inputs and decide what to do at this moment.&lt;br /&gt;
::::10 ORIENT // orient towards the current goal&lt;br /&gt;
::::11 MOVE // move forward towards the current goal&lt;br /&gt;
::::12 ACCEPT // accept the current position and stop&lt;br /&gt;
::::13 FEED // electrical food is the best!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:: Stay tuned, more comming soon&lt;br /&gt;
&lt;br /&gt;
== Implementation details ==&lt;br /&gt;
: Stay tuned, more comming soon&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Anderson, D.P. (2007)&#039;&#039;&#039; https://www.dprg.org/articles/2007-03a/&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Bettosini et al., 2022&#039;&#039;&#039; Torocó: A Subsumption Architecture Implementation, in: 2022 8th International Conference on Automation, Robotics and Applications (ICARA) IEEE, Prague, Czech Republic, pp. 27–32. . https://doi.org/10.1109/ICARA55094.2022.9738521&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Brooks, R.A. (1986)&#039;&#039;&#039; A Robust Layer Control System for a Mobile Robot, IEEE Journal of Robotics and Automation RA-2, 14-23&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Rickenbacher (1975)&#039;&#039;&#039; Lernen und Motivation als relevanzgesteuerte Datenverarbeitung: Ein Computer-Simulationsmodell elementarer kognitiv-affektiver Prozesse. Birkhäuser Verag Basel.&lt;/div&gt;</summary>
		<author><name>Peterr</name></author>
	</entry>
	<entry>
		<id>https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15302</id>
		<title>Leaphy Robot</title>
		<link rel="alternate" type="text/html" href="https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15302"/>
		<updated>2025-10-01T21:17:41Z</updated>

		<summary type="html">&lt;p&gt;Peterr: /* Behavioural levels */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Name=Leaphy robot with subsumption architecture&lt;br /&gt;
|Skills=software hardware electronics biology&lt;br /&gt;
|Status=Active&lt;br /&gt;
|Niche=robotics&lt;br /&gt;
|Purpose=Fun&lt;br /&gt;
|Picture=Leaphy back side view.jpg&lt;br /&gt;
|Tool=No&lt;br /&gt;
|Location=Space, home&lt;br /&gt;
|Cost=Very small given what is already present and what is available in the space (everything!!)&lt;br /&gt;
|Category=Electronics&lt;br /&gt;
}}&lt;br /&gt;
== Electronic insect-like creature ==&lt;br /&gt;
&#039;&#039;&#039;Physiological, Behavioural and environmental overview&#039;&#039;&#039; &amp;lt;br&amp;gt;&lt;br /&gt;
peterr 2022- 2025 (with &#039;&#039;very&#039;&#039; long pauses)&lt;br /&gt;
&lt;br /&gt;
====Document history====&lt;br /&gt;
* Currently this is a living document and this wiki contains the latest version&lt;br /&gt;
* September 2025 subsumption architecture design &amp;amp; transfer to nurdspace wiki&lt;br /&gt;
* August    2025 Documentation for scheduler&lt;br /&gt;
* March     2023 Draft version 0.2  - terminology cleanup and scope&lt;br /&gt;
* November  2022 First document sketches &amp;amp; ideas&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project==&lt;br /&gt;
The insect like creature based on the original [https://leaphy.store/product/leaphy-original-los/ leaphyrobot] has a set of functionalities that together allow it to effectively find, and feed on targets that provides electricity as a reward.&lt;br /&gt;
Learning strategies to improve success rate can be implemented.&lt;br /&gt;
Sexual signaling, event prediction, mating behaviour, genetic exchange and evolution are in principle possible but are currently still (far) out of scope. The system at it&#039;s highest level can be seen as a feedback loop: sensory input =&amp;gt; behavioural selection =&amp;gt; motor output =&amp;gt; new sensory input. The original design (2022) was meant to live in wind tunnel, and find odour sources to feed, but currently the emphasis has shifted from odour detection to more general sensory processing using subsumption architecture, [https://nurdspace.nl/Leaphy_Robot#Brain see below].&lt;br /&gt;
&lt;br /&gt;
== Sensory inputs ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Mechanoreceptor - sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
:::Micro switch based tactile hairs. &lt;br /&gt;
:::&#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Ultrasound - Distance sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
::: Ultrasonic pulses detect obstacles and trigger reflex avoidance behaviour&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Better directional responses would be possible with more than one US sensor. &lt;br /&gt;
:::: This would need a dedicated embedded processor. &lt;br /&gt;
:::: &#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing light intensity&#039;&#039;&#039;&lt;br /&gt;
::: Two LDR photoreceptors measure front-left light level and front-right light level&lt;br /&gt;
::: Total light intensity (sum) is available as an analog voltage&lt;br /&gt;
::: The difference between the inputs is also available, and signals what side to turn to, to approach or avoid the light.&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing sound (audio)&#039;&#039;&#039;&lt;br /&gt;
::: A subunit with its own processor, containing an Electret microphone to measure ambiant sound level, frequency and sound patterns. &lt;br /&gt;
::: Can be used in classical (Pawlow) and operand conditioning experiments. Will detect both absolute sound levels (for startle or avoidance responses) and can contain feature detectors (e.g. chirp intervals for leaf hopper like  communication and courting  behaviour of two leaphy&#039;s).  &lt;br /&gt;
::: In addition, an Audeme Movi speech recognition shield (see https://www.audeme.com/movi.html) could be used to process voice commands&lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented, but Movi shield &amp;quot;proof of concept&amp;quot; done&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;PIR movement sensor&#039;&#039;&#039;&lt;br /&gt;
::: In addition to light intensity, an infra red motion sensors can be used to detect movements (humans, or the cat for that matter) see for instance https://www.adafruit.com/product/4871 &lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented but PIR (similar to the adafruit thingy) available&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Sensing wind direction &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based tactile hairs?  Something like https://www.instructables.com/Low-Cost-Low-Speed-Wind-Sensor-1/ with shielding? or sensitive temperature measurements?&lt;br /&gt;
:::; Note: Wind direction sensing in the wind tunnel is currently replaced by sensing light gradients parallel to the wind direction because the wind sensor is not available yet. &lt;br /&gt;
:::: &#039;&#039;Development status: To be designed, high priority for the windtunnel version with odour processing as a main goal, low priority for the a free walking space/nurdspace version described here.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Volatiles (odours) &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based perception of volatiles like alcohol (fruit-fly like behaviours), Carbon dioxide (mosquito like behaviour), or VOC&#039;s (most plant eating insects). The sensor produces a voltage level proportional to the intensity of the stimulus. Using a threshold can generate a presence/absence signal. &lt;br /&gt;
::: The interval between odour pulses is a proxy for the distance to the source. Note that an odour &amp;quot;gradient&amp;quot; does not exist!&lt;br /&gt;
&lt;br /&gt;
::: Current implementation uses a SGP30 board. The time constant of the the sensor is in the order of 1 second, but &amp;quot;whiffs&amp;quot; of odour could be detected faster by using a feature detector that looks for sudden steps in the signal. This will also act as an sensory adaptation mechanism: in the absence of change the output go&#039;s to zero.&lt;br /&gt;
::: &#039;&#039;Development status: Sensor: worked, currently broken&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground color&#039;&#039;&#039;&lt;br /&gt;
::: This sensor measures ground colour and the output can be used to test for a particular condition (e.g. being at a target position). It can also be used to simulate trail pheromones implemented as colors next to the  trail followed. This sense can also take the role of short distance &amp;quot; present at target&amp;quot; stimuli.&lt;br /&gt;
::: &#039;&#039; Development status: Operational &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground reflection level&#039;&#039;&#039;&lt;br /&gt;
::: Two sensors &#039;line followers&#039; that both provide a binary present/absent signal of ground reflection.&lt;br /&gt;
::: Can be used to simulate trail following behaviour on a network of lines  (combined with (led) ground colours.&lt;br /&gt;
::: &#039;&#039;Development status: testing phase&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Future extensions: A combination of voltage levels and pulse frequency coding in the source could be used to simulate a spectrum of &amp;quot;chemical&amp;quot; inputs.  &lt;br /&gt;
:::: Feature detectors could extract particular frequencies and/or patterns to recognise for instance &amp;quot;&#039;&#039;toxic&#039;&#039;&amp;quot; substances. &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Proprioception (internal &amp;quot;feeling&amp;quot;)&#039;&#039;&#039;&lt;br /&gt;
::: Checking for instance for body movement when motors move, or for force feedback when extending electrical honey sucking mouthparts&lt;br /&gt;
::: Development status:To be developed, as yet low priority. &lt;br /&gt;
 &lt;br /&gt;
:: &#039;&#039;&#039;Sensing internal physiological states &#039;&#039;&#039;&lt;br /&gt;
:::To place electric reward information in perspective, some internal status information is needed, that is supplied by reading internal variables like energy levels (battery voltage , load current) or physiological state (internal variables like &amp;quot;ready to feed&amp;quot;. &lt;br /&gt;
::: More advances implementations could look up previous experiences, and rate of change in physiological status as well as brain hormone levels and excitation states (see below under internal states and hormones&amp;quot;).&lt;br /&gt;
:::Development status: To be designed.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing hormone levels&#039;&#039;&#039;&lt;br /&gt;
::: Certain activities or combinations of activities can stimulate the production of hormones. This could be implemented as slow changing values in memory. Hormone levels might modulate the effect of sensory input or behavioural output, and act as a slow form of memory.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing rewards and deterrents&#039;&#039;&#039;&lt;br /&gt;
::: Electronic organisms live on electricity, and are rewarded by sensing the presence of a voltage and current. This sensory organ is just sensing the analog voltage measured by the sensory organ. It simulates the perception of food such as nectar. Most logical position is at the tip of an appendage. &lt;br /&gt;
::: &#039;&#039;Development status: implemented and removed (needs mutiplexing). Mechanical movement (servo) to make electrical contact: testing phase.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Brain ==&lt;br /&gt;
::&#039;&#039;&#039;Subsumption architecture&#039;&#039;&#039;&lt;br /&gt;
:::The Electronic organisms has a software brain that receives sensory input both from the environment and internal status. The brain reads all inputs about every 50 msec, and produces command for actuators that produce behaviour. These behaviours can be as simple as a colour changes of a led (signaling sensory status) or movements of body and body and appendages. The aim is to make the lower levels as stateless as possible i.e. the brain uses its real time vision of the word as a model instead of some abstract internal representation. The processing principle roughly follow the subsumption architecture (Brooks 1986).&lt;br /&gt;
&lt;br /&gt;
:::Wikipedia writes about this technique:&lt;br /&gt;
::::&amp;quot;&#039;&#039;[Behaviours] are organized into a hierarchy of layers. Each layer implements a particular level of behavioral competence, and higher levels are able to subsume lower levels (= integrate/combine lower levels to a more comprehensive whole) in order to create viable behavior. For example, a robot&#039;s lowest layer could be &amp;quot;avoid an object&amp;quot;. The second layer would be &amp;quot;wander around&amp;quot;, which runs beneath the third layer &amp;quot;explore the world&amp;quot;.[...]The subsumption architecture creates a system in which the higher layers utilize the lower-level competencies. The layers, which all receive sensor-information, work in parallel and generate outputs. These outputs can be commands to actuators, or signals that suppress or inhibit other layers.&amp;quot;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::My current implementation uses the opposite order. The high priority levels conduct the simplest behavioural tasks, and when these high priority but simple behavioural levels are happy more complex task can get control. This approach is still experimental, but in any case easy enough to reverse again.&lt;br /&gt;
&lt;br /&gt;
:::The behavioural levels &#039;&#039;all&#039;&#039; compete for control of the robot. Each behavioural layer evaluates its sensory input and determines if it wants to control the outputs (to change its input according to its (implied) goal, e.g. mechanoreceptors (microswitches) will only request control if the switch is closed. After all the behavioural levels are evaluated, and their request flags set or reset an arbitrate routine  selects the highest active layer that will run the robot behaviorual output for the next 50 msec.&lt;br /&gt;
:::See Anderson (2007) for a clear explanations and actual implementation examples.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Brain subsystems&#039;&#039;&#039;&lt;br /&gt;
:::More complicated or slow tasks (like sound processing or US echo detection) can be executed in separate processor boards that report their status  to the main  controller. Conceptually this is not different from subroutines for tasks.&lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Nervous system&#039;&#039;&#039;&lt;br /&gt;
::: The currently (sort of) running implementation of the brain is using a real time loop in a very simple cooperative multitasking system ([https://yiweimao.github.io/blog/async_microcontroller/ YiweiMao scheduler]) and inmplemented on an Arduino Uno &lt;br /&gt;
::: &#039;&#039;Development status: operational, but under active development.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Associative memory&#039;&#039;&#039;&lt;br /&gt;
::: Associative memory in it current, simplest form will be implemented as memory locations for particular sensory input combinations.  inputs that coincide increase a counter for that combination (learning those combinations). This allows both Pawlow  and operand conditioning.&lt;br /&gt;
:::&#039;&#039;Development status: not yet implemented, proof of concept done ~50 years ago :).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Excitation state and hormones&#039;&#039;&#039;&lt;br /&gt;
::: Hormones are internal variables with levels that act as slow changing memory for previous (combinations of) states.&lt;br /&gt;
::: A default breakdown speed can be set that slowly decrease hormone levels. Particular sensory input could increase the levels again. Reaching high levels of certain hormones can be a goal in itself, and subject to learning behaviour.&lt;br /&gt;
::: &#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Satisfaction&#039;&#039;&#039;&lt;br /&gt;
:::Signals to end feeding behaviour can -in addition to electrical food running out- also come from internal signals (satiation, internal hormonal signals, (too) long time periods with little change of events)&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Future prediction&#039;&#039;&#039;&lt;br /&gt;
:::This is currently way out of scope, but neural-net like implementations that store event sequences, predict likely outcomes of current inputs and act accordingly are fully feasible.&lt;br /&gt;
::: See Rickenbacher 1975 for an example that is probably  a bit more traceable than -for instance- modern neural network code like Tensorflow. &lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Effectors ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;main motors&#039;&#039;&#039;&lt;br /&gt;
:::The main moves of the organism are implemented by two wheels driven by two [https://leaphy.store/product/tt-motor-10cm-jumper-female/ DC motors] with build in gearboxes) and a [https://leaphy.store/product/motor-shield/ motor shield]. Motor speed is controlled by pulse width modualation (PMW)) present in the processor. Steering is done by differential motorspeed, a third backside &amp;quot;wheel&amp;quot; is a simple short passive wooden stand. This works well on reasonable flat surfaces, but needs improvement is the next robot (Terzo).&lt;br /&gt;
:::&#039;&#039;Motor development status: Operational at a basic level, PID control and extra power at startup to get smooth startup at low speed is needed.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Movable mouthparts&#039;&#039;&#039;&lt;br /&gt;
:::Appendages like extendable mouthparts controlled by [https://isking-modellbahn.de/modelcraft-es-030-Servo-top-line-steuerelektronik servo]&#039;s can be used for feeding on electrical food. Currently one servo controlling a proboscis (mouthpart for feeding) is present.&lt;br /&gt;
:::&#039;&#039;Development status: Operational in priciple, untested in practice, needs 3D printing of parts&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;[https://leaphy.store/product/rgb-led-single/ Three colour led]&#039;&#039;&#039;&lt;br /&gt;
::: can be used for signaling status of whatever state we want.&lt;br /&gt;
:::&#039;&#039;Development status: Operational &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Piezo beeper &#039;&#039;&#039;&lt;br /&gt;
::: Present on the [https://leaphy.store/product/motor-shield/ motor shield] can be used to create a variety of sounds,for instance to signal happines, distress or alarm.&lt;br /&gt;
:::&#039;&#039;Development status: Operational, but specific sounds need to be designed&lt;br /&gt;
&lt;br /&gt;
== Behavioural levels ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:: Behaviour in subsumption architecture is organised in levels that compete for control, the highest priority behaviour (lowest rank, top of list) will control the robot for 50 msec.&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Overview of current behavioral levels and  their most important inputs for controlling requests&#039;&#039;&#039;. &lt;br /&gt;
:::Layers are only a naming convention, conceptually grouping behaviour with somewhat similar aims. Note that the ultimate goals of the system (here level SLEEP, see below) is determined by the order of the levels. Changing the order evidently will change the behavioural outcomes.  Currently the order is hard coded.&lt;br /&gt;
&lt;br /&gt;
:::High priority behavioural levels take care of the most basic and critical task. When their goals are reached (their requests for control stop), higher behavioural levels, (representing more advanced lower priority tasks will be able to run. Note however that higher levels can explicitly inhibit or even modify lower level behaviours under some circumstances for some time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
::See the actual calls for details.&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;Layer &amp;quot;distress&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::If unable to meet the absolute basic requirement for battery voltage or movement CALL for help. In STUCK, try reflexes to get loose, pause regular. If nothing works eventually HIBERNATE &lt;br /&gt;
&lt;br /&gt;
::::Goal:  deal with the really difficult situations &lt;br /&gt;
::::0  HIBERNATE // hope for better times...&lt;br /&gt;
::::1  STUCK // try to solve non-movement when motors run...&lt;br /&gt;
::::2  CALL  // call for help&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;stay free&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::The primary sensory input activating this level are Bumper sensors and Ultrasonics, but also hormones for high emotional levels reached by an overload of sensory input or a high number of failing tries to reach some goal. Freeze will stop movement for an serious amount of time to reduce overload Fight will move quickly forward and get very close to an object possibly even disregarding US and bumpers and hitting the object. Escape will try to free the bumpers Evade will try keep a safe distance from objects Flight will try to run straight for a relative long time (using a countdown timer) but will subsumed by lower levels.&lt;br /&gt;
&lt;br /&gt;
::::Goal: avoid stressors. &lt;br /&gt;
::::3  FREEZE  // simulated dead&lt;br /&gt;
::::4  FIGHT   // Try to intimidate &lt;br /&gt;
::::5  ESCAPE  // Escape from touch&lt;br /&gt;
::::6  EVADE   // keep distance&lt;br /&gt;
::::7  FLIGHT  // run away  &lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;external control&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::This level is only requesting control if external commands are present in sensordata. The behaviour is self-reinforcing so once activated it keeps controlling the creature as long as new commands arrive within reasonable time. Note that Escape and Evade and Flight have priority, manual control has limits, the creature is autonomous!&lt;br /&gt;
&lt;br /&gt;
::::Goals: Stay free and prevent distress, but otherwise otherwise obey external commands.&lt;br /&gt;
::::8 MANUAL&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;scan and move&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::This level is the heart of the brain. Reaching the first level of this layer (INTEGRATE) is rewarding. :::Everything is (locally) under control and a target goal can been set. This will also increase positive emotional level. INTEGRATE will inspect internal status, like battery level, and emotional states like exhaustion, excitatory state and modify the settings for ORIENT and MOVE acordingly. Options for ORIENTs setting are for instance random turn angles and low speed  for a drukard&#039;s walk,phototxis (pos. or neg), odour pulsecount or interval for kinesis behaviour, and PIR input (i. e. human) presense for more interactive behaviour. After this setting it will inhibit the setting of the the INTEGRATE request flag for some time. Input from rotary encoders and/or motor commands) will retrigger this inhibition of INTEGRATE so rotate and Orient can work. ROTATE will rotate around the body centre until some sensory dead zone for the current target (just picked by INTGRATE is reached. Move will drive forward and (together with ORIENT) allow the creatue to move in the direction of the goal implied by ORIENT. ACCEPT checks sensory input for an acceptable stop position that might have food  or a high quality resource. Accept will increase positive emotional levels. FEED will ill become active when food is indeed available available, for istance via bottom contacts and will increase positive emotianal levels even more.&lt;br /&gt;
&lt;br /&gt;
::::Goal: find out where and when and how to move and set a goal&lt;br /&gt;
::::9 INTEGRATE // combine inputs and decide what to do at this moment.&lt;br /&gt;
::::10 ORIENT // orient towards the current goal&lt;br /&gt;
::::11 MOVE // move forward towards the current goal&lt;br /&gt;
::::12 ACCEPT // accept the current position and stop&lt;br /&gt;
::::13 FEED // electrical food is the best!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:: Stay tuned, more comming soon&lt;br /&gt;
&lt;br /&gt;
== Implementation details ==&lt;br /&gt;
: Stay tuned, more comming soon&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Anderson, D.P. (2007)&#039;&#039;&#039; https://www.dprg.org/articles/2007-03a/&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Bettosini et al., 2022&#039;&#039;&#039; Torocó: A Subsumption Architecture Implementation, in: 2022 8th International Conference on Automation, Robotics and Applications (ICARA) IEEE, Prague, Czech Republic, pp. 27–32. . https://doi.org/10.1109/ICARA55094.2022.9738521&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Brooks, R.A. (1986)&#039;&#039;&#039; A Robust Layer Control System for a Mobile Robot, IEEE Journal of Robotics and Automation RA-2, 14-23&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Rickenbacher (1975)&#039;&#039;&#039; Lernen und Motivation als relevanzgesteuerte Datenverarbeitung: Ein Computer-Simulationsmodell elementarer kognitiv-affektiver Prozesse. Birkhäuser Verag Basel.&lt;/div&gt;</summary>
		<author><name>Peterr</name></author>
	</entry>
	<entry>
		<id>https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15301</id>
		<title>Leaphy Robot</title>
		<link rel="alternate" type="text/html" href="https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15301"/>
		<updated>2025-10-01T21:16:43Z</updated>

		<summary type="html">&lt;p&gt;Peterr: /* Behavioural levels */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Name=Leaphy robot with subsumption architecture&lt;br /&gt;
|Skills=software hardware electronics biology&lt;br /&gt;
|Status=Active&lt;br /&gt;
|Niche=robotics&lt;br /&gt;
|Purpose=Fun&lt;br /&gt;
|Picture=Leaphy back side view.jpg&lt;br /&gt;
|Tool=No&lt;br /&gt;
|Location=Space, home&lt;br /&gt;
|Cost=Very small given what is already present and what is available in the space (everything!!)&lt;br /&gt;
|Category=Electronics&lt;br /&gt;
}}&lt;br /&gt;
== Electronic insect-like creature ==&lt;br /&gt;
&#039;&#039;&#039;Physiological, Behavioural and environmental overview&#039;&#039;&#039; &amp;lt;br&amp;gt;&lt;br /&gt;
peterr 2022- 2025 (with &#039;&#039;very&#039;&#039; long pauses)&lt;br /&gt;
&lt;br /&gt;
====Document history====&lt;br /&gt;
* Currently this is a living document and this wiki contains the latest version&lt;br /&gt;
* September 2025 subsumption architecture design &amp;amp; transfer to nurdspace wiki&lt;br /&gt;
* August    2025 Documentation for scheduler&lt;br /&gt;
* March     2023 Draft version 0.2  - terminology cleanup and scope&lt;br /&gt;
* November  2022 First document sketches &amp;amp; ideas&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project==&lt;br /&gt;
The insect like creature based on the original [https://leaphy.store/product/leaphy-original-los/ leaphyrobot] has a set of functionalities that together allow it to effectively find, and feed on targets that provides electricity as a reward.&lt;br /&gt;
Learning strategies to improve success rate can be implemented.&lt;br /&gt;
Sexual signaling, event prediction, mating behaviour, genetic exchange and evolution are in principle possible but are currently still (far) out of scope. The system at it&#039;s highest level can be seen as a feedback loop: sensory input =&amp;gt; behavioural selection =&amp;gt; motor output =&amp;gt; new sensory input. The original design (2022) was meant to live in wind tunnel, and find odour sources to feed, but currently the emphasis has shifted from odour detection to more general sensory processing using subsumption architecture, [https://nurdspace.nl/Leaphy_Robot#Brain see below].&lt;br /&gt;
&lt;br /&gt;
== Sensory inputs ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Mechanoreceptor - sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
:::Micro switch based tactile hairs. &lt;br /&gt;
:::&#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Ultrasound - Distance sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
::: Ultrasonic pulses detect obstacles and trigger reflex avoidance behaviour&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Better directional responses would be possible with more than one US sensor. &lt;br /&gt;
:::: This would need a dedicated embedded processor. &lt;br /&gt;
:::: &#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing light intensity&#039;&#039;&#039;&lt;br /&gt;
::: Two LDR photoreceptors measure front-left light level and front-right light level&lt;br /&gt;
::: Total light intensity (sum) is available as an analog voltage&lt;br /&gt;
::: The difference between the inputs is also available, and signals what side to turn to, to approach or avoid the light.&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing sound (audio)&#039;&#039;&#039;&lt;br /&gt;
::: A subunit with its own processor, containing an Electret microphone to measure ambiant sound level, frequency and sound patterns. &lt;br /&gt;
::: Can be used in classical (Pawlow) and operand conditioning experiments. Will detect both absolute sound levels (for startle or avoidance responses) and can contain feature detectors (e.g. chirp intervals for leaf hopper like  communication and courting  behaviour of two leaphy&#039;s).  &lt;br /&gt;
::: In addition, an Audeme Movi speech recognition shield (see https://www.audeme.com/movi.html) could be used to process voice commands&lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented, but Movi shield &amp;quot;proof of concept&amp;quot; done&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;PIR movement sensor&#039;&#039;&#039;&lt;br /&gt;
::: In addition to light intensity, an infra red motion sensors can be used to detect movements (humans, or the cat for that matter) see for instance https://www.adafruit.com/product/4871 &lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented but PIR (similar to the adafruit thingy) available&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Sensing wind direction &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based tactile hairs?  Something like https://www.instructables.com/Low-Cost-Low-Speed-Wind-Sensor-1/ with shielding? or sensitive temperature measurements?&lt;br /&gt;
:::; Note: Wind direction sensing in the wind tunnel is currently replaced by sensing light gradients parallel to the wind direction because the wind sensor is not available yet. &lt;br /&gt;
:::: &#039;&#039;Development status: To be designed, high priority for the windtunnel version with odour processing as a main goal, low priority for the a free walking space/nurdspace version described here.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Volatiles (odours) &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based perception of volatiles like alcohol (fruit-fly like behaviours), Carbon dioxide (mosquito like behaviour), or VOC&#039;s (most plant eating insects). The sensor produces a voltage level proportional to the intensity of the stimulus. Using a threshold can generate a presence/absence signal. &lt;br /&gt;
::: The interval between odour pulses is a proxy for the distance to the source. Note that an odour &amp;quot;gradient&amp;quot; does not exist!&lt;br /&gt;
&lt;br /&gt;
::: Current implementation uses a SGP30 board. The time constant of the the sensor is in the order of 1 second, but &amp;quot;whiffs&amp;quot; of odour could be detected faster by using a feature detector that looks for sudden steps in the signal. This will also act as an sensory adaptation mechanism: in the absence of change the output go&#039;s to zero.&lt;br /&gt;
::: &#039;&#039;Development status: Sensor: worked, currently broken&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground color&#039;&#039;&#039;&lt;br /&gt;
::: This sensor measures ground colour and the output can be used to test for a particular condition (e.g. being at a target position). It can also be used to simulate trail pheromones implemented as colors next to the  trail followed. This sense can also take the role of short distance &amp;quot; present at target&amp;quot; stimuli.&lt;br /&gt;
::: &#039;&#039; Development status: Operational &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground reflection level&#039;&#039;&#039;&lt;br /&gt;
::: Two sensors &#039;line followers&#039; that both provide a binary present/absent signal of ground reflection.&lt;br /&gt;
::: Can be used to simulate trail following behaviour on a network of lines  (combined with (led) ground colours.&lt;br /&gt;
::: &#039;&#039;Development status: testing phase&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Future extensions: A combination of voltage levels and pulse frequency coding in the source could be used to simulate a spectrum of &amp;quot;chemical&amp;quot; inputs.  &lt;br /&gt;
:::: Feature detectors could extract particular frequencies and/or patterns to recognise for instance &amp;quot;&#039;&#039;toxic&#039;&#039;&amp;quot; substances. &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Proprioception (internal &amp;quot;feeling&amp;quot;)&#039;&#039;&#039;&lt;br /&gt;
::: Checking for instance for body movement when motors move, or for force feedback when extending electrical honey sucking mouthparts&lt;br /&gt;
::: Development status:To be developed, as yet low priority. &lt;br /&gt;
 &lt;br /&gt;
:: &#039;&#039;&#039;Sensing internal physiological states &#039;&#039;&#039;&lt;br /&gt;
:::To place electric reward information in perspective, some internal status information is needed, that is supplied by reading internal variables like energy levels (battery voltage , load current) or physiological state (internal variables like &amp;quot;ready to feed&amp;quot;. &lt;br /&gt;
::: More advances implementations could look up previous experiences, and rate of change in physiological status as well as brain hormone levels and excitation states (see below under internal states and hormones&amp;quot;).&lt;br /&gt;
:::Development status: To be designed.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing hormone levels&#039;&#039;&#039;&lt;br /&gt;
::: Certain activities or combinations of activities can stimulate the production of hormones. This could be implemented as slow changing values in memory. Hormone levels might modulate the effect of sensory input or behavioural output, and act as a slow form of memory.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing rewards and deterrents&#039;&#039;&#039;&lt;br /&gt;
::: Electronic organisms live on electricity, and are rewarded by sensing the presence of a voltage and current. This sensory organ is just sensing the analog voltage measured by the sensory organ. It simulates the perception of food such as nectar. Most logical position is at the tip of an appendage. &lt;br /&gt;
::: &#039;&#039;Development status: implemented and removed (needs mutiplexing). Mechanical movement (servo) to make electrical contact: testing phase.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Brain ==&lt;br /&gt;
::&#039;&#039;&#039;Subsumption architecture&#039;&#039;&#039;&lt;br /&gt;
:::The Electronic organisms has a software brain that receives sensory input both from the environment and internal status. The brain reads all inputs about every 50 msec, and produces command for actuators that produce behaviour. These behaviours can be as simple as a colour changes of a led (signaling sensory status) or movements of body and body and appendages. The aim is to make the lower levels as stateless as possible i.e. the brain uses its real time vision of the word as a model instead of some abstract internal representation. The processing principle roughly follow the subsumption architecture (Brooks 1986).&lt;br /&gt;
&lt;br /&gt;
:::Wikipedia writes about this technique:&lt;br /&gt;
::::&amp;quot;&#039;&#039;[Behaviours] are organized into a hierarchy of layers. Each layer implements a particular level of behavioral competence, and higher levels are able to subsume lower levels (= integrate/combine lower levels to a more comprehensive whole) in order to create viable behavior. For example, a robot&#039;s lowest layer could be &amp;quot;avoid an object&amp;quot;. The second layer would be &amp;quot;wander around&amp;quot;, which runs beneath the third layer &amp;quot;explore the world&amp;quot;.[...]The subsumption architecture creates a system in which the higher layers utilize the lower-level competencies. The layers, which all receive sensor-information, work in parallel and generate outputs. These outputs can be commands to actuators, or signals that suppress or inhibit other layers.&amp;quot;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::My current implementation uses the opposite order. The high priority levels conduct the simplest behavioural tasks, and when these high priority but simple behavioural levels are happy more complex task can get control. This approach is still experimental, but in any case easy enough to reverse again.&lt;br /&gt;
&lt;br /&gt;
:::The behavioural levels &#039;&#039;all&#039;&#039; compete for control of the robot. Each behavioural layer evaluates its sensory input and determines if it wants to control the outputs (to change its input according to its (implied) goal, e.g. mechanoreceptors (microswitches) will only request control if the switch is closed. After all the behavioural levels are evaluated, and their request flags set or reset an arbitrate routine  selects the highest active layer that will run the robot behaviorual output for the next 50 msec.&lt;br /&gt;
:::See Anderson (2007) for a clear explanations and actual implementation examples.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Brain subsystems&#039;&#039;&#039;&lt;br /&gt;
:::More complicated or slow tasks (like sound processing or US echo detection) can be executed in separate processor boards that report their status  to the main  controller. Conceptually this is not different from subroutines for tasks.&lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Nervous system&#039;&#039;&#039;&lt;br /&gt;
::: The currently (sort of) running implementation of the brain is using a real time loop in a very simple cooperative multitasking system ([https://yiweimao.github.io/blog/async_microcontroller/ YiweiMao scheduler]) and inmplemented on an Arduino Uno &lt;br /&gt;
::: &#039;&#039;Development status: operational, but under active development.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Associative memory&#039;&#039;&#039;&lt;br /&gt;
::: Associative memory in it current, simplest form will be implemented as memory locations for particular sensory input combinations.  inputs that coincide increase a counter for that combination (learning those combinations). This allows both Pawlow  and operand conditioning.&lt;br /&gt;
:::&#039;&#039;Development status: not yet implemented, proof of concept done ~50 years ago :).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Excitation state and hormones&#039;&#039;&#039;&lt;br /&gt;
::: Hormones are internal variables with levels that act as slow changing memory for previous (combinations of) states.&lt;br /&gt;
::: A default breakdown speed can be set that slowly decrease hormone levels. Particular sensory input could increase the levels again. Reaching high levels of certain hormones can be a goal in itself, and subject to learning behaviour.&lt;br /&gt;
::: &#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Satisfaction&#039;&#039;&#039;&lt;br /&gt;
:::Signals to end feeding behaviour can -in addition to electrical food running out- also come from internal signals (satiation, internal hormonal signals, (too) long time periods with little change of events)&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Future prediction&#039;&#039;&#039;&lt;br /&gt;
:::This is currently way out of scope, but neural-net like implementations that store event sequences, predict likely outcomes of current inputs and act accordingly are fully feasible.&lt;br /&gt;
::: See Rickenbacher 1975 for an example that is probably  a bit more traceable than -for instance- modern neural network code like Tensorflow. &lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Effectors ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;main motors&#039;&#039;&#039;&lt;br /&gt;
:::The main moves of the organism are implemented by two wheels driven by two [https://leaphy.store/product/tt-motor-10cm-jumper-female/ DC motors] with build in gearboxes) and a [https://leaphy.store/product/motor-shield/ motor shield]. Motor speed is controlled by pulse width modualation (PMW)) present in the processor. Steering is done by differential motorspeed, a third backside &amp;quot;wheel&amp;quot; is a simple short passive wooden stand. This works well on reasonable flat surfaces, but needs improvement is the next robot (Terzo).&lt;br /&gt;
:::&#039;&#039;Motor development status: Operational at a basic level, PID control and extra power at startup to get smooth startup at low speed is needed.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Movable mouthparts&#039;&#039;&#039;&lt;br /&gt;
:::Appendages like extendable mouthparts controlled by [https://isking-modellbahn.de/modelcraft-es-030-Servo-top-line-steuerelektronik servo]&#039;s can be used for feeding on electrical food. Currently one servo controlling a proboscis (mouthpart for feeding) is present.&lt;br /&gt;
:::&#039;&#039;Development status: Operational in priciple, untested in practice, needs 3D printing of parts&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;[https://leaphy.store/product/rgb-led-single/ Three colour led]&#039;&#039;&#039;&lt;br /&gt;
::: can be used for signaling status of whatever state we want.&lt;br /&gt;
:::&#039;&#039;Development status: Operational &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Piezo beeper &#039;&#039;&#039;&lt;br /&gt;
::: Present on the [https://leaphy.store/product/motor-shield/ motor shield] can be used to create a variety of sounds,for instance to signal happines, distress or alarm.&lt;br /&gt;
:::&#039;&#039;Development status: Operational, but specific sounds need to be designed&lt;br /&gt;
&lt;br /&gt;
== Behavioural levels ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:: Behaviour in subsumption architecture is organised in levels that compete for control, the highest priority behaviour (lowest rank, top of list) will control the robot for 50 msec.&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Overview of current behavioral levels and  their most important inputs for controlling requests&#039;&#039;&#039;. &lt;br /&gt;
:::Layers are only a naming convention, conceptually grouping behaviour with somewhat similar aims. Note that the ultimate goals of the system (here level SLEEP, see below) is determined by the order of the levels. Changing the order evidently will change the behavioural outcomes.  Currently the order is hard coded.&lt;br /&gt;
&lt;br /&gt;
:::High priority behavioural levels take care of the most basic and critical task. When their goals are reached (their requests for control stop), higher behavioural levels, (representing more advanced lower priority tasks will be able to run. Note however that higher levels can explicitly inhibit or even modify lower level behaviours under some circumstances for some time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
::See the actual calls for details.&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;Layer &amp;quot;distress&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::If unable to meet the absolute basic requirement for battery voltage or movement CALL for help. In STUCK, try reflexes to get loose, pause regular. If nothing works eventually HIBERNATE &lt;br /&gt;
&lt;br /&gt;
::::Goal:  deal with the really difficult situations &lt;br /&gt;
::::0  HIBERNATE // hope for better times...&lt;br /&gt;
::::1  STUCK // try to solve non-movement when motors run...&lt;br /&gt;
::::2  CALL  // call for help&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;stay free&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::The primary sensory input activating this level are Bumper sensors and Ultrasonics, but also hormones for high emotional levels reached by an overload of sensory input or a high number of failing tries to reach some goal. Freeze will stop movement for an serious amount of time to reduce overload Fight will move quickly forward and get very close to an object possibly even disregarding US and bumpers and hitting the object. Escape will try to free the bumpers Evade will try keep a safe distance from objects Flight will try to run straight for a relative long time (using a countdown timer) but will subsumed by lower levels.&lt;br /&gt;
&lt;br /&gt;
::::Goal: avoid stressors. &lt;br /&gt;
::::3  FREEZE  // simulated dead&lt;br /&gt;
::::4  FIGHT   // Try to intimidate &lt;br /&gt;
::::5  ESCAPE  // Escape from touch&lt;br /&gt;
::::6  EVADE   // keep distance&lt;br /&gt;
::::7  FLIGHT  // run away  &lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;external control&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::This level is only requesting control if external commands are present in sensordata. The behaviour is self-reinforcing so once activated it keeps controlling the creature as long as new commands arrive within reasonable time. Note that Escape and Evade and Flight have priority, manual control has limits, the creature is autonomous!&lt;br /&gt;
&lt;br /&gt;
::::Goals: Stay free and prevent distress, but otherwise otherwise obey external commands.&lt;br /&gt;
::::8 MANUAL&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;scan and move&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::This level is the heart of the brain. Reaching the first level of this layer (INTEGRATE) is rewarding. :::Everything is (locally) under control and a target goal can been set. This will also increase positive emotional level. INTEGRATE will inspect internal status, like battery level, and emotional states like exhaustion, excitatory state and modify the settings for ORIENT and MOVE acordingly. Options for ORIENTs setting are for instance random turn angles and low speed  for a drukard&#039;s walk,phototxis (pos. or neg), odour pulsecount or interval for kinesis behaviour, and PIR input (i. e. human) presense for more interactive behaviour. After this setting it will inhibit the setting of the the INTEGRATE request flag for some time. Input from rotary encoders and/or motor commands) will retrigger this inhibition of INTEGRATE so rotate and Orient can work. ROTATE will rotate around the body centre until some sensory dead zone for the current target (just picked by INTGRATE is reached. Move will drive forward and (together with ORIENT) allow the creatue to move in the direction of the goal implied by ORIENT. ACCEPT checks sensory input for an acceptable stop position that might have food  or a high quality resource. Accept will increase positive emotional levels. FEED will ill become active when food is indeed available available, for istance via bottom contacts and will increase positive emotianal levels even more.&lt;br /&gt;
&lt;br /&gt;
::::Goal: find out where and when and how to move and set a goal&lt;br /&gt;
::::9 INTEGRATE // combine inputs and decide what to do at this moment.&lt;br /&gt;
::::10 ORIENT // orient towards the current goal&lt;br /&gt;
::::11 MOVE // move forward&lt;br /&gt;
::::12 ACCEPT // accept the current position and stop&lt;br /&gt;
::::13 FEED // electrical food is the best!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:: Stay tuned, more comming soon&lt;br /&gt;
&lt;br /&gt;
== Implementation details ==&lt;br /&gt;
: Stay tuned, more comming soon&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Anderson, D.P. (2007)&#039;&#039;&#039; https://www.dprg.org/articles/2007-03a/&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Bettosini et al., 2022&#039;&#039;&#039; Torocó: A Subsumption Architecture Implementation, in: 2022 8th International Conference on Automation, Robotics and Applications (ICARA) IEEE, Prague, Czech Republic, pp. 27–32. . https://doi.org/10.1109/ICARA55094.2022.9738521&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Brooks, R.A. (1986)&#039;&#039;&#039; A Robust Layer Control System for a Mobile Robot, IEEE Journal of Robotics and Automation RA-2, 14-23&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Rickenbacher (1975)&#039;&#039;&#039; Lernen und Motivation als relevanzgesteuerte Datenverarbeitung: Ein Computer-Simulationsmodell elementarer kognitiv-affektiver Prozesse. Birkhäuser Verag Basel.&lt;/div&gt;</summary>
		<author><name>Peterr</name></author>
	</entry>
	<entry>
		<id>https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15300</id>
		<title>Leaphy Robot</title>
		<link rel="alternate" type="text/html" href="https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15300"/>
		<updated>2025-10-01T21:15:36Z</updated>

		<summary type="html">&lt;p&gt;Peterr: /* Behavioural levels */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Name=Leaphy robot with subsumption architecture&lt;br /&gt;
|Skills=software hardware electronics biology&lt;br /&gt;
|Status=Active&lt;br /&gt;
|Niche=robotics&lt;br /&gt;
|Purpose=Fun&lt;br /&gt;
|Picture=Leaphy back side view.jpg&lt;br /&gt;
|Tool=No&lt;br /&gt;
|Location=Space, home&lt;br /&gt;
|Cost=Very small given what is already present and what is available in the space (everything!!)&lt;br /&gt;
|Category=Electronics&lt;br /&gt;
}}&lt;br /&gt;
== Electronic insect-like creature ==&lt;br /&gt;
&#039;&#039;&#039;Physiological, Behavioural and environmental overview&#039;&#039;&#039; &amp;lt;br&amp;gt;&lt;br /&gt;
peterr 2022- 2025 (with &#039;&#039;very&#039;&#039; long pauses)&lt;br /&gt;
&lt;br /&gt;
====Document history====&lt;br /&gt;
* Currently this is a living document and this wiki contains the latest version&lt;br /&gt;
* September 2025 subsumption architecture design &amp;amp; transfer to nurdspace wiki&lt;br /&gt;
* August    2025 Documentation for scheduler&lt;br /&gt;
* March     2023 Draft version 0.2  - terminology cleanup and scope&lt;br /&gt;
* November  2022 First document sketches &amp;amp; ideas&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project==&lt;br /&gt;
The insect like creature based on the original [https://leaphy.store/product/leaphy-original-los/ leaphyrobot] has a set of functionalities that together allow it to effectively find, and feed on targets that provides electricity as a reward.&lt;br /&gt;
Learning strategies to improve success rate can be implemented.&lt;br /&gt;
Sexual signaling, event prediction, mating behaviour, genetic exchange and evolution are in principle possible but are currently still (far) out of scope. The system at it&#039;s highest level can be seen as a feedback loop: sensory input =&amp;gt; behavioural selection =&amp;gt; motor output =&amp;gt; new sensory input. The original design (2022) was meant to live in wind tunnel, and find odour sources to feed, but currently the emphasis has shifted from odour detection to more general sensory processing using subsumption architecture, [https://nurdspace.nl/Leaphy_Robot#Brain see below].&lt;br /&gt;
&lt;br /&gt;
== Sensory inputs ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Mechanoreceptor - sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
:::Micro switch based tactile hairs. &lt;br /&gt;
:::&#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Ultrasound - Distance sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
::: Ultrasonic pulses detect obstacles and trigger reflex avoidance behaviour&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Better directional responses would be possible with more than one US sensor. &lt;br /&gt;
:::: This would need a dedicated embedded processor. &lt;br /&gt;
:::: &#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing light intensity&#039;&#039;&#039;&lt;br /&gt;
::: Two LDR photoreceptors measure front-left light level and front-right light level&lt;br /&gt;
::: Total light intensity (sum) is available as an analog voltage&lt;br /&gt;
::: The difference between the inputs is also available, and signals what side to turn to, to approach or avoid the light.&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing sound (audio)&#039;&#039;&#039;&lt;br /&gt;
::: A subunit with its own processor, containing an Electret microphone to measure ambiant sound level, frequency and sound patterns. &lt;br /&gt;
::: Can be used in classical (Pawlow) and operand conditioning experiments. Will detect both absolute sound levels (for startle or avoidance responses) and can contain feature detectors (e.g. chirp intervals for leaf hopper like  communication and courting  behaviour of two leaphy&#039;s).  &lt;br /&gt;
::: In addition, an Audeme Movi speech recognition shield (see https://www.audeme.com/movi.html) could be used to process voice commands&lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented, but Movi shield &amp;quot;proof of concept&amp;quot; done&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;PIR movement sensor&#039;&#039;&#039;&lt;br /&gt;
::: In addition to light intensity, an infra red motion sensors can be used to detect movements (humans, or the cat for that matter) see for instance https://www.adafruit.com/product/4871 &lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented but PIR (similar to the adafruit thingy) available&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Sensing wind direction &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based tactile hairs?  Something like https://www.instructables.com/Low-Cost-Low-Speed-Wind-Sensor-1/ with shielding? or sensitive temperature measurements?&lt;br /&gt;
:::; Note: Wind direction sensing in the wind tunnel is currently replaced by sensing light gradients parallel to the wind direction because the wind sensor is not available yet. &lt;br /&gt;
:::: &#039;&#039;Development status: To be designed, high priority for the windtunnel version with odour processing as a main goal, low priority for the a free walking space/nurdspace version described here.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Volatiles (odours) &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based perception of volatiles like alcohol (fruit-fly like behaviours), Carbon dioxide (mosquito like behaviour), or VOC&#039;s (most plant eating insects). The sensor produces a voltage level proportional to the intensity of the stimulus. Using a threshold can generate a presence/absence signal. &lt;br /&gt;
::: The interval between odour pulses is a proxy for the distance to the source. Note that an odour &amp;quot;gradient&amp;quot; does not exist!&lt;br /&gt;
&lt;br /&gt;
::: Current implementation uses a SGP30 board. The time constant of the the sensor is in the order of 1 second, but &amp;quot;whiffs&amp;quot; of odour could be detected faster by using a feature detector that looks for sudden steps in the signal. This will also act as an sensory adaptation mechanism: in the absence of change the output go&#039;s to zero.&lt;br /&gt;
::: &#039;&#039;Development status: Sensor: worked, currently broken&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground color&#039;&#039;&#039;&lt;br /&gt;
::: This sensor measures ground colour and the output can be used to test for a particular condition (e.g. being at a target position). It can also be used to simulate trail pheromones implemented as colors next to the  trail followed. This sense can also take the role of short distance &amp;quot; present at target&amp;quot; stimuli.&lt;br /&gt;
::: &#039;&#039; Development status: Operational &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground reflection level&#039;&#039;&#039;&lt;br /&gt;
::: Two sensors &#039;line followers&#039; that both provide a binary present/absent signal of ground reflection.&lt;br /&gt;
::: Can be used to simulate trail following behaviour on a network of lines  (combined with (led) ground colours.&lt;br /&gt;
::: &#039;&#039;Development status: testing phase&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Future extensions: A combination of voltage levels and pulse frequency coding in the source could be used to simulate a spectrum of &amp;quot;chemical&amp;quot; inputs.  &lt;br /&gt;
:::: Feature detectors could extract particular frequencies and/or patterns to recognise for instance &amp;quot;&#039;&#039;toxic&#039;&#039;&amp;quot; substances. &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Proprioception (internal &amp;quot;feeling&amp;quot;)&#039;&#039;&#039;&lt;br /&gt;
::: Checking for instance for body movement when motors move, or for force feedback when extending electrical honey sucking mouthparts&lt;br /&gt;
::: Development status:To be developed, as yet low priority. &lt;br /&gt;
 &lt;br /&gt;
:: &#039;&#039;&#039;Sensing internal physiological states &#039;&#039;&#039;&lt;br /&gt;
:::To place electric reward information in perspective, some internal status information is needed, that is supplied by reading internal variables like energy levels (battery voltage , load current) or physiological state (internal variables like &amp;quot;ready to feed&amp;quot;. &lt;br /&gt;
::: More advances implementations could look up previous experiences, and rate of change in physiological status as well as brain hormone levels and excitation states (see below under internal states and hormones&amp;quot;).&lt;br /&gt;
:::Development status: To be designed.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing hormone levels&#039;&#039;&#039;&lt;br /&gt;
::: Certain activities or combinations of activities can stimulate the production of hormones. This could be implemented as slow changing values in memory. Hormone levels might modulate the effect of sensory input or behavioural output, and act as a slow form of memory.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing rewards and deterrents&#039;&#039;&#039;&lt;br /&gt;
::: Electronic organisms live on electricity, and are rewarded by sensing the presence of a voltage and current. This sensory organ is just sensing the analog voltage measured by the sensory organ. It simulates the perception of food such as nectar. Most logical position is at the tip of an appendage. &lt;br /&gt;
::: &#039;&#039;Development status: implemented and removed (needs mutiplexing). Mechanical movement (servo) to make electrical contact: testing phase.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Brain ==&lt;br /&gt;
::&#039;&#039;&#039;Subsumption architecture&#039;&#039;&#039;&lt;br /&gt;
:::The Electronic organisms has a software brain that receives sensory input both from the environment and internal status. The brain reads all inputs about every 50 msec, and produces command for actuators that produce behaviour. These behaviours can be as simple as a colour changes of a led (signaling sensory status) or movements of body and body and appendages. The aim is to make the lower levels as stateless as possible i.e. the brain uses its real time vision of the word as a model instead of some abstract internal representation. The processing principle roughly follow the subsumption architecture (Brooks 1986).&lt;br /&gt;
&lt;br /&gt;
:::Wikipedia writes about this technique:&lt;br /&gt;
::::&amp;quot;&#039;&#039;[Behaviours] are organized into a hierarchy of layers. Each layer implements a particular level of behavioral competence, and higher levels are able to subsume lower levels (= integrate/combine lower levels to a more comprehensive whole) in order to create viable behavior. For example, a robot&#039;s lowest layer could be &amp;quot;avoid an object&amp;quot;. The second layer would be &amp;quot;wander around&amp;quot;, which runs beneath the third layer &amp;quot;explore the world&amp;quot;.[...]The subsumption architecture creates a system in which the higher layers utilize the lower-level competencies. The layers, which all receive sensor-information, work in parallel and generate outputs. These outputs can be commands to actuators, or signals that suppress or inhibit other layers.&amp;quot;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::My current implementation uses the opposite order. The high priority levels conduct the simplest behavioural tasks, and when these high priority but simple behavioural levels are happy more complex task can get control. This approach is still experimental, but in any case easy enough to reverse again.&lt;br /&gt;
&lt;br /&gt;
:::The behavioural levels &#039;&#039;all&#039;&#039; compete for control of the robot. Each behavioural layer evaluates its sensory input and determines if it wants to control the outputs (to change its input according to its (implied) goal, e.g. mechanoreceptors (microswitches) will only request control if the switch is closed. After all the behavioural levels are evaluated, and their request flags set or reset an arbitrate routine  selects the highest active layer that will run the robot behaviorual output for the next 50 msec.&lt;br /&gt;
:::See Anderson (2007) for a clear explanations and actual implementation examples.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Brain subsystems&#039;&#039;&#039;&lt;br /&gt;
:::More complicated or slow tasks (like sound processing or US echo detection) can be executed in separate processor boards that report their status  to the main  controller. Conceptually this is not different from subroutines for tasks.&lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Nervous system&#039;&#039;&#039;&lt;br /&gt;
::: The currently (sort of) running implementation of the brain is using a real time loop in a very simple cooperative multitasking system ([https://yiweimao.github.io/blog/async_microcontroller/ YiweiMao scheduler]) and inmplemented on an Arduino Uno &lt;br /&gt;
::: &#039;&#039;Development status: operational, but under active development.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Associative memory&#039;&#039;&#039;&lt;br /&gt;
::: Associative memory in it current, simplest form will be implemented as memory locations for particular sensory input combinations.  inputs that coincide increase a counter for that combination (learning those combinations). This allows both Pawlow  and operand conditioning.&lt;br /&gt;
:::&#039;&#039;Development status: not yet implemented, proof of concept done ~50 years ago :).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Excitation state and hormones&#039;&#039;&#039;&lt;br /&gt;
::: Hormones are internal variables with levels that act as slow changing memory for previous (combinations of) states.&lt;br /&gt;
::: A default breakdown speed can be set that slowly decrease hormone levels. Particular sensory input could increase the levels again. Reaching high levels of certain hormones can be a goal in itself, and subject to learning behaviour.&lt;br /&gt;
::: &#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Satisfaction&#039;&#039;&#039;&lt;br /&gt;
:::Signals to end feeding behaviour can -in addition to electrical food running out- also come from internal signals (satiation, internal hormonal signals, (too) long time periods with little change of events)&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Future prediction&#039;&#039;&#039;&lt;br /&gt;
:::This is currently way out of scope, but neural-net like implementations that store event sequences, predict likely outcomes of current inputs and act accordingly are fully feasible.&lt;br /&gt;
::: See Rickenbacher 1975 for an example that is probably  a bit more traceable than -for instance- modern neural network code like Tensorflow. &lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Effectors ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;main motors&#039;&#039;&#039;&lt;br /&gt;
:::The main moves of the organism are implemented by two wheels driven by two [https://leaphy.store/product/tt-motor-10cm-jumper-female/ DC motors] with build in gearboxes) and a [https://leaphy.store/product/motor-shield/ motor shield]. Motor speed is controlled by pulse width modualation (PMW)) present in the processor. Steering is done by differential motorspeed, a third backside &amp;quot;wheel&amp;quot; is a simple short passive wooden stand. This works well on reasonable flat surfaces, but needs improvement is the next robot (Terzo).&lt;br /&gt;
:::&#039;&#039;Motor development status: Operational at a basic level, PID control and extra power at startup to get smooth startup at low speed is needed.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Movable mouthparts&#039;&#039;&#039;&lt;br /&gt;
:::Appendages like extendable mouthparts controlled by [https://isking-modellbahn.de/modelcraft-es-030-Servo-top-line-steuerelektronik servo]&#039;s can be used for feeding on electrical food. Currently one servo controlling a proboscis (mouthpart for feeding) is present.&lt;br /&gt;
:::&#039;&#039;Development status: Operational in priciple, untested in practice, needs 3D printing of parts&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;[https://leaphy.store/product/rgb-led-single/ Three colour led]&#039;&#039;&#039;&lt;br /&gt;
::: can be used for signaling status of whatever state we want.&lt;br /&gt;
:::&#039;&#039;Development status: Operational &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Piezo beeper &#039;&#039;&#039;&lt;br /&gt;
::: Present on the [https://leaphy.store/product/motor-shield/ motor shield] can be used to create a variety of sounds,for instance to signal happines, distress or alarm.&lt;br /&gt;
:::&#039;&#039;Development status: Operational, but specific sounds need to be designed&lt;br /&gt;
&lt;br /&gt;
== Behavioural levels ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:: Behaviour in subsumption architecture is organised in levels that compete for control, the highest priority behaviour (lowest rank, top of list) will control the robot for 50 msec.&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Overview of current behavioral levels and  their most important inputs for controlling requests&#039;&#039;&#039;. &lt;br /&gt;
:::Layers are only a naming convention, conceptually grouping behaviour with somewhat similar aims. Note that the ultimate goals of the system (here level SLEEP, see below) is determined by the order of the levels. Changing the order evidently will change the behavioural outcomes.  Currently the order is hard coded.&lt;br /&gt;
&lt;br /&gt;
:::High priority behavioural levels take care of the most basic and critical task. When their goals are reached (their requests for control stop), higher behavioural levels, (representing more advanced lower priority tasks will be able to run. Note however that higher levels can explicitly inhibit or even modify lower level behaviours under some circumstances for some time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
::See the actual calls for details.&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;Layer &amp;quot;distress&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::If unable to meet the absolute basic requirement for battery voltage or movement CALL for help. In STUCK, try reflexes to get loose, pause regular. If nothing works eventually HIBERNATE &lt;br /&gt;
&lt;br /&gt;
::::Goal:  deal with the really difficult situations &lt;br /&gt;
::::0  HIBERNATE // hope for better times...&lt;br /&gt;
::::1  STUCK // try to solve non-movement when motors run...&lt;br /&gt;
::::2  CALL  // call for help&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;stay free&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::The primary sensory input activating this level are Bumper sensors and Ultrasonics, but also hormones for high emotional levels reached by an overload of sensory input or a high number of failing tries to reach some goal. Freeze will stop movement for an serious amount of time to reduce overload Fight will move quickly forward and get very close to an object possibly even disregarding US and bumpers and hitting the object. Escape will try to free the bumpers Evade will try keep a safe distance from objects Flight will try to run straight for a relative long time (using a countdown timer) but will subsumed by lower levels.&lt;br /&gt;
&lt;br /&gt;
::::Goal: avoid stressors. &lt;br /&gt;
::::3  FREEZE  // simulated dead&lt;br /&gt;
::::4  FIGHT   // Try to intimidate &lt;br /&gt;
::::5  ESCAPE  // Escape from touch&lt;br /&gt;
::::6  EVADE   // keep distance&lt;br /&gt;
::::7  FLIGHT  // run away  &lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;external control&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::This level is only requesting control if external commands are present in sensordata. The behaviour is self-reinforcing so once activated it keeps controlling the creature as long as new commands arrive within reasonable time. Note that Escape and Evade and Flight have priority, manual control has limits, the creature is autonomous!&lt;br /&gt;
&lt;br /&gt;
::::Goals: Stay free and prevent distress, but otherwise otherwise obey external commands.&lt;br /&gt;
::::8 MANUAL&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;scan and move&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::This level is the heart of the brain. Reaching the first level of this layer (INTEGRATE) is rewarding. :::Everything is (locally) under control and a target goal can been set. This will also increase positive emotional level. INTEGRATE will inspect internal status, like battery level, and emotional states like exhaustion, excitatory state and modify the settings for ORIENT and MOVE acordingly. Options for ORIENTs setting are for instance random turn angles and low speed  for a drukard&#039;s walk,phototxis (pos. or neg), odour pulsecount or interval for kinesis behaviour, and PIR input (i. e. human) presense for more interactive behaviour. After this setting it will inhibit the setting of the the INTEGRATE request flag for some time. Input from rotary encoders and/or motor commands) will retrigger this inhibition of INTEGRATE so rotate and Orient can work. ROTATE will rotate around the body centre until some sensory dead zone for the current target (just picked by INTGRATE is reached. Move will drive forward and (together with ORIENT) allow the creatue to move in the direction of the goal implied by ORIENT. ACCEPT checks sensory input for an acceptable stop position that might have food  or a high quality resource. Accept will increase positive emotional levels. FEED will ill become active when food is indeed available available, for istance via bottom contacts and will increase positive emotianal levels even more.&lt;br /&gt;
&lt;br /&gt;
::::Goal: find out where and when and how to move and set a goal&lt;br /&gt;
::::: INTEGRATE // combine inputs and decide what to do at this moment.&lt;br /&gt;
::::10 ORIENT // orient towards the current goal&lt;br /&gt;
::::11 MOVE // move forward&lt;br /&gt;
::::12 ACCEPT // accept the current position and stop&lt;br /&gt;
::::13 FEED // electrical food is the best!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:: Stay tuned, more comming soon&lt;br /&gt;
&lt;br /&gt;
== Implementation details ==&lt;br /&gt;
: Stay tuned, more comming soon&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Anderson, D.P. (2007)&#039;&#039;&#039; https://www.dprg.org/articles/2007-03a/&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Bettosini et al., 2022&#039;&#039;&#039; Torocó: A Subsumption Architecture Implementation, in: 2022 8th International Conference on Automation, Robotics and Applications (ICARA) IEEE, Prague, Czech Republic, pp. 27–32. . https://doi.org/10.1109/ICARA55094.2022.9738521&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Brooks, R.A. (1986)&#039;&#039;&#039; A Robust Layer Control System for a Mobile Robot, IEEE Journal of Robotics and Automation RA-2, 14-23&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Rickenbacher (1975)&#039;&#039;&#039; Lernen und Motivation als relevanzgesteuerte Datenverarbeitung: Ein Computer-Simulationsmodell elementarer kognitiv-affektiver Prozesse. Birkhäuser Verag Basel.&lt;/div&gt;</summary>
		<author><name>Peterr</name></author>
	</entry>
	<entry>
		<id>https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15299</id>
		<title>Leaphy Robot</title>
		<link rel="alternate" type="text/html" href="https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15299"/>
		<updated>2025-10-01T21:14:06Z</updated>

		<summary type="html">&lt;p&gt;Peterr: /* Behavioural levels */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Name=Leaphy robot with subsumption architecture&lt;br /&gt;
|Skills=software hardware electronics biology&lt;br /&gt;
|Status=Active&lt;br /&gt;
|Niche=robotics&lt;br /&gt;
|Purpose=Fun&lt;br /&gt;
|Picture=Leaphy back side view.jpg&lt;br /&gt;
|Tool=No&lt;br /&gt;
|Location=Space, home&lt;br /&gt;
|Cost=Very small given what is already present and what is available in the space (everything!!)&lt;br /&gt;
|Category=Electronics&lt;br /&gt;
}}&lt;br /&gt;
== Electronic insect-like creature ==&lt;br /&gt;
&#039;&#039;&#039;Physiological, Behavioural and environmental overview&#039;&#039;&#039; &amp;lt;br&amp;gt;&lt;br /&gt;
peterr 2022- 2025 (with &#039;&#039;very&#039;&#039; long pauses)&lt;br /&gt;
&lt;br /&gt;
====Document history====&lt;br /&gt;
* Currently this is a living document and this wiki contains the latest version&lt;br /&gt;
* September 2025 subsumption architecture design &amp;amp; transfer to nurdspace wiki&lt;br /&gt;
* August    2025 Documentation for scheduler&lt;br /&gt;
* March     2023 Draft version 0.2  - terminology cleanup and scope&lt;br /&gt;
* November  2022 First document sketches &amp;amp; ideas&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project==&lt;br /&gt;
The insect like creature based on the original [https://leaphy.store/product/leaphy-original-los/ leaphyrobot] has a set of functionalities that together allow it to effectively find, and feed on targets that provides electricity as a reward.&lt;br /&gt;
Learning strategies to improve success rate can be implemented.&lt;br /&gt;
Sexual signaling, event prediction, mating behaviour, genetic exchange and evolution are in principle possible but are currently still (far) out of scope. The system at it&#039;s highest level can be seen as a feedback loop: sensory input =&amp;gt; behavioural selection =&amp;gt; motor output =&amp;gt; new sensory input. The original design (2022) was meant to live in wind tunnel, and find odour sources to feed, but currently the emphasis has shifted from odour detection to more general sensory processing using subsumption architecture, [https://nurdspace.nl/Leaphy_Robot#Brain see below].&lt;br /&gt;
&lt;br /&gt;
== Sensory inputs ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Mechanoreceptor - sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
:::Micro switch based tactile hairs. &lt;br /&gt;
:::&#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Ultrasound - Distance sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
::: Ultrasonic pulses detect obstacles and trigger reflex avoidance behaviour&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Better directional responses would be possible with more than one US sensor. &lt;br /&gt;
:::: This would need a dedicated embedded processor. &lt;br /&gt;
:::: &#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing light intensity&#039;&#039;&#039;&lt;br /&gt;
::: Two LDR photoreceptors measure front-left light level and front-right light level&lt;br /&gt;
::: Total light intensity (sum) is available as an analog voltage&lt;br /&gt;
::: The difference between the inputs is also available, and signals what side to turn to, to approach or avoid the light.&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing sound (audio)&#039;&#039;&#039;&lt;br /&gt;
::: A subunit with its own processor, containing an Electret microphone to measure ambiant sound level, frequency and sound patterns. &lt;br /&gt;
::: Can be used in classical (Pawlow) and operand conditioning experiments. Will detect both absolute sound levels (for startle or avoidance responses) and can contain feature detectors (e.g. chirp intervals for leaf hopper like  communication and courting  behaviour of two leaphy&#039;s).  &lt;br /&gt;
::: In addition, an Audeme Movi speech recognition shield (see https://www.audeme.com/movi.html) could be used to process voice commands&lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented, but Movi shield &amp;quot;proof of concept&amp;quot; done&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;PIR movement sensor&#039;&#039;&#039;&lt;br /&gt;
::: In addition to light intensity, an infra red motion sensors can be used to detect movements (humans, or the cat for that matter) see for instance https://www.adafruit.com/product/4871 &lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented but PIR (similar to the adafruit thingy) available&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Sensing wind direction &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based tactile hairs?  Something like https://www.instructables.com/Low-Cost-Low-Speed-Wind-Sensor-1/ with shielding? or sensitive temperature measurements?&lt;br /&gt;
:::; Note: Wind direction sensing in the wind tunnel is currently replaced by sensing light gradients parallel to the wind direction because the wind sensor is not available yet. &lt;br /&gt;
:::: &#039;&#039;Development status: To be designed, high priority for the windtunnel version with odour processing as a main goal, low priority for the a free walking space/nurdspace version described here.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Volatiles (odours) &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based perception of volatiles like alcohol (fruit-fly like behaviours), Carbon dioxide (mosquito like behaviour), or VOC&#039;s (most plant eating insects). The sensor produces a voltage level proportional to the intensity of the stimulus. Using a threshold can generate a presence/absence signal. &lt;br /&gt;
::: The interval between odour pulses is a proxy for the distance to the source. Note that an odour &amp;quot;gradient&amp;quot; does not exist!&lt;br /&gt;
&lt;br /&gt;
::: Current implementation uses a SGP30 board. The time constant of the the sensor is in the order of 1 second, but &amp;quot;whiffs&amp;quot; of odour could be detected faster by using a feature detector that looks for sudden steps in the signal. This will also act as an sensory adaptation mechanism: in the absence of change the output go&#039;s to zero.&lt;br /&gt;
::: &#039;&#039;Development status: Sensor: worked, currently broken&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground color&#039;&#039;&#039;&lt;br /&gt;
::: This sensor measures ground colour and the output can be used to test for a particular condition (e.g. being at a target position). It can also be used to simulate trail pheromones implemented as colors next to the  trail followed. This sense can also take the role of short distance &amp;quot; present at target&amp;quot; stimuli.&lt;br /&gt;
::: &#039;&#039; Development status: Operational &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground reflection level&#039;&#039;&#039;&lt;br /&gt;
::: Two sensors &#039;line followers&#039; that both provide a binary present/absent signal of ground reflection.&lt;br /&gt;
::: Can be used to simulate trail following behaviour on a network of lines  (combined with (led) ground colours.&lt;br /&gt;
::: &#039;&#039;Development status: testing phase&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Future extensions: A combination of voltage levels and pulse frequency coding in the source could be used to simulate a spectrum of &amp;quot;chemical&amp;quot; inputs.  &lt;br /&gt;
:::: Feature detectors could extract particular frequencies and/or patterns to recognise for instance &amp;quot;&#039;&#039;toxic&#039;&#039;&amp;quot; substances. &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Proprioception (internal &amp;quot;feeling&amp;quot;)&#039;&#039;&#039;&lt;br /&gt;
::: Checking for instance for body movement when motors move, or for force feedback when extending electrical honey sucking mouthparts&lt;br /&gt;
::: Development status:To be developed, as yet low priority. &lt;br /&gt;
 &lt;br /&gt;
:: &#039;&#039;&#039;Sensing internal physiological states &#039;&#039;&#039;&lt;br /&gt;
:::To place electric reward information in perspective, some internal status information is needed, that is supplied by reading internal variables like energy levels (battery voltage , load current) or physiological state (internal variables like &amp;quot;ready to feed&amp;quot;. &lt;br /&gt;
::: More advances implementations could look up previous experiences, and rate of change in physiological status as well as brain hormone levels and excitation states (see below under internal states and hormones&amp;quot;).&lt;br /&gt;
:::Development status: To be designed.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing hormone levels&#039;&#039;&#039;&lt;br /&gt;
::: Certain activities or combinations of activities can stimulate the production of hormones. This could be implemented as slow changing values in memory. Hormone levels might modulate the effect of sensory input or behavioural output, and act as a slow form of memory.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing rewards and deterrents&#039;&#039;&#039;&lt;br /&gt;
::: Electronic organisms live on electricity, and are rewarded by sensing the presence of a voltage and current. This sensory organ is just sensing the analog voltage measured by the sensory organ. It simulates the perception of food such as nectar. Most logical position is at the tip of an appendage. &lt;br /&gt;
::: &#039;&#039;Development status: implemented and removed (needs mutiplexing). Mechanical movement (servo) to make electrical contact: testing phase.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Brain ==&lt;br /&gt;
::&#039;&#039;&#039;Subsumption architecture&#039;&#039;&#039;&lt;br /&gt;
:::The Electronic organisms has a software brain that receives sensory input both from the environment and internal status. The brain reads all inputs about every 50 msec, and produces command for actuators that produce behaviour. These behaviours can be as simple as a colour changes of a led (signaling sensory status) or movements of body and body and appendages. The aim is to make the lower levels as stateless as possible i.e. the brain uses its real time vision of the word as a model instead of some abstract internal representation. The processing principle roughly follow the subsumption architecture (Brooks 1986).&lt;br /&gt;
&lt;br /&gt;
:::Wikipedia writes about this technique:&lt;br /&gt;
::::&amp;quot;&#039;&#039;[Behaviours] are organized into a hierarchy of layers. Each layer implements a particular level of behavioral competence, and higher levels are able to subsume lower levels (= integrate/combine lower levels to a more comprehensive whole) in order to create viable behavior. For example, a robot&#039;s lowest layer could be &amp;quot;avoid an object&amp;quot;. The second layer would be &amp;quot;wander around&amp;quot;, which runs beneath the third layer &amp;quot;explore the world&amp;quot;.[...]The subsumption architecture creates a system in which the higher layers utilize the lower-level competencies. The layers, which all receive sensor-information, work in parallel and generate outputs. These outputs can be commands to actuators, or signals that suppress or inhibit other layers.&amp;quot;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::My current implementation uses the opposite order. The high priority levels conduct the simplest behavioural tasks, and when these high priority but simple behavioural levels are happy more complex task can get control. This approach is still experimental, but in any case easy enough to reverse again.&lt;br /&gt;
&lt;br /&gt;
:::The behavioural levels &#039;&#039;all&#039;&#039; compete for control of the robot. Each behavioural layer evaluates its sensory input and determines if it wants to control the outputs (to change its input according to its (implied) goal, e.g. mechanoreceptors (microswitches) will only request control if the switch is closed. After all the behavioural levels are evaluated, and their request flags set or reset an arbitrate routine  selects the highest active layer that will run the robot behaviorual output for the next 50 msec.&lt;br /&gt;
:::See Anderson (2007) for a clear explanations and actual implementation examples.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Brain subsystems&#039;&#039;&#039;&lt;br /&gt;
:::More complicated or slow tasks (like sound processing or US echo detection) can be executed in separate processor boards that report their status  to the main  controller. Conceptually this is not different from subroutines for tasks.&lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Nervous system&#039;&#039;&#039;&lt;br /&gt;
::: The currently (sort of) running implementation of the brain is using a real time loop in a very simple cooperative multitasking system ([https://yiweimao.github.io/blog/async_microcontroller/ YiweiMao scheduler]) and inmplemented on an Arduino Uno &lt;br /&gt;
::: &#039;&#039;Development status: operational, but under active development.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Associative memory&#039;&#039;&#039;&lt;br /&gt;
::: Associative memory in it current, simplest form will be implemented as memory locations for particular sensory input combinations.  inputs that coincide increase a counter for that combination (learning those combinations). This allows both Pawlow  and operand conditioning.&lt;br /&gt;
:::&#039;&#039;Development status: not yet implemented, proof of concept done ~50 years ago :).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Excitation state and hormones&#039;&#039;&#039;&lt;br /&gt;
::: Hormones are internal variables with levels that act as slow changing memory for previous (combinations of) states.&lt;br /&gt;
::: A default breakdown speed can be set that slowly decrease hormone levels. Particular sensory input could increase the levels again. Reaching high levels of certain hormones can be a goal in itself, and subject to learning behaviour.&lt;br /&gt;
::: &#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Satisfaction&#039;&#039;&#039;&lt;br /&gt;
:::Signals to end feeding behaviour can -in addition to electrical food running out- also come from internal signals (satiation, internal hormonal signals, (too) long time periods with little change of events)&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Future prediction&#039;&#039;&#039;&lt;br /&gt;
:::This is currently way out of scope, but neural-net like implementations that store event sequences, predict likely outcomes of current inputs and act accordingly are fully feasible.&lt;br /&gt;
::: See Rickenbacher 1975 for an example that is probably  a bit more traceable than -for instance- modern neural network code like Tensorflow. &lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Effectors ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;main motors&#039;&#039;&#039;&lt;br /&gt;
:::The main moves of the organism are implemented by two wheels driven by two [https://leaphy.store/product/tt-motor-10cm-jumper-female/ DC motors] with build in gearboxes) and a [https://leaphy.store/product/motor-shield/ motor shield]. Motor speed is controlled by pulse width modualation (PMW)) present in the processor. Steering is done by differential motorspeed, a third backside &amp;quot;wheel&amp;quot; is a simple short passive wooden stand. This works well on reasonable flat surfaces, but needs improvement is the next robot (Terzo).&lt;br /&gt;
:::&#039;&#039;Motor development status: Operational at a basic level, PID control and extra power at startup to get smooth startup at low speed is needed.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Movable mouthparts&#039;&#039;&#039;&lt;br /&gt;
:::Appendages like extendable mouthparts controlled by [https://isking-modellbahn.de/modelcraft-es-030-Servo-top-line-steuerelektronik servo]&#039;s can be used for feeding on electrical food. Currently one servo controlling a proboscis (mouthpart for feeding) is present.&lt;br /&gt;
:::&#039;&#039;Development status: Operational in priciple, untested in practice, needs 3D printing of parts&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;[https://leaphy.store/product/rgb-led-single/ Three colour led]&#039;&#039;&#039;&lt;br /&gt;
::: can be used for signaling status of whatever state we want.&lt;br /&gt;
:::&#039;&#039;Development status: Operational &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Piezo beeper &#039;&#039;&#039;&lt;br /&gt;
::: Present on the [https://leaphy.store/product/motor-shield/ motor shield] can be used to create a variety of sounds,for instance to signal happines, distress or alarm.&lt;br /&gt;
:::&#039;&#039;Development status: Operational, but specific sounds need to be designed&lt;br /&gt;
&lt;br /&gt;
== Behavioural levels ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:: Behaviour in subsumption architecture is organised in levels that compete for control, the highest priority behaviour (lowest rank, top of list) will control the robot for 50 msec. When lower levels are silent higher levels get control.&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Overview of current behavioral levels and  their most important inputs for controlling requests&#039;&#039;&#039;. &lt;br /&gt;
:::Layers are only a naming convention, conceptually grouping behaviour with somewhat similar aims. Note that the ultimate goals of the system (here level SLEEP, see below) is determined by the order of the levels. Changing the order evidently will change the behavioural outcomes.  Currently the order is hard coded.&lt;br /&gt;
&lt;br /&gt;
:::High priority behavioural levels take care of the most basic and critical task. When their goals are reached (their requests for control stop), higher behavioural levels, (representing more advanced lower priority tasks will be able to run. Note however that higher levels can explicitly inhibit or even modify lower level behaviours under some circumstances for some time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
::See the actual calls for details.&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;Layer &amp;quot;distress&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::If unable to meet the absolute basic requirement for battery voltage or movement CALL for help. In STUCK, try reflexes to get loose, pause regular. If nothing works eventually HIBERNATE &lt;br /&gt;
&lt;br /&gt;
::::Goal:  deal with the really difficult situations &lt;br /&gt;
::::0  HIBERNATE // hope for better times...&lt;br /&gt;
::::1  STUCK // try to solve non-movement when motors run...&lt;br /&gt;
::::2  CALL  // call for help&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;stay free&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::The primary sensory input activating this level are Bumper sensors and Ultrasonics, but also hormones for high emotional levels reached by an overload of sensory input or a high number of failing tries to reach some goal. Freeze will stop movement for an serious amount of time to reduce overload Fight will move quickly forward and get very close to an object possibly even disregarding US and bumpers and hitting the object. Escape will try to free the bumpers Evade will try keep a safe distance from objects Flight will try to run straight for a relative long time (using a countdown timer) but will subsumed by lower levels.&lt;br /&gt;
&lt;br /&gt;
::::Goal: avoid stressors. &lt;br /&gt;
::::3  FREEZE  // simulated dead&lt;br /&gt;
::::4  FIGHT   // Try to intimidate &lt;br /&gt;
::::5  ESCAPE  // Escape from touch&lt;br /&gt;
::::6  EVADE   // keep distance&lt;br /&gt;
::::7  FLIGHT  // run away  &lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;external control&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::This level is only requesting control if external commands are present in sensordata. The behaviour is self-reinforcing so once activated it keeps controlling the creature as long as new commands arrive within reasonable time. Note that Escape and Evade and Flight have priority, manual control has limits, the creature is autonomous!&lt;br /&gt;
&lt;br /&gt;
::::Goals: Stay free and prevent distress, but otherwise otherwise obey external commands.&lt;br /&gt;
::::8 MANUAL&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;scan and move&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::This level is the heart of the brain. Reaching the first level of this layer (INTEGRATE) is rewarding. :::Everything is (locally) under control and a target goal can been set. This will also increase positive emotional level. INTEGRATE will inspect internal status, like battery level, and emotional states like exhaustion, excitatory state and modify the settings for ORIENT and MOVE acordingly. Options for ORIENTs setting are for instance random turn angles and low speed  for a drukard&#039;s walk,phototxis (pos. or neg), odour pulsecount or interval for kinesis behaviour, and PIR input (i. e. human) presense for more interactive behaviour. After this setting it will inhibit the setting of the the INTEGRATE request flag for some time. Input from rotary encoders and/or motor commands) will retrigger this inhibition of INTEGRATE so rotate and Orient can work. ROTATE will rotate around the body centre until some sensory dead zone for the current target (just picked by INTGRATE is reached. Move will drive forward and (together with ORIENT) allow the creatue to move in the direction of the goal implied by ORIENT. ACCEPT checks sensory input for an acceptable stop position that might have food  or a high quality resource. Accept will increase positive emotional levels. FEED will ill become active when food is indeed available available, for istance via bottom contacts and will increase positive emotianal levels even more.&lt;br /&gt;
&lt;br /&gt;
::::Goal: find out where and when and how to move and set a goal&lt;br /&gt;
::::: INTEGRATE // combine inputs and decide what to do at this moment.&lt;br /&gt;
::::10 ORIENT // orient towards the current goal&lt;br /&gt;
::::11 MOVE // move forward&lt;br /&gt;
::::12 ACCEPT // accept the current position and stop&lt;br /&gt;
::::13 FEED // electrical food is the best!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:: Stay tuned, more comming soon&lt;br /&gt;
&lt;br /&gt;
== Implementation details ==&lt;br /&gt;
: Stay tuned, more comming soon&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Anderson, D.P. (2007)&#039;&#039;&#039; https://www.dprg.org/articles/2007-03a/&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Bettosini et al., 2022&#039;&#039;&#039; Torocó: A Subsumption Architecture Implementation, in: 2022 8th International Conference on Automation, Robotics and Applications (ICARA) IEEE, Prague, Czech Republic, pp. 27–32. . https://doi.org/10.1109/ICARA55094.2022.9738521&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Brooks, R.A. (1986)&#039;&#039;&#039; A Robust Layer Control System for a Mobile Robot, IEEE Journal of Robotics and Automation RA-2, 14-23&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Rickenbacher (1975)&#039;&#039;&#039; Lernen und Motivation als relevanzgesteuerte Datenverarbeitung: Ein Computer-Simulationsmodell elementarer kognitiv-affektiver Prozesse. Birkhäuser Verag Basel.&lt;/div&gt;</summary>
		<author><name>Peterr</name></author>
	</entry>
	<entry>
		<id>https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15298</id>
		<title>Leaphy Robot</title>
		<link rel="alternate" type="text/html" href="https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15298"/>
		<updated>2025-10-01T21:08:15Z</updated>

		<summary type="html">&lt;p&gt;Peterr: /* Behavioural levels */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Name=Leaphy robot with subsumption architecture&lt;br /&gt;
|Skills=software hardware electronics biology&lt;br /&gt;
|Status=Active&lt;br /&gt;
|Niche=robotics&lt;br /&gt;
|Purpose=Fun&lt;br /&gt;
|Picture=Leaphy back side view.jpg&lt;br /&gt;
|Tool=No&lt;br /&gt;
|Location=Space, home&lt;br /&gt;
|Cost=Very small given what is already present and what is available in the space (everything!!)&lt;br /&gt;
|Category=Electronics&lt;br /&gt;
}}&lt;br /&gt;
== Electronic insect-like creature ==&lt;br /&gt;
&#039;&#039;&#039;Physiological, Behavioural and environmental overview&#039;&#039;&#039; &amp;lt;br&amp;gt;&lt;br /&gt;
peterr 2022- 2025 (with &#039;&#039;very&#039;&#039; long pauses)&lt;br /&gt;
&lt;br /&gt;
====Document history====&lt;br /&gt;
* Currently this is a living document and this wiki contains the latest version&lt;br /&gt;
* September 2025 subsumption architecture design &amp;amp; transfer to nurdspace wiki&lt;br /&gt;
* August    2025 Documentation for scheduler&lt;br /&gt;
* March     2023 Draft version 0.2  - terminology cleanup and scope&lt;br /&gt;
* November  2022 First document sketches &amp;amp; ideas&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project==&lt;br /&gt;
The insect like creature based on the original [https://leaphy.store/product/leaphy-original-los/ leaphyrobot] has a set of functionalities that together allow it to effectively find, and feed on targets that provides electricity as a reward.&lt;br /&gt;
Learning strategies to improve success rate can be implemented.&lt;br /&gt;
Sexual signaling, event prediction, mating behaviour, genetic exchange and evolution are in principle possible but are currently still (far) out of scope. The system at it&#039;s highest level can be seen as a feedback loop: sensory input =&amp;gt; behavioural selection =&amp;gt; motor output =&amp;gt; new sensory input. The original design (2022) was meant to live in wind tunnel, and find odour sources to feed, but currently the emphasis has shifted from odour detection to more general sensory processing using subsumption architecture, [https://nurdspace.nl/Leaphy_Robot#Brain see below].&lt;br /&gt;
&lt;br /&gt;
== Sensory inputs ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Mechanoreceptor - sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
:::Micro switch based tactile hairs. &lt;br /&gt;
:::&#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Ultrasound - Distance sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
::: Ultrasonic pulses detect obstacles and trigger reflex avoidance behaviour&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Better directional responses would be possible with more than one US sensor. &lt;br /&gt;
:::: This would need a dedicated embedded processor. &lt;br /&gt;
:::: &#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing light intensity&#039;&#039;&#039;&lt;br /&gt;
::: Two LDR photoreceptors measure front-left light level and front-right light level&lt;br /&gt;
::: Total light intensity (sum) is available as an analog voltage&lt;br /&gt;
::: The difference between the inputs is also available, and signals what side to turn to, to approach or avoid the light.&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing sound (audio)&#039;&#039;&#039;&lt;br /&gt;
::: A subunit with its own processor, containing an Electret microphone to measure ambiant sound level, frequency and sound patterns. &lt;br /&gt;
::: Can be used in classical (Pawlow) and operand conditioning experiments. Will detect both absolute sound levels (for startle or avoidance responses) and can contain feature detectors (e.g. chirp intervals for leaf hopper like  communication and courting  behaviour of two leaphy&#039;s).  &lt;br /&gt;
::: In addition, an Audeme Movi speech recognition shield (see https://www.audeme.com/movi.html) could be used to process voice commands&lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented, but Movi shield &amp;quot;proof of concept&amp;quot; done&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;PIR movement sensor&#039;&#039;&#039;&lt;br /&gt;
::: In addition to light intensity, an infra red motion sensors can be used to detect movements (humans, or the cat for that matter) see for instance https://www.adafruit.com/product/4871 &lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented but PIR (similar to the adafruit thingy) available&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Sensing wind direction &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based tactile hairs?  Something like https://www.instructables.com/Low-Cost-Low-Speed-Wind-Sensor-1/ with shielding? or sensitive temperature measurements?&lt;br /&gt;
:::; Note: Wind direction sensing in the wind tunnel is currently replaced by sensing light gradients parallel to the wind direction because the wind sensor is not available yet. &lt;br /&gt;
:::: &#039;&#039;Development status: To be designed, high priority for the windtunnel version with odour processing as a main goal, low priority for the a free walking space/nurdspace version described here.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Volatiles (odours) &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based perception of volatiles like alcohol (fruit-fly like behaviours), Carbon dioxide (mosquito like behaviour), or VOC&#039;s (most plant eating insects). The sensor produces a voltage level proportional to the intensity of the stimulus. Using a threshold can generate a presence/absence signal. &lt;br /&gt;
::: The interval between odour pulses is a proxy for the distance to the source. Note that an odour &amp;quot;gradient&amp;quot; does not exist!&lt;br /&gt;
&lt;br /&gt;
::: Current implementation uses a SGP30 board. The time constant of the the sensor is in the order of 1 second, but &amp;quot;whiffs&amp;quot; of odour could be detected faster by using a feature detector that looks for sudden steps in the signal. This will also act as an sensory adaptation mechanism: in the absence of change the output go&#039;s to zero.&lt;br /&gt;
::: &#039;&#039;Development status: Sensor: worked, currently broken&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground color&#039;&#039;&#039;&lt;br /&gt;
::: This sensor measures ground colour and the output can be used to test for a particular condition (e.g. being at a target position). It can also be used to simulate trail pheromones implemented as colors next to the  trail followed. This sense can also take the role of short distance &amp;quot; present at target&amp;quot; stimuli.&lt;br /&gt;
::: &#039;&#039; Development status: Operational &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground reflection level&#039;&#039;&#039;&lt;br /&gt;
::: Two sensors &#039;line followers&#039; that both provide a binary present/absent signal of ground reflection.&lt;br /&gt;
::: Can be used to simulate trail following behaviour on a network of lines  (combined with (led) ground colours.&lt;br /&gt;
::: &#039;&#039;Development status: testing phase&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Future extensions: A combination of voltage levels and pulse frequency coding in the source could be used to simulate a spectrum of &amp;quot;chemical&amp;quot; inputs.  &lt;br /&gt;
:::: Feature detectors could extract particular frequencies and/or patterns to recognise for instance &amp;quot;&#039;&#039;toxic&#039;&#039;&amp;quot; substances. &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Proprioception (internal &amp;quot;feeling&amp;quot;)&#039;&#039;&#039;&lt;br /&gt;
::: Checking for instance for body movement when motors move, or for force feedback when extending electrical honey sucking mouthparts&lt;br /&gt;
::: Development status:To be developed, as yet low priority. &lt;br /&gt;
 &lt;br /&gt;
:: &#039;&#039;&#039;Sensing internal physiological states &#039;&#039;&#039;&lt;br /&gt;
:::To place electric reward information in perspective, some internal status information is needed, that is supplied by reading internal variables like energy levels (battery voltage , load current) or physiological state (internal variables like &amp;quot;ready to feed&amp;quot;. &lt;br /&gt;
::: More advances implementations could look up previous experiences, and rate of change in physiological status as well as brain hormone levels and excitation states (see below under internal states and hormones&amp;quot;).&lt;br /&gt;
:::Development status: To be designed.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing hormone levels&#039;&#039;&#039;&lt;br /&gt;
::: Certain activities or combinations of activities can stimulate the production of hormones. This could be implemented as slow changing values in memory. Hormone levels might modulate the effect of sensory input or behavioural output, and act as a slow form of memory.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing rewards and deterrents&#039;&#039;&#039;&lt;br /&gt;
::: Electronic organisms live on electricity, and are rewarded by sensing the presence of a voltage and current. This sensory organ is just sensing the analog voltage measured by the sensory organ. It simulates the perception of food such as nectar. Most logical position is at the tip of an appendage. &lt;br /&gt;
::: &#039;&#039;Development status: implemented and removed (needs mutiplexing). Mechanical movement (servo) to make electrical contact: testing phase.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Brain ==&lt;br /&gt;
::&#039;&#039;&#039;Subsumption architecture&#039;&#039;&#039;&lt;br /&gt;
:::The Electronic organisms has a software brain that receives sensory input both from the environment and internal status. The brain reads all inputs about every 50 msec, and produces command for actuators that produce behaviour. These behaviours can be as simple as a colour changes of a led (signaling sensory status) or movements of body and body and appendages. The aim is to make the lower levels as stateless as possible i.e. the brain uses its real time vision of the word as a model instead of some abstract internal representation. The processing principle roughly follow the subsumption architecture (Brooks 1986).&lt;br /&gt;
&lt;br /&gt;
:::Wikipedia writes about this technique:&lt;br /&gt;
::::&amp;quot;&#039;&#039;[Behaviours] are organized into a hierarchy of layers. Each layer implements a particular level of behavioral competence, and higher levels are able to subsume lower levels (= integrate/combine lower levels to a more comprehensive whole) in order to create viable behavior. For example, a robot&#039;s lowest layer could be &amp;quot;avoid an object&amp;quot;. The second layer would be &amp;quot;wander around&amp;quot;, which runs beneath the third layer &amp;quot;explore the world&amp;quot;.[...]The subsumption architecture creates a system in which the higher layers utilize the lower-level competencies. The layers, which all receive sensor-information, work in parallel and generate outputs. These outputs can be commands to actuators, or signals that suppress or inhibit other layers.&amp;quot;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::My current implementation uses the opposite order. The high priority levels conduct the simplest behavioural tasks, and when these high priority but simple behavioural levels are happy more complex task can get control. This approach is still experimental, but in any case easy enough to reverse again.&lt;br /&gt;
&lt;br /&gt;
:::The behavioural levels &#039;&#039;all&#039;&#039; compete for control of the robot. Each behavioural layer evaluates its sensory input and determines if it wants to control the outputs (to change its input according to its (implied) goal, e.g. mechanoreceptors (microswitches) will only request control if the switch is closed. After all the behavioural levels are evaluated, and their request flags set or reset an arbitrate routine  selects the highest active layer that will run the robot behaviorual output for the next 50 msec.&lt;br /&gt;
:::See Anderson (2007) for a clear explanations and actual implementation examples.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Brain subsystems&#039;&#039;&#039;&lt;br /&gt;
:::More complicated or slow tasks (like sound processing or US echo detection) can be executed in separate processor boards that report their status  to the main  controller. Conceptually this is not different from subroutines for tasks.&lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Nervous system&#039;&#039;&#039;&lt;br /&gt;
::: The currently (sort of) running implementation of the brain is using a real time loop in a very simple cooperative multitasking system ([https://yiweimao.github.io/blog/async_microcontroller/ YiweiMao scheduler]) and inmplemented on an Arduino Uno &lt;br /&gt;
::: &#039;&#039;Development status: operational, but under active development.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Associative memory&#039;&#039;&#039;&lt;br /&gt;
::: Associative memory in it current, simplest form will be implemented as memory locations for particular sensory input combinations.  inputs that coincide increase a counter for that combination (learning those combinations). This allows both Pawlow  and operand conditioning.&lt;br /&gt;
:::&#039;&#039;Development status: not yet implemented, proof of concept done ~50 years ago :).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Excitation state and hormones&#039;&#039;&#039;&lt;br /&gt;
::: Hormones are internal variables with levels that act as slow changing memory for previous (combinations of) states.&lt;br /&gt;
::: A default breakdown speed can be set that slowly decrease hormone levels. Particular sensory input could increase the levels again. Reaching high levels of certain hormones can be a goal in itself, and subject to learning behaviour.&lt;br /&gt;
::: &#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Satisfaction&#039;&#039;&#039;&lt;br /&gt;
:::Signals to end feeding behaviour can -in addition to electrical food running out- also come from internal signals (satiation, internal hormonal signals, (too) long time periods with little change of events)&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Future prediction&#039;&#039;&#039;&lt;br /&gt;
:::This is currently way out of scope, but neural-net like implementations that store event sequences, predict likely outcomes of current inputs and act accordingly are fully feasible.&lt;br /&gt;
::: See Rickenbacher 1975 for an example that is probably  a bit more traceable than -for instance- modern neural network code like Tensorflow. &lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Effectors ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;main motors&#039;&#039;&#039;&lt;br /&gt;
:::The main moves of the organism are implemented by two wheels driven by two [https://leaphy.store/product/tt-motor-10cm-jumper-female/ DC motors] with build in gearboxes) and a [https://leaphy.store/product/motor-shield/ motor shield]. Motor speed is controlled by pulse width modualation (PMW)) present in the processor. Steering is done by differential motorspeed, a third backside &amp;quot;wheel&amp;quot; is a simple short passive wooden stand. This works well on reasonable flat surfaces, but needs improvement is the next robot (Terzo).&lt;br /&gt;
:::&#039;&#039;Motor development status: Operational at a basic level, PID control and extra power at startup to get smooth startup at low speed is needed.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Movable mouthparts&#039;&#039;&#039;&lt;br /&gt;
:::Appendages like extendable mouthparts controlled by [https://isking-modellbahn.de/modelcraft-es-030-Servo-top-line-steuerelektronik servo]&#039;s can be used for feeding on electrical food. Currently one servo controlling a proboscis (mouthpart for feeding) is present.&lt;br /&gt;
:::&#039;&#039;Development status: Operational in priciple, untested in practice, needs 3D printing of parts&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;[https://leaphy.store/product/rgb-led-single/ Three colour led]&#039;&#039;&#039;&lt;br /&gt;
::: can be used for signaling status of whatever state we want.&lt;br /&gt;
:::&#039;&#039;Development status: Operational &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Piezo beeper &#039;&#039;&#039;&lt;br /&gt;
::: Present on the [https://leaphy.store/product/motor-shield/ motor shield] can be used to create a variety of sounds,for instance to signal happines, distress or alarm.&lt;br /&gt;
:::&#039;&#039;Development status: Operational, but specific sounds need to be designed&lt;br /&gt;
&lt;br /&gt;
== Behavioural levels ==&lt;br /&gt;
&lt;br /&gt;
:: Behaviour in subsumption architecture is organised in levels that compete for control, the highest priority behaviour (lowest rank, top of list) will control the robot for 50 msec. When lower levels are silent higher levels get control.&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Overview of current behavioral levels and  their most important inputs for controlling requests&#039;&#039;&#039;. &lt;br /&gt;
::See the actual calls for details.&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;Layer &amp;quot;distress&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::If unable to meet the absolute basic requirement for battery voltage or movement CALL for help. In STUCK, try reflexes to get loose, pause regular. If nothing works eventually HIBERNATE &lt;br /&gt;
&lt;br /&gt;
::::Goal:  deal with the really difficult situations &lt;br /&gt;
::::0  HIBERNATE // hope for better times...&lt;br /&gt;
::::1  STUCK // try to solve non-movement when motors run...&lt;br /&gt;
::::2  CALL  // call for help&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;stay free&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::The primary sensory input activating this level are Bumper sensors and Ultrasonics, but also hormones for high emotional levels reached by an overload of sensory input or a high number of failing tries to reach some goal. Freeze will stop movement for an serious amount of time to reduce overload Fight will move quickly forward and get very close to an object possibly even disregarding US and bumpers and hitting the object. Escape will try to free the bumpers Evade will try keep a safe distance from objects Flight will try to run straight for a relative long time (using a countdown timer) but will subsumed by lower levels.&lt;br /&gt;
&lt;br /&gt;
::::Goal: avoid stressors. &lt;br /&gt;
::::3  FREEZE  // simulated dead&lt;br /&gt;
::::4  FIGHT   // Try to intimidate &lt;br /&gt;
::::5  ESCAPE  // Escape from touch&lt;br /&gt;
::::6  EVADE   // keep distance&lt;br /&gt;
::::7  FLIGHT  // run away  &lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;external control&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::This level is only requesting control if external commands are present in sensordata. The behaviour is self-reinforcing so once activated it keeps controlling the creature as long as new commands arrive within reasonable time. Note that Escape and Evade and Flight have priority, manual control has limits, the creature is autonomous!&lt;br /&gt;
&lt;br /&gt;
::::Goals: Stay free and prevent distress, but otherwise otherwise obey external commands.&lt;br /&gt;
::::8 MANUAL&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;scan and move&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::This level is the heart of the brain. Reaching the first level of this layer (INTEGRATE) is rewarding. :::Everything is (locally) under control and a target goal can been set. This will also increase positive emotional level. INTEGRATE will inspect internal status, like battery level, and emotional states like exhaustion, excitatory state and modify the settings for ORIENT and MOVE acordingly. Options for ORIENTs setting are for instance random turn angles and low speed  for a drukard&#039;s walk,phototxis (pos. or neg), odour pulsecount or interval for kinesis behaviour, and PIR input (i. e. human) presense for more interactive behaviour. After this setting it will inhibit the setting of the the INTEGRATE request flag for some time. Input from rotary encoders and/or motor commands) will retrigger this inhibition of INTEGRATE so rotate and Orient can work. ROTATE will rotate around the body centre until some sensory dead zone for the current target (just picked by INTGRATE is reached. Move will drive forward and (together with ORIENT) allow the creatue to move in the direction of the goal implied by ORIENT. ACCEPT checks sensory input for an acceptable stop position that might have food  or a high quality resource. Accept will increase positive emotional levels. FEED will ill become active when food is indeed available available, for istance via bottom contacts and will increase positive emotianal levels even more.&lt;br /&gt;
&lt;br /&gt;
::::Goal: find out where and when and how to move and set a goal&lt;br /&gt;
::::: INTEGRATE // combine inputs and decide what to do at this moment.&lt;br /&gt;
::::10 ORIENT // orient towards the current goal&lt;br /&gt;
::::11 MOVE // move forward&lt;br /&gt;
::::12 ACCEPT // accept the current position and stop&lt;br /&gt;
::::13 FEED // electrical food is the best!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:: Stay tuned, more comming soon&lt;br /&gt;
&lt;br /&gt;
== Implementation details ==&lt;br /&gt;
: Stay tuned, more comming soon&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Anderson, D.P. (2007)&#039;&#039;&#039; https://www.dprg.org/articles/2007-03a/&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Bettosini et al., 2022&#039;&#039;&#039; Torocó: A Subsumption Architecture Implementation, in: 2022 8th International Conference on Automation, Robotics and Applications (ICARA) IEEE, Prague, Czech Republic, pp. 27–32. . https://doi.org/10.1109/ICARA55094.2022.9738521&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Brooks, R.A. (1986)&#039;&#039;&#039; A Robust Layer Control System for a Mobile Robot, IEEE Journal of Robotics and Automation RA-2, 14-23&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Rickenbacher (1975)&#039;&#039;&#039; Lernen und Motivation als relevanzgesteuerte Datenverarbeitung: Ein Computer-Simulationsmodell elementarer kognitiv-affektiver Prozesse. Birkhäuser Verag Basel.&lt;/div&gt;</summary>
		<author><name>Peterr</name></author>
	</entry>
	<entry>
		<id>https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15297</id>
		<title>Leaphy Robot</title>
		<link rel="alternate" type="text/html" href="https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15297"/>
		<updated>2025-10-01T21:07:13Z</updated>

		<summary type="html">&lt;p&gt;Peterr: /* Behavioural levels */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Name=Leaphy robot with subsumption architecture&lt;br /&gt;
|Skills=software hardware electronics biology&lt;br /&gt;
|Status=Active&lt;br /&gt;
|Niche=robotics&lt;br /&gt;
|Purpose=Fun&lt;br /&gt;
|Picture=Leaphy back side view.jpg&lt;br /&gt;
|Tool=No&lt;br /&gt;
|Location=Space, home&lt;br /&gt;
|Cost=Very small given what is already present and what is available in the space (everything!!)&lt;br /&gt;
|Category=Electronics&lt;br /&gt;
}}&lt;br /&gt;
== Electronic insect-like creature ==&lt;br /&gt;
&#039;&#039;&#039;Physiological, Behavioural and environmental overview&#039;&#039;&#039; &amp;lt;br&amp;gt;&lt;br /&gt;
peterr 2022- 2025 (with &#039;&#039;very&#039;&#039; long pauses)&lt;br /&gt;
&lt;br /&gt;
====Document history====&lt;br /&gt;
* Currently this is a living document and this wiki contains the latest version&lt;br /&gt;
* September 2025 subsumption architecture design &amp;amp; transfer to nurdspace wiki&lt;br /&gt;
* August    2025 Documentation for scheduler&lt;br /&gt;
* March     2023 Draft version 0.2  - terminology cleanup and scope&lt;br /&gt;
* November  2022 First document sketches &amp;amp; ideas&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project==&lt;br /&gt;
The insect like creature based on the original [https://leaphy.store/product/leaphy-original-los/ leaphyrobot] has a set of functionalities that together allow it to effectively find, and feed on targets that provides electricity as a reward.&lt;br /&gt;
Learning strategies to improve success rate can be implemented.&lt;br /&gt;
Sexual signaling, event prediction, mating behaviour, genetic exchange and evolution are in principle possible but are currently still (far) out of scope. The system at it&#039;s highest level can be seen as a feedback loop: sensory input =&amp;gt; behavioural selection =&amp;gt; motor output =&amp;gt; new sensory input. The original design (2022) was meant to live in wind tunnel, and find odour sources to feed, but currently the emphasis has shifted from odour detection to more general sensory processing using subsumption architecture, [https://nurdspace.nl/Leaphy_Robot#Brain see below].&lt;br /&gt;
&lt;br /&gt;
== Sensory inputs ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Mechanoreceptor - sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
:::Micro switch based tactile hairs. &lt;br /&gt;
:::&#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Ultrasound - Distance sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
::: Ultrasonic pulses detect obstacles and trigger reflex avoidance behaviour&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Better directional responses would be possible with more than one US sensor. &lt;br /&gt;
:::: This would need a dedicated embedded processor. &lt;br /&gt;
:::: &#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing light intensity&#039;&#039;&#039;&lt;br /&gt;
::: Two LDR photoreceptors measure front-left light level and front-right light level&lt;br /&gt;
::: Total light intensity (sum) is available as an analog voltage&lt;br /&gt;
::: The difference between the inputs is also available, and signals what side to turn to, to approach or avoid the light.&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing sound (audio)&#039;&#039;&#039;&lt;br /&gt;
::: A subunit with its own processor, containing an Electret microphone to measure ambiant sound level, frequency and sound patterns. &lt;br /&gt;
::: Can be used in classical (Pawlow) and operand conditioning experiments. Will detect both absolute sound levels (for startle or avoidance responses) and can contain feature detectors (e.g. chirp intervals for leaf hopper like  communication and courting  behaviour of two leaphy&#039;s).  &lt;br /&gt;
::: In addition, an Audeme Movi speech recognition shield (see https://www.audeme.com/movi.html) could be used to process voice commands&lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented, but Movi shield &amp;quot;proof of concept&amp;quot; done&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;PIR movement sensor&#039;&#039;&#039;&lt;br /&gt;
::: In addition to light intensity, an infra red motion sensors can be used to detect movements (humans, or the cat for that matter) see for instance https://www.adafruit.com/product/4871 &lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented but PIR (similar to the adafruit thingy) available&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Sensing wind direction &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based tactile hairs?  Something like https://www.instructables.com/Low-Cost-Low-Speed-Wind-Sensor-1/ with shielding? or sensitive temperature measurements?&lt;br /&gt;
:::; Note: Wind direction sensing in the wind tunnel is currently replaced by sensing light gradients parallel to the wind direction because the wind sensor is not available yet. &lt;br /&gt;
:::: &#039;&#039;Development status: To be designed, high priority for the windtunnel version with odour processing as a main goal, low priority for the a free walking space/nurdspace version described here.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Volatiles (odours) &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based perception of volatiles like alcohol (fruit-fly like behaviours), Carbon dioxide (mosquito like behaviour), or VOC&#039;s (most plant eating insects). The sensor produces a voltage level proportional to the intensity of the stimulus. Using a threshold can generate a presence/absence signal. &lt;br /&gt;
::: The interval between odour pulses is a proxy for the distance to the source. Note that an odour &amp;quot;gradient&amp;quot; does not exist!&lt;br /&gt;
&lt;br /&gt;
::: Current implementation uses a SGP30 board. The time constant of the the sensor is in the order of 1 second, but &amp;quot;whiffs&amp;quot; of odour could be detected faster by using a feature detector that looks for sudden steps in the signal. This will also act as an sensory adaptation mechanism: in the absence of change the output go&#039;s to zero.&lt;br /&gt;
::: &#039;&#039;Development status: Sensor: worked, currently broken&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground color&#039;&#039;&#039;&lt;br /&gt;
::: This sensor measures ground colour and the output can be used to test for a particular condition (e.g. being at a target position). It can also be used to simulate trail pheromones implemented as colors next to the  trail followed. This sense can also take the role of short distance &amp;quot; present at target&amp;quot; stimuli.&lt;br /&gt;
::: &#039;&#039; Development status: Operational &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground reflection level&#039;&#039;&#039;&lt;br /&gt;
::: Two sensors &#039;line followers&#039; that both provide a binary present/absent signal of ground reflection.&lt;br /&gt;
::: Can be used to simulate trail following behaviour on a network of lines  (combined with (led) ground colours.&lt;br /&gt;
::: &#039;&#039;Development status: testing phase&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Future extensions: A combination of voltage levels and pulse frequency coding in the source could be used to simulate a spectrum of &amp;quot;chemical&amp;quot; inputs.  &lt;br /&gt;
:::: Feature detectors could extract particular frequencies and/or patterns to recognise for instance &amp;quot;&#039;&#039;toxic&#039;&#039;&amp;quot; substances. &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Proprioception (internal &amp;quot;feeling&amp;quot;)&#039;&#039;&#039;&lt;br /&gt;
::: Checking for instance for body movement when motors move, or for force feedback when extending electrical honey sucking mouthparts&lt;br /&gt;
::: Development status:To be developed, as yet low priority. &lt;br /&gt;
 &lt;br /&gt;
:: &#039;&#039;&#039;Sensing internal physiological states &#039;&#039;&#039;&lt;br /&gt;
:::To place electric reward information in perspective, some internal status information is needed, that is supplied by reading internal variables like energy levels (battery voltage , load current) or physiological state (internal variables like &amp;quot;ready to feed&amp;quot;. &lt;br /&gt;
::: More advances implementations could look up previous experiences, and rate of change in physiological status as well as brain hormone levels and excitation states (see below under internal states and hormones&amp;quot;).&lt;br /&gt;
:::Development status: To be designed.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing hormone levels&#039;&#039;&#039;&lt;br /&gt;
::: Certain activities or combinations of activities can stimulate the production of hormones. This could be implemented as slow changing values in memory. Hormone levels might modulate the effect of sensory input or behavioural output, and act as a slow form of memory.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing rewards and deterrents&#039;&#039;&#039;&lt;br /&gt;
::: Electronic organisms live on electricity, and are rewarded by sensing the presence of a voltage and current. This sensory organ is just sensing the analog voltage measured by the sensory organ. It simulates the perception of food such as nectar. Most logical position is at the tip of an appendage. &lt;br /&gt;
::: &#039;&#039;Development status: implemented and removed (needs mutiplexing). Mechanical movement (servo) to make electrical contact: testing phase.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Brain ==&lt;br /&gt;
::&#039;&#039;&#039;Subsumption architecture&#039;&#039;&#039;&lt;br /&gt;
:::The Electronic organisms has a software brain that receives sensory input both from the environment and internal status. The brain reads all inputs about every 50 msec, and produces command for actuators that produce behaviour. These behaviours can be as simple as a colour changes of a led (signaling sensory status) or movements of body and body and appendages. The aim is to make the lower levels as stateless as possible i.e. the brain uses its real time vision of the word as a model instead of some abstract internal representation. The processing principle roughly follow the subsumption architecture (Brooks 1986).&lt;br /&gt;
&lt;br /&gt;
:::Wikipedia writes about this technique:&lt;br /&gt;
::::&amp;quot;&#039;&#039;[Behaviours] are organized into a hierarchy of layers. Each layer implements a particular level of behavioral competence, and higher levels are able to subsume lower levels (= integrate/combine lower levels to a more comprehensive whole) in order to create viable behavior. For example, a robot&#039;s lowest layer could be &amp;quot;avoid an object&amp;quot;. The second layer would be &amp;quot;wander around&amp;quot;, which runs beneath the third layer &amp;quot;explore the world&amp;quot;.[...]The subsumption architecture creates a system in which the higher layers utilize the lower-level competencies. The layers, which all receive sensor-information, work in parallel and generate outputs. These outputs can be commands to actuators, or signals that suppress or inhibit other layers.&amp;quot;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::My current implementation uses the opposite order. The high priority levels conduct the simplest behavioural tasks, and when these high priority but simple behavioural levels are happy more complex task can get control. This approach is still experimental, but in any case easy enough to reverse again.&lt;br /&gt;
&lt;br /&gt;
:::The behavioural levels &#039;&#039;all&#039;&#039; compete for control of the robot. Each behavioural layer evaluates its sensory input and determines if it wants to control the outputs (to change its input according to its (implied) goal, e.g. mechanoreceptors (microswitches) will only request control if the switch is closed. After all the behavioural levels are evaluated, and their request flags set or reset an arbitrate routine  selects the highest active layer that will run the robot behaviorual output for the next 50 msec.&lt;br /&gt;
:::See Anderson (2007) for a clear explanations and actual implementation examples.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Brain subsystems&#039;&#039;&#039;&lt;br /&gt;
:::More complicated or slow tasks (like sound processing or US echo detection) can be executed in separate processor boards that report their status  to the main  controller. Conceptually this is not different from subroutines for tasks.&lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Nervous system&#039;&#039;&#039;&lt;br /&gt;
::: The currently (sort of) running implementation of the brain is using a real time loop in a very simple cooperative multitasking system ([https://yiweimao.github.io/blog/async_microcontroller/ YiweiMao scheduler]) and inmplemented on an Arduino Uno &lt;br /&gt;
::: &#039;&#039;Development status: operational, but under active development.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Associative memory&#039;&#039;&#039;&lt;br /&gt;
::: Associative memory in it current, simplest form will be implemented as memory locations for particular sensory input combinations.  inputs that coincide increase a counter for that combination (learning those combinations). This allows both Pawlow  and operand conditioning.&lt;br /&gt;
:::&#039;&#039;Development status: not yet implemented, proof of concept done ~50 years ago :).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Excitation state and hormones&#039;&#039;&#039;&lt;br /&gt;
::: Hormones are internal variables with levels that act as slow changing memory for previous (combinations of) states.&lt;br /&gt;
::: A default breakdown speed can be set that slowly decrease hormone levels. Particular sensory input could increase the levels again. Reaching high levels of certain hormones can be a goal in itself, and subject to learning behaviour.&lt;br /&gt;
::: &#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Satisfaction&#039;&#039;&#039;&lt;br /&gt;
:::Signals to end feeding behaviour can -in addition to electrical food running out- also come from internal signals (satiation, internal hormonal signals, (too) long time periods with little change of events)&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Future prediction&#039;&#039;&#039;&lt;br /&gt;
:::This is currently way out of scope, but neural-net like implementations that store event sequences, predict likely outcomes of current inputs and act accordingly are fully feasible.&lt;br /&gt;
::: See Rickenbacher 1975 for an example that is probably  a bit more traceable than -for instance- modern neural network code like Tensorflow. &lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Effectors ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;main motors&#039;&#039;&#039;&lt;br /&gt;
:::The main moves of the organism are implemented by two wheels driven by two [https://leaphy.store/product/tt-motor-10cm-jumper-female/ DC motors] with build in gearboxes) and a [https://leaphy.store/product/motor-shield/ motor shield]. Motor speed is controlled by pulse width modualation (PMW)) present in the processor. Steering is done by differential motorspeed, a third backside &amp;quot;wheel&amp;quot; is a simple short passive wooden stand. This works well on reasonable flat surfaces, but needs improvement is the next robot (Terzo).&lt;br /&gt;
:::&#039;&#039;Motor development status: Operational at a basic level, PID control and extra power at startup to get smooth startup at low speed is needed.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Movable mouthparts&#039;&#039;&#039;&lt;br /&gt;
:::Appendages like extendable mouthparts controlled by [https://isking-modellbahn.de/modelcraft-es-030-Servo-top-line-steuerelektronik servo]&#039;s can be used for feeding on electrical food. Currently one servo controlling a proboscis (mouthpart for feeding) is present.&lt;br /&gt;
:::&#039;&#039;Development status: Operational in priciple, untested in practice, needs 3D printing of parts&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;[https://leaphy.store/product/rgb-led-single/ Three colour led]&#039;&#039;&#039;&lt;br /&gt;
::: can be used for signaling status of whatever state we want.&lt;br /&gt;
:::&#039;&#039;Development status: Operational &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Piezo beeper &#039;&#039;&#039;&lt;br /&gt;
::: Present on the [https://leaphy.store/product/motor-shield/ motor shield] can be used to create a variety of sounds,for instance to signal happines, distress or alarm.&lt;br /&gt;
:::&#039;&#039;Development status: Operational, but specific sounds need to be designed&lt;br /&gt;
&lt;br /&gt;
== Behavioural levels ==&lt;br /&gt;
&lt;br /&gt;
:: Behaviour in subsumption architecture is organised in levels that compete for control, the highest priority behaviour (lowest rank, top of list) will control the robot for 50 msec. When lower levels are silent higher levels get control.&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Overview of current behavioral levels and  their most important inputs for controlling requests&#039;&#039;&#039;. &lt;br /&gt;
::See the actual calls for details.&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;Layer &amp;quot;distress&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::If unable to meet the absolute basic requirement for battery voltage or movement CALL for help. In STUCK, try reflexes to get loose, pause regular. If nothing works eventually HIBERNATE &lt;br /&gt;
&lt;br /&gt;
::::Goal:  deal with the really difficult situations &lt;br /&gt;
::::0  HIBERNATE // hope for better times...&lt;br /&gt;
::::1  STUCK // try to solve non-movement when motors run...&lt;br /&gt;
::::2  CALL  // call for help&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;stay free&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::The primary sensory input activating this level are Bumper sensors and Ultrasonics, but also hormones for high emotional levels reached by an overload of sensory input or a high number of failing tries to reach some goal. Freeze will stop movement for an serious amount of time to reduce overload Fight will move quickly forward and get very close to an object possibly even disregarding US and bumpers and hitting the object. Escape will try to free the bumpers Evade will try keep a safe distance from objects Flight will try to run straight for a relative long time (using a countdown timer) but will subsumed by lower levels.&lt;br /&gt;
&lt;br /&gt;
::::Goal: avoid stressors. &lt;br /&gt;
::::3  FREEZE  // simulated dead&lt;br /&gt;
::::4  FIGHT   // Try to intimidate &lt;br /&gt;
::::5  ESCAPE  // Escape from touch&lt;br /&gt;
::::6  EVADE   // keep distance&lt;br /&gt;
::::7  FLIGHT  // run away  &lt;br /&gt;
&lt;br /&gt;
:::layer &#039;&#039;&#039;&amp;quot;external control&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::This level is only requesting control if external commands are present in sensordata. The behaviour is self-reinforcing so once activated it keeps controlling the creature as long as new commands arrive within reasonable time. Note that Escape and Evade and Flight have priority, manual control has limits, the creature is autonomous!&lt;br /&gt;
&lt;br /&gt;
::::Goals: Stay free and prevent distress, but otherwise otherwise obey external commands.&lt;br /&gt;
::::8 MANUAL&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;scan and move&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::This level is the heart of the brain. Reaching the first level of this layer (INTEGRATE) is rewarding. :::Everything is (locally) under control and a target goal can been set. This will also increase positive emotional level. INTEGRATE will inspect internal status, like battery level, and emotional states like exhaustion, excitatory state and modify the settings for ORIENT and MOVE acordingly. Options for ORIENTs setting are for instance random turn angles and low speed  for a drukard&#039;s walk,phototxis (pos. or neg), odour pulsecount or interval for kinesis behaviour, and PIR input (i. e. human) presense for more interactive behaviour. After this setting it will inhibit the setting of the the INTEGRATE request flag for some time. Input from rotary encoders and/or motor commands) will retrigger this inhibition of INTEGRATE so rotate and Orient can work. ROTATE will rotate around the body centre until some sensory dead zone for the current target (just picked by INTGRATE is reached. Move will drive forward and (together with ORIENT) allow the creatue to move in the direction of the goal implied by ORIENT. ACCEPT checks sensory input for an acceptable stop position that might have food  or a high quality resource. Accept will increase positive emotional levels. FEED will ill become active when food is indeed available available, for istance via bottom contacts and will increase positive emotianal levels even more.&lt;br /&gt;
&lt;br /&gt;
::::Goal: find out where and when and how to move and set a goal&lt;br /&gt;
::::: INTEGRATE // combine inputs and decide what to do at this moment.&lt;br /&gt;
::::10 ORIENT // orient towards the current goal&lt;br /&gt;
::::11 MOVE // move forward&lt;br /&gt;
::::12 ACCEPT // accept the current position and stop&lt;br /&gt;
::::13 FEED // electrical food is the best!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:: Stay tuned, more comming soon&lt;br /&gt;
&lt;br /&gt;
== Implementation details ==&lt;br /&gt;
: Stay tuned, more comming soon&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Anderson, D.P. (2007)&#039;&#039;&#039; https://www.dprg.org/articles/2007-03a/&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Bettosini et al., 2022&#039;&#039;&#039; Torocó: A Subsumption Architecture Implementation, in: 2022 8th International Conference on Automation, Robotics and Applications (ICARA) IEEE, Prague, Czech Republic, pp. 27–32. . https://doi.org/10.1109/ICARA55094.2022.9738521&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Brooks, R.A. (1986)&#039;&#039;&#039; A Robust Layer Control System for a Mobile Robot, IEEE Journal of Robotics and Automation RA-2, 14-23&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Rickenbacher (1975)&#039;&#039;&#039; Lernen und Motivation als relevanzgesteuerte Datenverarbeitung: Ein Computer-Simulationsmodell elementarer kognitiv-affektiver Prozesse. Birkhäuser Verag Basel.&lt;/div&gt;</summary>
		<author><name>Peterr</name></author>
	</entry>
	<entry>
		<id>https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15296</id>
		<title>Leaphy Robot</title>
		<link rel="alternate" type="text/html" href="https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15296"/>
		<updated>2025-10-01T20:59:38Z</updated>

		<summary type="html">&lt;p&gt;Peterr: /* Behavioural levels */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Name=Leaphy robot with subsumption architecture&lt;br /&gt;
|Skills=software hardware electronics biology&lt;br /&gt;
|Status=Active&lt;br /&gt;
|Niche=robotics&lt;br /&gt;
|Purpose=Fun&lt;br /&gt;
|Picture=Leaphy back side view.jpg&lt;br /&gt;
|Tool=No&lt;br /&gt;
|Location=Space, home&lt;br /&gt;
|Cost=Very small given what is already present and what is available in the space (everything!!)&lt;br /&gt;
|Category=Electronics&lt;br /&gt;
}}&lt;br /&gt;
== Electronic insect-like creature ==&lt;br /&gt;
&#039;&#039;&#039;Physiological, Behavioural and environmental overview&#039;&#039;&#039; &amp;lt;br&amp;gt;&lt;br /&gt;
peterr 2022- 2025 (with &#039;&#039;very&#039;&#039; long pauses)&lt;br /&gt;
&lt;br /&gt;
====Document history====&lt;br /&gt;
* Currently this is a living document and this wiki contains the latest version&lt;br /&gt;
* September 2025 subsumption architecture design &amp;amp; transfer to nurdspace wiki&lt;br /&gt;
* August    2025 Documentation for scheduler&lt;br /&gt;
* March     2023 Draft version 0.2  - terminology cleanup and scope&lt;br /&gt;
* November  2022 First document sketches &amp;amp; ideas&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project==&lt;br /&gt;
The insect like creature based on the original [https://leaphy.store/product/leaphy-original-los/ leaphyrobot] has a set of functionalities that together allow it to effectively find, and feed on targets that provides electricity as a reward.&lt;br /&gt;
Learning strategies to improve success rate can be implemented.&lt;br /&gt;
Sexual signaling, event prediction, mating behaviour, genetic exchange and evolution are in principle possible but are currently still (far) out of scope. The system at it&#039;s highest level can be seen as a feedback loop: sensory input =&amp;gt; behavioural selection =&amp;gt; motor output =&amp;gt; new sensory input. The original design (2022) was meant to live in wind tunnel, and find odour sources to feed, but currently the emphasis has shifted from odour detection to more general sensory processing using subsumption architecture, [https://nurdspace.nl/Leaphy_Robot#Brain see below].&lt;br /&gt;
&lt;br /&gt;
== Sensory inputs ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Mechanoreceptor - sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
:::Micro switch based tactile hairs. &lt;br /&gt;
:::&#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Ultrasound - Distance sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
::: Ultrasonic pulses detect obstacles and trigger reflex avoidance behaviour&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Better directional responses would be possible with more than one US sensor. &lt;br /&gt;
:::: This would need a dedicated embedded processor. &lt;br /&gt;
:::: &#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing light intensity&#039;&#039;&#039;&lt;br /&gt;
::: Two LDR photoreceptors measure front-left light level and front-right light level&lt;br /&gt;
::: Total light intensity (sum) is available as an analog voltage&lt;br /&gt;
::: The difference between the inputs is also available, and signals what side to turn to, to approach or avoid the light.&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing sound (audio)&#039;&#039;&#039;&lt;br /&gt;
::: A subunit with its own processor, containing an Electret microphone to measure ambiant sound level, frequency and sound patterns. &lt;br /&gt;
::: Can be used in classical (Pawlow) and operand conditioning experiments. Will detect both absolute sound levels (for startle or avoidance responses) and can contain feature detectors (e.g. chirp intervals for leaf hopper like  communication and courting  behaviour of two leaphy&#039;s).  &lt;br /&gt;
::: In addition, an Audeme Movi speech recognition shield (see https://www.audeme.com/movi.html) could be used to process voice commands&lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented, but Movi shield &amp;quot;proof of concept&amp;quot; done&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;PIR movement sensor&#039;&#039;&#039;&lt;br /&gt;
::: In addition to light intensity, an infra red motion sensors can be used to detect movements (humans, or the cat for that matter) see for instance https://www.adafruit.com/product/4871 &lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented but PIR (similar to the adafruit thingy) available&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Sensing wind direction &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based tactile hairs?  Something like https://www.instructables.com/Low-Cost-Low-Speed-Wind-Sensor-1/ with shielding? or sensitive temperature measurements?&lt;br /&gt;
:::; Note: Wind direction sensing in the wind tunnel is currently replaced by sensing light gradients parallel to the wind direction because the wind sensor is not available yet. &lt;br /&gt;
:::: &#039;&#039;Development status: To be designed, high priority for the windtunnel version with odour processing as a main goal, low priority for the a free walking space/nurdspace version described here.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Volatiles (odours) &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based perception of volatiles like alcohol (fruit-fly like behaviours), Carbon dioxide (mosquito like behaviour), or VOC&#039;s (most plant eating insects). The sensor produces a voltage level proportional to the intensity of the stimulus. Using a threshold can generate a presence/absence signal. &lt;br /&gt;
::: The interval between odour pulses is a proxy for the distance to the source. Note that an odour &amp;quot;gradient&amp;quot; does not exist!&lt;br /&gt;
&lt;br /&gt;
::: Current implementation uses a SGP30 board. The time constant of the the sensor is in the order of 1 second, but &amp;quot;whiffs&amp;quot; of odour could be detected faster by using a feature detector that looks for sudden steps in the signal. This will also act as an sensory adaptation mechanism: in the absence of change the output go&#039;s to zero.&lt;br /&gt;
::: &#039;&#039;Development status: Sensor: worked, currently broken&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground color&#039;&#039;&#039;&lt;br /&gt;
::: This sensor measures ground colour and the output can be used to test for a particular condition (e.g. being at a target position). It can also be used to simulate trail pheromones implemented as colors next to the  trail followed. This sense can also take the role of short distance &amp;quot; present at target&amp;quot; stimuli.&lt;br /&gt;
::: &#039;&#039; Development status: Operational &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground reflection level&#039;&#039;&#039;&lt;br /&gt;
::: Two sensors &#039;line followers&#039; that both provide a binary present/absent signal of ground reflection.&lt;br /&gt;
::: Can be used to simulate trail following behaviour on a network of lines  (combined with (led) ground colours.&lt;br /&gt;
::: &#039;&#039;Development status: testing phase&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Future extensions: A combination of voltage levels and pulse frequency coding in the source could be used to simulate a spectrum of &amp;quot;chemical&amp;quot; inputs.  &lt;br /&gt;
:::: Feature detectors could extract particular frequencies and/or patterns to recognise for instance &amp;quot;&#039;&#039;toxic&#039;&#039;&amp;quot; substances. &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Proprioception (internal &amp;quot;feeling&amp;quot;)&#039;&#039;&#039;&lt;br /&gt;
::: Checking for instance for body movement when motors move, or for force feedback when extending electrical honey sucking mouthparts&lt;br /&gt;
::: Development status:To be developed, as yet low priority. &lt;br /&gt;
 &lt;br /&gt;
:: &#039;&#039;&#039;Sensing internal physiological states &#039;&#039;&#039;&lt;br /&gt;
:::To place electric reward information in perspective, some internal status information is needed, that is supplied by reading internal variables like energy levels (battery voltage , load current) or physiological state (internal variables like &amp;quot;ready to feed&amp;quot;. &lt;br /&gt;
::: More advances implementations could look up previous experiences, and rate of change in physiological status as well as brain hormone levels and excitation states (see below under internal states and hormones&amp;quot;).&lt;br /&gt;
:::Development status: To be designed.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing hormone levels&#039;&#039;&#039;&lt;br /&gt;
::: Certain activities or combinations of activities can stimulate the production of hormones. This could be implemented as slow changing values in memory. Hormone levels might modulate the effect of sensory input or behavioural output, and act as a slow form of memory.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing rewards and deterrents&#039;&#039;&#039;&lt;br /&gt;
::: Electronic organisms live on electricity, and are rewarded by sensing the presence of a voltage and current. This sensory organ is just sensing the analog voltage measured by the sensory organ. It simulates the perception of food such as nectar. Most logical position is at the tip of an appendage. &lt;br /&gt;
::: &#039;&#039;Development status: implemented and removed (needs mutiplexing). Mechanical movement (servo) to make electrical contact: testing phase.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Brain ==&lt;br /&gt;
::&#039;&#039;&#039;Subsumption architecture&#039;&#039;&#039;&lt;br /&gt;
:::The Electronic organisms has a software brain that receives sensory input both from the environment and internal status. The brain reads all inputs about every 50 msec, and produces command for actuators that produce behaviour. These behaviours can be as simple as a colour changes of a led (signaling sensory status) or movements of body and body and appendages. The aim is to make the lower levels as stateless as possible i.e. the brain uses its real time vision of the word as a model instead of some abstract internal representation. The processing principle roughly follow the subsumption architecture (Brooks 1986).&lt;br /&gt;
&lt;br /&gt;
:::Wikipedia writes about this technique:&lt;br /&gt;
::::&amp;quot;&#039;&#039;[Behaviours] are organized into a hierarchy of layers. Each layer implements a particular level of behavioral competence, and higher levels are able to subsume lower levels (= integrate/combine lower levels to a more comprehensive whole) in order to create viable behavior. For example, a robot&#039;s lowest layer could be &amp;quot;avoid an object&amp;quot;. The second layer would be &amp;quot;wander around&amp;quot;, which runs beneath the third layer &amp;quot;explore the world&amp;quot;.[...]The subsumption architecture creates a system in which the higher layers utilize the lower-level competencies. The layers, which all receive sensor-information, work in parallel and generate outputs. These outputs can be commands to actuators, or signals that suppress or inhibit other layers.&amp;quot;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::My current implementation uses the opposite order. The high priority levels conduct the simplest behavioural tasks, and when these high priority but simple behavioural levels are happy more complex task can get control. This approach is still experimental, but in any case easy enough to reverse again.&lt;br /&gt;
&lt;br /&gt;
:::The behavioural levels &#039;&#039;all&#039;&#039; compete for control of the robot. Each behavioural layer evaluates its sensory input and determines if it wants to control the outputs (to change its input according to its (implied) goal, e.g. mechanoreceptors (microswitches) will only request control if the switch is closed. After all the behavioural levels are evaluated, and their request flags set or reset an arbitrate routine  selects the highest active layer that will run the robot behaviorual output for the next 50 msec.&lt;br /&gt;
:::See Anderson (2007) for a clear explanations and actual implementation examples.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Brain subsystems&#039;&#039;&#039;&lt;br /&gt;
:::More complicated or slow tasks (like sound processing or US echo detection) can be executed in separate processor boards that report their status  to the main  controller. Conceptually this is not different from subroutines for tasks.&lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Nervous system&#039;&#039;&#039;&lt;br /&gt;
::: The currently (sort of) running implementation of the brain is using a real time loop in a very simple cooperative multitasking system ([https://yiweimao.github.io/blog/async_microcontroller/ YiweiMao scheduler]) and inmplemented on an Arduino Uno &lt;br /&gt;
::: &#039;&#039;Development status: operational, but under active development.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Associative memory&#039;&#039;&#039;&lt;br /&gt;
::: Associative memory in it current, simplest form will be implemented as memory locations for particular sensory input combinations.  inputs that coincide increase a counter for that combination (learning those combinations). This allows both Pawlow  and operand conditioning.&lt;br /&gt;
:::&#039;&#039;Development status: not yet implemented, proof of concept done ~50 years ago :).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Excitation state and hormones&#039;&#039;&#039;&lt;br /&gt;
::: Hormones are internal variables with levels that act as slow changing memory for previous (combinations of) states.&lt;br /&gt;
::: A default breakdown speed can be set that slowly decrease hormone levels. Particular sensory input could increase the levels again. Reaching high levels of certain hormones can be a goal in itself, and subject to learning behaviour.&lt;br /&gt;
::: &#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Satisfaction&#039;&#039;&#039;&lt;br /&gt;
:::Signals to end feeding behaviour can -in addition to electrical food running out- also come from internal signals (satiation, internal hormonal signals, (too) long time periods with little change of events)&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Future prediction&#039;&#039;&#039;&lt;br /&gt;
:::This is currently way out of scope, but neural-net like implementations that store event sequences, predict likely outcomes of current inputs and act accordingly are fully feasible.&lt;br /&gt;
::: See Rickenbacher 1975 for an example that is probably  a bit more traceable than -for instance- modern neural network code like Tensorflow. &lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Effectors ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;main motors&#039;&#039;&#039;&lt;br /&gt;
:::The main moves of the organism are implemented by two wheels driven by two [https://leaphy.store/product/tt-motor-10cm-jumper-female/ DC motors] with build in gearboxes) and a [https://leaphy.store/product/motor-shield/ motor shield]. Motor speed is controlled by pulse width modualation (PMW)) present in the processor. Steering is done by differential motorspeed, a third backside &amp;quot;wheel&amp;quot; is a simple short passive wooden stand. This works well on reasonable flat surfaces, but needs improvement is the next robot (Terzo).&lt;br /&gt;
:::&#039;&#039;Motor development status: Operational at a basic level, PID control and extra power at startup to get smooth startup at low speed is needed.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Movable mouthparts&#039;&#039;&#039;&lt;br /&gt;
:::Appendages like extendable mouthparts controlled by [https://isking-modellbahn.de/modelcraft-es-030-Servo-top-line-steuerelektronik servo]&#039;s can be used for feeding on electrical food. Currently one servo controlling a proboscis (mouthpart for feeding) is present.&lt;br /&gt;
:::&#039;&#039;Development status: Operational in priciple, untested in practice, needs 3D printing of parts&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;[https://leaphy.store/product/rgb-led-single/ Three colour led]&#039;&#039;&#039;&lt;br /&gt;
::: can be used for signaling status of whatever state we want.&lt;br /&gt;
:::&#039;&#039;Development status: Operational &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Piezo beeper &#039;&#039;&#039;&lt;br /&gt;
::: Present on the [https://leaphy.store/product/motor-shield/ motor shield] can be used to create a variety of sounds,for instance to signal happines, distress or alarm.&lt;br /&gt;
:::&#039;&#039;Development status: Operational, but specific sounds need to be designed&lt;br /&gt;
&lt;br /&gt;
== Behavioural levels ==&lt;br /&gt;
&lt;br /&gt;
:: Behaviour in subsumption architecture is organised in levels that compete for control, the highest priority behaviour (lowest rank, top of list) will control the robot for 50 msec. When lower levels are silent higher levels get control.&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Overview of current behavioral levels and  their most important inputs for controlling requests&#039;&#039;&#039;. &lt;br /&gt;
::See the actual calls for details.&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;Layer &amp;quot;distress&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::If unable to meet the absolute basic requirement for battery voltage or movement CALL for help. In STUCK, try reflexes to get loose, pause regular. If nothing works eventually HIBERNATE &lt;br /&gt;
&lt;br /&gt;
::::Goal:  deal with the really difficult situations &lt;br /&gt;
::::0  HIBERNATE // hope for better times...&lt;br /&gt;
::::1  STUCK // try to solve non-movement when motors run...&lt;br /&gt;
::::2  CALL  // call for help&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;stay free&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::The primary sensory input activating this level are Bumper sensors and Ultrasonics, but also hormones for high emotional levels reached by an overload of sensory input or a high number of failing tries to reach some goal. Freeze will stop movement for an serious amount of time to reduce overload Fight will move quickly forward and get very close to an object possibly even disregarding US and bumpers and hitting the object. Escape will try to free the bumpers Evade will try keep a safe distance from objects Flight will try to run straight for a relative long time (using a countdown timer) but will subsumed by lower levels.&lt;br /&gt;
&lt;br /&gt;
::::Goal: avoid stressors. &lt;br /&gt;
::::3  FREEZE  // simulated dead&lt;br /&gt;
::::4  FIGHT   // Try to intimidate &lt;br /&gt;
::::5  ESCAPE  // Escape from touch&lt;br /&gt;
::::6  EVADE   // keep distance&lt;br /&gt;
::::7  FLIGHT  // run away  &lt;br /&gt;
&lt;br /&gt;
:::layer &#039;&#039;&#039;&amp;quot;external control&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::This level is only requesting control if external commands are present in sensordata. The behaviour is self-reinforcing so once activated it keeps controlling the creature as long as new commands arrive within reasonable time. Note that Escape and Evade and Flight have priority, manual control has limits, the creature is autonomous!&lt;br /&gt;
&lt;br /&gt;
::::Goals: Stay free and prevent distress, but otherwise otherwise obey external commands.&lt;br /&gt;
::::8 MANUAL&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:: Stay tuned, more comming soon&lt;br /&gt;
&lt;br /&gt;
== Implementation details ==&lt;br /&gt;
: Stay tuned, more comming soon&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Anderson, D.P. (2007)&#039;&#039;&#039; https://www.dprg.org/articles/2007-03a/&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Bettosini et al., 2022&#039;&#039;&#039; Torocó: A Subsumption Architecture Implementation, in: 2022 8th International Conference on Automation, Robotics and Applications (ICARA) IEEE, Prague, Czech Republic, pp. 27–32. . https://doi.org/10.1109/ICARA55094.2022.9738521&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Brooks, R.A. (1986)&#039;&#039;&#039; A Robust Layer Control System for a Mobile Robot, IEEE Journal of Robotics and Automation RA-2, 14-23&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Rickenbacher (1975)&#039;&#039;&#039; Lernen und Motivation als relevanzgesteuerte Datenverarbeitung: Ein Computer-Simulationsmodell elementarer kognitiv-affektiver Prozesse. Birkhäuser Verag Basel.&lt;/div&gt;</summary>
		<author><name>Peterr</name></author>
	</entry>
	<entry>
		<id>https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15295</id>
		<title>Leaphy Robot</title>
		<link rel="alternate" type="text/html" href="https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15295"/>
		<updated>2025-10-01T20:56:39Z</updated>

		<summary type="html">&lt;p&gt;Peterr: /* Behavioural levels */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Name=Leaphy robot with subsumption architecture&lt;br /&gt;
|Skills=software hardware electronics biology&lt;br /&gt;
|Status=Active&lt;br /&gt;
|Niche=robotics&lt;br /&gt;
|Purpose=Fun&lt;br /&gt;
|Picture=Leaphy back side view.jpg&lt;br /&gt;
|Tool=No&lt;br /&gt;
|Location=Space, home&lt;br /&gt;
|Cost=Very small given what is already present and what is available in the space (everything!!)&lt;br /&gt;
|Category=Electronics&lt;br /&gt;
}}&lt;br /&gt;
== Electronic insect-like creature ==&lt;br /&gt;
&#039;&#039;&#039;Physiological, Behavioural and environmental overview&#039;&#039;&#039; &amp;lt;br&amp;gt;&lt;br /&gt;
peterr 2022- 2025 (with &#039;&#039;very&#039;&#039; long pauses)&lt;br /&gt;
&lt;br /&gt;
====Document history====&lt;br /&gt;
* Currently this is a living document and this wiki contains the latest version&lt;br /&gt;
* September 2025 subsumption architecture design &amp;amp; transfer to nurdspace wiki&lt;br /&gt;
* August    2025 Documentation for scheduler&lt;br /&gt;
* March     2023 Draft version 0.2  - terminology cleanup and scope&lt;br /&gt;
* November  2022 First document sketches &amp;amp; ideas&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project==&lt;br /&gt;
The insect like creature based on the original [https://leaphy.store/product/leaphy-original-los/ leaphyrobot] has a set of functionalities that together allow it to effectively find, and feed on targets that provides electricity as a reward.&lt;br /&gt;
Learning strategies to improve success rate can be implemented.&lt;br /&gt;
Sexual signaling, event prediction, mating behaviour, genetic exchange and evolution are in principle possible but are currently still (far) out of scope. The system at it&#039;s highest level can be seen as a feedback loop: sensory input =&amp;gt; behavioural selection =&amp;gt; motor output =&amp;gt; new sensory input. The original design (2022) was meant to live in wind tunnel, and find odour sources to feed, but currently the emphasis has shifted from odour detection to more general sensory processing using subsumption architecture, [https://nurdspace.nl/Leaphy_Robot#Brain see below].&lt;br /&gt;
&lt;br /&gt;
== Sensory inputs ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Mechanoreceptor - sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
:::Micro switch based tactile hairs. &lt;br /&gt;
:::&#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Ultrasound - Distance sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
::: Ultrasonic pulses detect obstacles and trigger reflex avoidance behaviour&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Better directional responses would be possible with more than one US sensor. &lt;br /&gt;
:::: This would need a dedicated embedded processor. &lt;br /&gt;
:::: &#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing light intensity&#039;&#039;&#039;&lt;br /&gt;
::: Two LDR photoreceptors measure front-left light level and front-right light level&lt;br /&gt;
::: Total light intensity (sum) is available as an analog voltage&lt;br /&gt;
::: The difference between the inputs is also available, and signals what side to turn to, to approach or avoid the light.&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing sound (audio)&#039;&#039;&#039;&lt;br /&gt;
::: A subunit with its own processor, containing an Electret microphone to measure ambiant sound level, frequency and sound patterns. &lt;br /&gt;
::: Can be used in classical (Pawlow) and operand conditioning experiments. Will detect both absolute sound levels (for startle or avoidance responses) and can contain feature detectors (e.g. chirp intervals for leaf hopper like  communication and courting  behaviour of two leaphy&#039;s).  &lt;br /&gt;
::: In addition, an Audeme Movi speech recognition shield (see https://www.audeme.com/movi.html) could be used to process voice commands&lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented, but Movi shield &amp;quot;proof of concept&amp;quot; done&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;PIR movement sensor&#039;&#039;&#039;&lt;br /&gt;
::: In addition to light intensity, an infra red motion sensors can be used to detect movements (humans, or the cat for that matter) see for instance https://www.adafruit.com/product/4871 &lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented but PIR (similar to the adafruit thingy) available&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Sensing wind direction &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based tactile hairs?  Something like https://www.instructables.com/Low-Cost-Low-Speed-Wind-Sensor-1/ with shielding? or sensitive temperature measurements?&lt;br /&gt;
:::; Note: Wind direction sensing in the wind tunnel is currently replaced by sensing light gradients parallel to the wind direction because the wind sensor is not available yet. &lt;br /&gt;
:::: &#039;&#039;Development status: To be designed, high priority for the windtunnel version with odour processing as a main goal, low priority for the a free walking space/nurdspace version described here.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Volatiles (odours) &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based perception of volatiles like alcohol (fruit-fly like behaviours), Carbon dioxide (mosquito like behaviour), or VOC&#039;s (most plant eating insects). The sensor produces a voltage level proportional to the intensity of the stimulus. Using a threshold can generate a presence/absence signal. &lt;br /&gt;
::: The interval between odour pulses is a proxy for the distance to the source. Note that an odour &amp;quot;gradient&amp;quot; does not exist!&lt;br /&gt;
&lt;br /&gt;
::: Current implementation uses a SGP30 board. The time constant of the the sensor is in the order of 1 second, but &amp;quot;whiffs&amp;quot; of odour could be detected faster by using a feature detector that looks for sudden steps in the signal. This will also act as an sensory adaptation mechanism: in the absence of change the output go&#039;s to zero.&lt;br /&gt;
::: &#039;&#039;Development status: Sensor: worked, currently broken&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground color&#039;&#039;&#039;&lt;br /&gt;
::: This sensor measures ground colour and the output can be used to test for a particular condition (e.g. being at a target position). It can also be used to simulate trail pheromones implemented as colors next to the  trail followed. This sense can also take the role of short distance &amp;quot; present at target&amp;quot; stimuli.&lt;br /&gt;
::: &#039;&#039; Development status: Operational &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground reflection level&#039;&#039;&#039;&lt;br /&gt;
::: Two sensors &#039;line followers&#039; that both provide a binary present/absent signal of ground reflection.&lt;br /&gt;
::: Can be used to simulate trail following behaviour on a network of lines  (combined with (led) ground colours.&lt;br /&gt;
::: &#039;&#039;Development status: testing phase&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Future extensions: A combination of voltage levels and pulse frequency coding in the source could be used to simulate a spectrum of &amp;quot;chemical&amp;quot; inputs.  &lt;br /&gt;
:::: Feature detectors could extract particular frequencies and/or patterns to recognise for instance &amp;quot;&#039;&#039;toxic&#039;&#039;&amp;quot; substances. &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Proprioception (internal &amp;quot;feeling&amp;quot;)&#039;&#039;&#039;&lt;br /&gt;
::: Checking for instance for body movement when motors move, or for force feedback when extending electrical honey sucking mouthparts&lt;br /&gt;
::: Development status:To be developed, as yet low priority. &lt;br /&gt;
 &lt;br /&gt;
:: &#039;&#039;&#039;Sensing internal physiological states &#039;&#039;&#039;&lt;br /&gt;
:::To place electric reward information in perspective, some internal status information is needed, that is supplied by reading internal variables like energy levels (battery voltage , load current) or physiological state (internal variables like &amp;quot;ready to feed&amp;quot;. &lt;br /&gt;
::: More advances implementations could look up previous experiences, and rate of change in physiological status as well as brain hormone levels and excitation states (see below under internal states and hormones&amp;quot;).&lt;br /&gt;
:::Development status: To be designed.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing hormone levels&#039;&#039;&#039;&lt;br /&gt;
::: Certain activities or combinations of activities can stimulate the production of hormones. This could be implemented as slow changing values in memory. Hormone levels might modulate the effect of sensory input or behavioural output, and act as a slow form of memory.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing rewards and deterrents&#039;&#039;&#039;&lt;br /&gt;
::: Electronic organisms live on electricity, and are rewarded by sensing the presence of a voltage and current. This sensory organ is just sensing the analog voltage measured by the sensory organ. It simulates the perception of food such as nectar. Most logical position is at the tip of an appendage. &lt;br /&gt;
::: &#039;&#039;Development status: implemented and removed (needs mutiplexing). Mechanical movement (servo) to make electrical contact: testing phase.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Brain ==&lt;br /&gt;
::&#039;&#039;&#039;Subsumption architecture&#039;&#039;&#039;&lt;br /&gt;
:::The Electronic organisms has a software brain that receives sensory input both from the environment and internal status. The brain reads all inputs about every 50 msec, and produces command for actuators that produce behaviour. These behaviours can be as simple as a colour changes of a led (signaling sensory status) or movements of body and body and appendages. The aim is to make the lower levels as stateless as possible i.e. the brain uses its real time vision of the word as a model instead of some abstract internal representation. The processing principle roughly follow the subsumption architecture (Brooks 1986).&lt;br /&gt;
&lt;br /&gt;
:::Wikipedia writes about this technique:&lt;br /&gt;
::::&amp;quot;&#039;&#039;[Behaviours] are organized into a hierarchy of layers. Each layer implements a particular level of behavioral competence, and higher levels are able to subsume lower levels (= integrate/combine lower levels to a more comprehensive whole) in order to create viable behavior. For example, a robot&#039;s lowest layer could be &amp;quot;avoid an object&amp;quot;. The second layer would be &amp;quot;wander around&amp;quot;, which runs beneath the third layer &amp;quot;explore the world&amp;quot;.[...]The subsumption architecture creates a system in which the higher layers utilize the lower-level competencies. The layers, which all receive sensor-information, work in parallel and generate outputs. These outputs can be commands to actuators, or signals that suppress or inhibit other layers.&amp;quot;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::My current implementation uses the opposite order. The high priority levels conduct the simplest behavioural tasks, and when these high priority but simple behavioural levels are happy more complex task can get control. This approach is still experimental, but in any case easy enough to reverse again.&lt;br /&gt;
&lt;br /&gt;
:::The behavioural levels &#039;&#039;all&#039;&#039; compete for control of the robot. Each behavioural layer evaluates its sensory input and determines if it wants to control the outputs (to change its input according to its (implied) goal, e.g. mechanoreceptors (microswitches) will only request control if the switch is closed. After all the behavioural levels are evaluated, and their request flags set or reset an arbitrate routine  selects the highest active layer that will run the robot behaviorual output for the next 50 msec.&lt;br /&gt;
:::See Anderson (2007) for a clear explanations and actual implementation examples.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Brain subsystems&#039;&#039;&#039;&lt;br /&gt;
:::More complicated or slow tasks (like sound processing or US echo detection) can be executed in separate processor boards that report their status  to the main  controller. Conceptually this is not different from subroutines for tasks.&lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Nervous system&#039;&#039;&#039;&lt;br /&gt;
::: The currently (sort of) running implementation of the brain is using a real time loop in a very simple cooperative multitasking system ([https://yiweimao.github.io/blog/async_microcontroller/ YiweiMao scheduler]) and inmplemented on an Arduino Uno &lt;br /&gt;
::: &#039;&#039;Development status: operational, but under active development.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Associative memory&#039;&#039;&#039;&lt;br /&gt;
::: Associative memory in it current, simplest form will be implemented as memory locations for particular sensory input combinations.  inputs that coincide increase a counter for that combination (learning those combinations). This allows both Pawlow  and operand conditioning.&lt;br /&gt;
:::&#039;&#039;Development status: not yet implemented, proof of concept done ~50 years ago :).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Excitation state and hormones&#039;&#039;&#039;&lt;br /&gt;
::: Hormones are internal variables with levels that act as slow changing memory for previous (combinations of) states.&lt;br /&gt;
::: A default breakdown speed can be set that slowly decrease hormone levels. Particular sensory input could increase the levels again. Reaching high levels of certain hormones can be a goal in itself, and subject to learning behaviour.&lt;br /&gt;
::: &#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Satisfaction&#039;&#039;&#039;&lt;br /&gt;
:::Signals to end feeding behaviour can -in addition to electrical food running out- also come from internal signals (satiation, internal hormonal signals, (too) long time periods with little change of events)&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Future prediction&#039;&#039;&#039;&lt;br /&gt;
:::This is currently way out of scope, but neural-net like implementations that store event sequences, predict likely outcomes of current inputs and act accordingly are fully feasible.&lt;br /&gt;
::: See Rickenbacher 1975 for an example that is probably  a bit more traceable than -for instance- modern neural network code like Tensorflow. &lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Effectors ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;main motors&#039;&#039;&#039;&lt;br /&gt;
:::The main moves of the organism are implemented by two wheels driven by two [https://leaphy.store/product/tt-motor-10cm-jumper-female/ DC motors] with build in gearboxes) and a [https://leaphy.store/product/motor-shield/ motor shield]. Motor speed is controlled by pulse width modualation (PMW)) present in the processor. Steering is done by differential motorspeed, a third backside &amp;quot;wheel&amp;quot; is a simple short passive wooden stand. This works well on reasonable flat surfaces, but needs improvement is the next robot (Terzo).&lt;br /&gt;
:::&#039;&#039;Motor development status: Operational at a basic level, PID control and extra power at startup to get smooth startup at low speed is needed.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Movable mouthparts&#039;&#039;&#039;&lt;br /&gt;
:::Appendages like extendable mouthparts controlled by [https://isking-modellbahn.de/modelcraft-es-030-Servo-top-line-steuerelektronik servo]&#039;s can be used for feeding on electrical food. Currently one servo controlling a proboscis (mouthpart for feeding) is present.&lt;br /&gt;
:::&#039;&#039;Development status: Operational in priciple, untested in practice, needs 3D printing of parts&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;[https://leaphy.store/product/rgb-led-single/ Three colour led]&#039;&#039;&#039;&lt;br /&gt;
::: can be used for signaling status of whatever state we want.&lt;br /&gt;
:::&#039;&#039;Development status: Operational &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Piezo beeper &#039;&#039;&#039;&lt;br /&gt;
::: Present on the [https://leaphy.store/product/motor-shield/ motor shield] can be used to create a variety of sounds,for instance to signal happines, distress or alarm.&lt;br /&gt;
:::&#039;&#039;Development status: Operational, but specific sounds need to be designed&lt;br /&gt;
&lt;br /&gt;
== Behavioural levels ==&lt;br /&gt;
&lt;br /&gt;
:: Behaviour in subsumption architecture is organised in levels that compete for control, the highest priority behaviour (lowest rank, top of list) will control the robot for 50 msec. When lower levels are silent higher levels get control.&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Overview of current behavioral levels and  their most important inputs for controlling requests&#039;&#039;&#039;. &lt;br /&gt;
::See the actual calls for details.&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;Layer &amp;quot;distress&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::If unable to meet the absolute basic requirement for battery voltage or movement CALL for help. In STUCK, try reflexes to get loose, pause regular. If nothing works eventually HIBERNATE &lt;br /&gt;
&lt;br /&gt;
::::Goal:  deal with the really difficult situations &lt;br /&gt;
::::0  HIBERNATE // hope for better times...&lt;br /&gt;
::::1  STUCK // try to solve non-movement when motors run...&lt;br /&gt;
::::2  CALL  // call for help&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;stay free&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::The primary sensory input activating this level are Bumper sensors and Ultrasonics, but also hormones for high emotional levels reached by an overload of sensory input or a high number of failing tries to reach some goal. Freeze will stop movement for an serious amount of time to reduce overload Fight will move quickly forward and get very close to an object possibly even disregarding US and bumpers and hitting the object. Escape will try to free the bumpers Evade will try keep a safe distance from objects Flight will try to run straight for a relative long time (using a countdown timer) but will subsumed by lower levels.&lt;br /&gt;
&lt;br /&gt;
::::Goal: avoid stressors. &lt;br /&gt;
::::3  FREEZE  // simulated dead&lt;br /&gt;
::::4  FIGHT   // Try to intimidate &lt;br /&gt;
::::5  ESCAPE  // Escape from touch&lt;br /&gt;
::::6  EVADE   // keep distance&lt;br /&gt;
::::7  FLIGHT  // run away  &lt;br /&gt;
&lt;br /&gt;
:::layer &#039;&#039;&#039;&amp;quot;external control&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::This level is only requesting control if external commands are present in sensordata. The behaviour is self-reinforcing so once activated it keeps controlling the creature as long as new commands arrive within reasonable time.&lt;br /&gt;
&lt;br /&gt;
::::Goals: No distress. Stay free, but otherwise otherwise obey external commands&lt;br /&gt;
::::8 MANUAL&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:: Stay tuned, more comming soon&lt;br /&gt;
&lt;br /&gt;
== Implementation details ==&lt;br /&gt;
: Stay tuned, more comming soon&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Anderson, D.P. (2007)&#039;&#039;&#039; https://www.dprg.org/articles/2007-03a/&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Bettosini et al., 2022&#039;&#039;&#039; Torocó: A Subsumption Architecture Implementation, in: 2022 8th International Conference on Automation, Robotics and Applications (ICARA) IEEE, Prague, Czech Republic, pp. 27–32. . https://doi.org/10.1109/ICARA55094.2022.9738521&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Brooks, R.A. (1986)&#039;&#039;&#039; A Robust Layer Control System for a Mobile Robot, IEEE Journal of Robotics and Automation RA-2, 14-23&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Rickenbacher (1975)&#039;&#039;&#039; Lernen und Motivation als relevanzgesteuerte Datenverarbeitung: Ein Computer-Simulationsmodell elementarer kognitiv-affektiver Prozesse. Birkhäuser Verag Basel.&lt;/div&gt;</summary>
		<author><name>Peterr</name></author>
	</entry>
	<entry>
		<id>https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15294</id>
		<title>Leaphy Robot</title>
		<link rel="alternate" type="text/html" href="https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15294"/>
		<updated>2025-10-01T20:55:43Z</updated>

		<summary type="html">&lt;p&gt;Peterr: /* Behavioural levels */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Name=Leaphy robot with subsumption architecture&lt;br /&gt;
|Skills=software hardware electronics biology&lt;br /&gt;
|Status=Active&lt;br /&gt;
|Niche=robotics&lt;br /&gt;
|Purpose=Fun&lt;br /&gt;
|Picture=Leaphy back side view.jpg&lt;br /&gt;
|Tool=No&lt;br /&gt;
|Location=Space, home&lt;br /&gt;
|Cost=Very small given what is already present and what is available in the space (everything!!)&lt;br /&gt;
|Category=Electronics&lt;br /&gt;
}}&lt;br /&gt;
== Electronic insect-like creature ==&lt;br /&gt;
&#039;&#039;&#039;Physiological, Behavioural and environmental overview&#039;&#039;&#039; &amp;lt;br&amp;gt;&lt;br /&gt;
peterr 2022- 2025 (with &#039;&#039;very&#039;&#039; long pauses)&lt;br /&gt;
&lt;br /&gt;
====Document history====&lt;br /&gt;
* Currently this is a living document and this wiki contains the latest version&lt;br /&gt;
* September 2025 subsumption architecture design &amp;amp; transfer to nurdspace wiki&lt;br /&gt;
* August    2025 Documentation for scheduler&lt;br /&gt;
* March     2023 Draft version 0.2  - terminology cleanup and scope&lt;br /&gt;
* November  2022 First document sketches &amp;amp; ideas&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project==&lt;br /&gt;
The insect like creature based on the original [https://leaphy.store/product/leaphy-original-los/ leaphyrobot] has a set of functionalities that together allow it to effectively find, and feed on targets that provides electricity as a reward.&lt;br /&gt;
Learning strategies to improve success rate can be implemented.&lt;br /&gt;
Sexual signaling, event prediction, mating behaviour, genetic exchange and evolution are in principle possible but are currently still (far) out of scope. The system at it&#039;s highest level can be seen as a feedback loop: sensory input =&amp;gt; behavioural selection =&amp;gt; motor output =&amp;gt; new sensory input. The original design (2022) was meant to live in wind tunnel, and find odour sources to feed, but currently the emphasis has shifted from odour detection to more general sensory processing using subsumption architecture, [https://nurdspace.nl/Leaphy_Robot#Brain see below].&lt;br /&gt;
&lt;br /&gt;
== Sensory inputs ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Mechanoreceptor - sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
:::Micro switch based tactile hairs. &lt;br /&gt;
:::&#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Ultrasound - Distance sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
::: Ultrasonic pulses detect obstacles and trigger reflex avoidance behaviour&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Better directional responses would be possible with more than one US sensor. &lt;br /&gt;
:::: This would need a dedicated embedded processor. &lt;br /&gt;
:::: &#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing light intensity&#039;&#039;&#039;&lt;br /&gt;
::: Two LDR photoreceptors measure front-left light level and front-right light level&lt;br /&gt;
::: Total light intensity (sum) is available as an analog voltage&lt;br /&gt;
::: The difference between the inputs is also available, and signals what side to turn to, to approach or avoid the light.&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing sound (audio)&#039;&#039;&#039;&lt;br /&gt;
::: A subunit with its own processor, containing an Electret microphone to measure ambiant sound level, frequency and sound patterns. &lt;br /&gt;
::: Can be used in classical (Pawlow) and operand conditioning experiments. Will detect both absolute sound levels (for startle or avoidance responses) and can contain feature detectors (e.g. chirp intervals for leaf hopper like  communication and courting  behaviour of two leaphy&#039;s).  &lt;br /&gt;
::: In addition, an Audeme Movi speech recognition shield (see https://www.audeme.com/movi.html) could be used to process voice commands&lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented, but Movi shield &amp;quot;proof of concept&amp;quot; done&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;PIR movement sensor&#039;&#039;&#039;&lt;br /&gt;
::: In addition to light intensity, an infra red motion sensors can be used to detect movements (humans, or the cat for that matter) see for instance https://www.adafruit.com/product/4871 &lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented but PIR (similar to the adafruit thingy) available&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Sensing wind direction &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based tactile hairs?  Something like https://www.instructables.com/Low-Cost-Low-Speed-Wind-Sensor-1/ with shielding? or sensitive temperature measurements?&lt;br /&gt;
:::; Note: Wind direction sensing in the wind tunnel is currently replaced by sensing light gradients parallel to the wind direction because the wind sensor is not available yet. &lt;br /&gt;
:::: &#039;&#039;Development status: To be designed, high priority for the windtunnel version with odour processing as a main goal, low priority for the a free walking space/nurdspace version described here.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Volatiles (odours) &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based perception of volatiles like alcohol (fruit-fly like behaviours), Carbon dioxide (mosquito like behaviour), or VOC&#039;s (most plant eating insects). The sensor produces a voltage level proportional to the intensity of the stimulus. Using a threshold can generate a presence/absence signal. &lt;br /&gt;
::: The interval between odour pulses is a proxy for the distance to the source. Note that an odour &amp;quot;gradient&amp;quot; does not exist!&lt;br /&gt;
&lt;br /&gt;
::: Current implementation uses a SGP30 board. The time constant of the the sensor is in the order of 1 second, but &amp;quot;whiffs&amp;quot; of odour could be detected faster by using a feature detector that looks for sudden steps in the signal. This will also act as an sensory adaptation mechanism: in the absence of change the output go&#039;s to zero.&lt;br /&gt;
::: &#039;&#039;Development status: Sensor: worked, currently broken&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground color&#039;&#039;&#039;&lt;br /&gt;
::: This sensor measures ground colour and the output can be used to test for a particular condition (e.g. being at a target position). It can also be used to simulate trail pheromones implemented as colors next to the  trail followed. This sense can also take the role of short distance &amp;quot; present at target&amp;quot; stimuli.&lt;br /&gt;
::: &#039;&#039; Development status: Operational &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground reflection level&#039;&#039;&#039;&lt;br /&gt;
::: Two sensors &#039;line followers&#039; that both provide a binary present/absent signal of ground reflection.&lt;br /&gt;
::: Can be used to simulate trail following behaviour on a network of lines  (combined with (led) ground colours.&lt;br /&gt;
::: &#039;&#039;Development status: testing phase&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Future extensions: A combination of voltage levels and pulse frequency coding in the source could be used to simulate a spectrum of &amp;quot;chemical&amp;quot; inputs.  &lt;br /&gt;
:::: Feature detectors could extract particular frequencies and/or patterns to recognise for instance &amp;quot;&#039;&#039;toxic&#039;&#039;&amp;quot; substances. &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Proprioception (internal &amp;quot;feeling&amp;quot;)&#039;&#039;&#039;&lt;br /&gt;
::: Checking for instance for body movement when motors move, or for force feedback when extending electrical honey sucking mouthparts&lt;br /&gt;
::: Development status:To be developed, as yet low priority. &lt;br /&gt;
 &lt;br /&gt;
:: &#039;&#039;&#039;Sensing internal physiological states &#039;&#039;&#039;&lt;br /&gt;
:::To place electric reward information in perspective, some internal status information is needed, that is supplied by reading internal variables like energy levels (battery voltage , load current) or physiological state (internal variables like &amp;quot;ready to feed&amp;quot;. &lt;br /&gt;
::: More advances implementations could look up previous experiences, and rate of change in physiological status as well as brain hormone levels and excitation states (see below under internal states and hormones&amp;quot;).&lt;br /&gt;
:::Development status: To be designed.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing hormone levels&#039;&#039;&#039;&lt;br /&gt;
::: Certain activities or combinations of activities can stimulate the production of hormones. This could be implemented as slow changing values in memory. Hormone levels might modulate the effect of sensory input or behavioural output, and act as a slow form of memory.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing rewards and deterrents&#039;&#039;&#039;&lt;br /&gt;
::: Electronic organisms live on electricity, and are rewarded by sensing the presence of a voltage and current. This sensory organ is just sensing the analog voltage measured by the sensory organ. It simulates the perception of food such as nectar. Most logical position is at the tip of an appendage. &lt;br /&gt;
::: &#039;&#039;Development status: implemented and removed (needs mutiplexing). Mechanical movement (servo) to make electrical contact: testing phase.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Brain ==&lt;br /&gt;
::&#039;&#039;&#039;Subsumption architecture&#039;&#039;&#039;&lt;br /&gt;
:::The Electronic organisms has a software brain that receives sensory input both from the environment and internal status. The brain reads all inputs about every 50 msec, and produces command for actuators that produce behaviour. These behaviours can be as simple as a colour changes of a led (signaling sensory status) or movements of body and body and appendages. The aim is to make the lower levels as stateless as possible i.e. the brain uses its real time vision of the word as a model instead of some abstract internal representation. The processing principle roughly follow the subsumption architecture (Brooks 1986).&lt;br /&gt;
&lt;br /&gt;
:::Wikipedia writes about this technique:&lt;br /&gt;
::::&amp;quot;&#039;&#039;[Behaviours] are organized into a hierarchy of layers. Each layer implements a particular level of behavioral competence, and higher levels are able to subsume lower levels (= integrate/combine lower levels to a more comprehensive whole) in order to create viable behavior. For example, a robot&#039;s lowest layer could be &amp;quot;avoid an object&amp;quot;. The second layer would be &amp;quot;wander around&amp;quot;, which runs beneath the third layer &amp;quot;explore the world&amp;quot;.[...]The subsumption architecture creates a system in which the higher layers utilize the lower-level competencies. The layers, which all receive sensor-information, work in parallel and generate outputs. These outputs can be commands to actuators, or signals that suppress or inhibit other layers.&amp;quot;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::My current implementation uses the opposite order. The high priority levels conduct the simplest behavioural tasks, and when these high priority but simple behavioural levels are happy more complex task can get control. This approach is still experimental, but in any case easy enough to reverse again.&lt;br /&gt;
&lt;br /&gt;
:::The behavioural levels &#039;&#039;all&#039;&#039; compete for control of the robot. Each behavioural layer evaluates its sensory input and determines if it wants to control the outputs (to change its input according to its (implied) goal, e.g. mechanoreceptors (microswitches) will only request control if the switch is closed. After all the behavioural levels are evaluated, and their request flags set or reset an arbitrate routine  selects the highest active layer that will run the robot behaviorual output for the next 50 msec.&lt;br /&gt;
:::See Anderson (2007) for a clear explanations and actual implementation examples.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Brain subsystems&#039;&#039;&#039;&lt;br /&gt;
:::More complicated or slow tasks (like sound processing or US echo detection) can be executed in separate processor boards that report their status  to the main  controller. Conceptually this is not different from subroutines for tasks.&lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Nervous system&#039;&#039;&#039;&lt;br /&gt;
::: The currently (sort of) running implementation of the brain is using a real time loop in a very simple cooperative multitasking system ([https://yiweimao.github.io/blog/async_microcontroller/ YiweiMao scheduler]) and inmplemented on an Arduino Uno &lt;br /&gt;
::: &#039;&#039;Development status: operational, but under active development.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Associative memory&#039;&#039;&#039;&lt;br /&gt;
::: Associative memory in it current, simplest form will be implemented as memory locations for particular sensory input combinations.  inputs that coincide increase a counter for that combination (learning those combinations). This allows both Pawlow  and operand conditioning.&lt;br /&gt;
:::&#039;&#039;Development status: not yet implemented, proof of concept done ~50 years ago :).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Excitation state and hormones&#039;&#039;&#039;&lt;br /&gt;
::: Hormones are internal variables with levels that act as slow changing memory for previous (combinations of) states.&lt;br /&gt;
::: A default breakdown speed can be set that slowly decrease hormone levels. Particular sensory input could increase the levels again. Reaching high levels of certain hormones can be a goal in itself, and subject to learning behaviour.&lt;br /&gt;
::: &#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Satisfaction&#039;&#039;&#039;&lt;br /&gt;
:::Signals to end feeding behaviour can -in addition to electrical food running out- also come from internal signals (satiation, internal hormonal signals, (too) long time periods with little change of events)&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Future prediction&#039;&#039;&#039;&lt;br /&gt;
:::This is currently way out of scope, but neural-net like implementations that store event sequences, predict likely outcomes of current inputs and act accordingly are fully feasible.&lt;br /&gt;
::: See Rickenbacher 1975 for an example that is probably  a bit more traceable than -for instance- modern neural network code like Tensorflow. &lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Effectors ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;main motors&#039;&#039;&#039;&lt;br /&gt;
:::The main moves of the organism are implemented by two wheels driven by two [https://leaphy.store/product/tt-motor-10cm-jumper-female/ DC motors] with build in gearboxes) and a [https://leaphy.store/product/motor-shield/ motor shield]. Motor speed is controlled by pulse width modualation (PMW)) present in the processor. Steering is done by differential motorspeed, a third backside &amp;quot;wheel&amp;quot; is a simple short passive wooden stand. This works well on reasonable flat surfaces, but needs improvement is the next robot (Terzo).&lt;br /&gt;
:::&#039;&#039;Motor development status: Operational at a basic level, PID control and extra power at startup to get smooth startup at low speed is needed.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Movable mouthparts&#039;&#039;&#039;&lt;br /&gt;
:::Appendages like extendable mouthparts controlled by [https://isking-modellbahn.de/modelcraft-es-030-Servo-top-line-steuerelektronik servo]&#039;s can be used for feeding on electrical food. Currently one servo controlling a proboscis (mouthpart for feeding) is present.&lt;br /&gt;
:::&#039;&#039;Development status: Operational in priciple, untested in practice, needs 3D printing of parts&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;[https://leaphy.store/product/rgb-led-single/ Three colour led]&#039;&#039;&#039;&lt;br /&gt;
::: can be used for signaling status of whatever state we want.&lt;br /&gt;
:::&#039;&#039;Development status: Operational &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Piezo beeper &#039;&#039;&#039;&lt;br /&gt;
::: Present on the [https://leaphy.store/product/motor-shield/ motor shield] can be used to create a variety of sounds,for instance to signal happines, distress or alarm.&lt;br /&gt;
:::&#039;&#039;Development status: Operational, but specific sounds need to be designed&lt;br /&gt;
&lt;br /&gt;
== Behavioural levels ==&lt;br /&gt;
&lt;br /&gt;
:: Behaviour in subsumption architecture is organised in levels that compete for control, the highest priority behaviour (lowest rank, top of list) will control the robot for 50 msec. When lower levels are silent higher levels get control.&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Overview of current behavioral levels and  their most important inputs for controlling requests&#039;&#039;&#039;. &lt;br /&gt;
::See the actual calls for details.&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;Layer &amp;quot;distress&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::If unable to meet the absolute basic requirement for battery voltage or movement CALL for help. In STUCK, try reflexes to get loose, pause regular. If nothing works eventually HIBERNATE &lt;br /&gt;
&lt;br /&gt;
::::Goal:  deal with the really difficult situations &lt;br /&gt;
::::0  HIBERNATE // hope for better times...&lt;br /&gt;
::::1  STUCK // try to solve non-movement when motors run...&lt;br /&gt;
::::2  CALL  // call for help&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;stay free&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::The primary sensory input activating this level are Bumper sensors and Ultrasonics, but also hormones for high emotional levels reached by an overload of sensory input or a high number of failing tries to reach some goal. Freeze will stop movement for an serious amount of time to reduce overload Fight will move quickly forward and get very close to an object possibly even disregarding US and bumpers and hitting the object. Escape will try to free the bumpers Evade will try keep a safe distance from objects Flight will try to run straight for a relative long time (using a countdown timer) but will subsumed by lower levels.&lt;br /&gt;
&lt;br /&gt;
::::Goal: avoid stressors. &lt;br /&gt;
::::3  FREEZE  // simulated dead&lt;br /&gt;
::::4  FIGHT   // Try to intimidate &lt;br /&gt;
::::5  ESCAPE  // Escape from touch&lt;br /&gt;
::::6  EVADE   // keep distance&lt;br /&gt;
::::7  FLIGHT  // run away  &lt;br /&gt;
&lt;br /&gt;
:::layer &#039;&#039;&#039;&amp;quot;external control&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
::::8 MANUAL&lt;br /&gt;
::::Goals: No distress. Stay free, but otherwise otherwise obey external commands&lt;br /&gt;
::::This level is only requesting control if external commands are present in sensordata. The behaviour is self-reinforcing so once activated it keeps controlling the creature as long as new commands arrive within reasonable time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:: Stay tuned, more comming soon&lt;br /&gt;
&lt;br /&gt;
== Implementation details ==&lt;br /&gt;
: Stay tuned, more comming soon&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Anderson, D.P. (2007)&#039;&#039;&#039; https://www.dprg.org/articles/2007-03a/&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Bettosini et al., 2022&#039;&#039;&#039; Torocó: A Subsumption Architecture Implementation, in: 2022 8th International Conference on Automation, Robotics and Applications (ICARA) IEEE, Prague, Czech Republic, pp. 27–32. . https://doi.org/10.1109/ICARA55094.2022.9738521&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Brooks, R.A. (1986)&#039;&#039;&#039; A Robust Layer Control System for a Mobile Robot, IEEE Journal of Robotics and Automation RA-2, 14-23&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Rickenbacher (1975)&#039;&#039;&#039; Lernen und Motivation als relevanzgesteuerte Datenverarbeitung: Ein Computer-Simulationsmodell elementarer kognitiv-affektiver Prozesse. Birkhäuser Verag Basel.&lt;/div&gt;</summary>
		<author><name>Peterr</name></author>
	</entry>
	<entry>
		<id>https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15293</id>
		<title>Leaphy Robot</title>
		<link rel="alternate" type="text/html" href="https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15293"/>
		<updated>2025-10-01T20:54:12Z</updated>

		<summary type="html">&lt;p&gt;Peterr: /* Behavioural levels */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Name=Leaphy robot with subsumption architecture&lt;br /&gt;
|Skills=software hardware electronics biology&lt;br /&gt;
|Status=Active&lt;br /&gt;
|Niche=robotics&lt;br /&gt;
|Purpose=Fun&lt;br /&gt;
|Picture=Leaphy back side view.jpg&lt;br /&gt;
|Tool=No&lt;br /&gt;
|Location=Space, home&lt;br /&gt;
|Cost=Very small given what is already present and what is available in the space (everything!!)&lt;br /&gt;
|Category=Electronics&lt;br /&gt;
}}&lt;br /&gt;
== Electronic insect-like creature ==&lt;br /&gt;
&#039;&#039;&#039;Physiological, Behavioural and environmental overview&#039;&#039;&#039; &amp;lt;br&amp;gt;&lt;br /&gt;
peterr 2022- 2025 (with &#039;&#039;very&#039;&#039; long pauses)&lt;br /&gt;
&lt;br /&gt;
====Document history====&lt;br /&gt;
* Currently this is a living document and this wiki contains the latest version&lt;br /&gt;
* September 2025 subsumption architecture design &amp;amp; transfer to nurdspace wiki&lt;br /&gt;
* August    2025 Documentation for scheduler&lt;br /&gt;
* March     2023 Draft version 0.2  - terminology cleanup and scope&lt;br /&gt;
* November  2022 First document sketches &amp;amp; ideas&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project==&lt;br /&gt;
The insect like creature based on the original [https://leaphy.store/product/leaphy-original-los/ leaphyrobot] has a set of functionalities that together allow it to effectively find, and feed on targets that provides electricity as a reward.&lt;br /&gt;
Learning strategies to improve success rate can be implemented.&lt;br /&gt;
Sexual signaling, event prediction, mating behaviour, genetic exchange and evolution are in principle possible but are currently still (far) out of scope. The system at it&#039;s highest level can be seen as a feedback loop: sensory input =&amp;gt; behavioural selection =&amp;gt; motor output =&amp;gt; new sensory input. The original design (2022) was meant to live in wind tunnel, and find odour sources to feed, but currently the emphasis has shifted from odour detection to more general sensory processing using subsumption architecture, [https://nurdspace.nl/Leaphy_Robot#Brain see below].&lt;br /&gt;
&lt;br /&gt;
== Sensory inputs ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Mechanoreceptor - sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
:::Micro switch based tactile hairs. &lt;br /&gt;
:::&#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Ultrasound - Distance sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
::: Ultrasonic pulses detect obstacles and trigger reflex avoidance behaviour&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Better directional responses would be possible with more than one US sensor. &lt;br /&gt;
:::: This would need a dedicated embedded processor. &lt;br /&gt;
:::: &#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing light intensity&#039;&#039;&#039;&lt;br /&gt;
::: Two LDR photoreceptors measure front-left light level and front-right light level&lt;br /&gt;
::: Total light intensity (sum) is available as an analog voltage&lt;br /&gt;
::: The difference between the inputs is also available, and signals what side to turn to, to approach or avoid the light.&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing sound (audio)&#039;&#039;&#039;&lt;br /&gt;
::: A subunit with its own processor, containing an Electret microphone to measure ambiant sound level, frequency and sound patterns. &lt;br /&gt;
::: Can be used in classical (Pawlow) and operand conditioning experiments. Will detect both absolute sound levels (for startle or avoidance responses) and can contain feature detectors (e.g. chirp intervals for leaf hopper like  communication and courting  behaviour of two leaphy&#039;s).  &lt;br /&gt;
::: In addition, an Audeme Movi speech recognition shield (see https://www.audeme.com/movi.html) could be used to process voice commands&lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented, but Movi shield &amp;quot;proof of concept&amp;quot; done&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;PIR movement sensor&#039;&#039;&#039;&lt;br /&gt;
::: In addition to light intensity, an infra red motion sensors can be used to detect movements (humans, or the cat for that matter) see for instance https://www.adafruit.com/product/4871 &lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented but PIR (similar to the adafruit thingy) available&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Sensing wind direction &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based tactile hairs?  Something like https://www.instructables.com/Low-Cost-Low-Speed-Wind-Sensor-1/ with shielding? or sensitive temperature measurements?&lt;br /&gt;
:::; Note: Wind direction sensing in the wind tunnel is currently replaced by sensing light gradients parallel to the wind direction because the wind sensor is not available yet. &lt;br /&gt;
:::: &#039;&#039;Development status: To be designed, high priority for the windtunnel version with odour processing as a main goal, low priority for the a free walking space/nurdspace version described here.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Volatiles (odours) &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based perception of volatiles like alcohol (fruit-fly like behaviours), Carbon dioxide (mosquito like behaviour), or VOC&#039;s (most plant eating insects). The sensor produces a voltage level proportional to the intensity of the stimulus. Using a threshold can generate a presence/absence signal. &lt;br /&gt;
::: The interval between odour pulses is a proxy for the distance to the source. Note that an odour &amp;quot;gradient&amp;quot; does not exist!&lt;br /&gt;
&lt;br /&gt;
::: Current implementation uses a SGP30 board. The time constant of the the sensor is in the order of 1 second, but &amp;quot;whiffs&amp;quot; of odour could be detected faster by using a feature detector that looks for sudden steps in the signal. This will also act as an sensory adaptation mechanism: in the absence of change the output go&#039;s to zero.&lt;br /&gt;
::: &#039;&#039;Development status: Sensor: worked, currently broken&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground color&#039;&#039;&#039;&lt;br /&gt;
::: This sensor measures ground colour and the output can be used to test for a particular condition (e.g. being at a target position). It can also be used to simulate trail pheromones implemented as colors next to the  trail followed. This sense can also take the role of short distance &amp;quot; present at target&amp;quot; stimuli.&lt;br /&gt;
::: &#039;&#039; Development status: Operational &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground reflection level&#039;&#039;&#039;&lt;br /&gt;
::: Two sensors &#039;line followers&#039; that both provide a binary present/absent signal of ground reflection.&lt;br /&gt;
::: Can be used to simulate trail following behaviour on a network of lines  (combined with (led) ground colours.&lt;br /&gt;
::: &#039;&#039;Development status: testing phase&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Future extensions: A combination of voltage levels and pulse frequency coding in the source could be used to simulate a spectrum of &amp;quot;chemical&amp;quot; inputs.  &lt;br /&gt;
:::: Feature detectors could extract particular frequencies and/or patterns to recognise for instance &amp;quot;&#039;&#039;toxic&#039;&#039;&amp;quot; substances. &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Proprioception (internal &amp;quot;feeling&amp;quot;)&#039;&#039;&#039;&lt;br /&gt;
::: Checking for instance for body movement when motors move, or for force feedback when extending electrical honey sucking mouthparts&lt;br /&gt;
::: Development status:To be developed, as yet low priority. &lt;br /&gt;
 &lt;br /&gt;
:: &#039;&#039;&#039;Sensing internal physiological states &#039;&#039;&#039;&lt;br /&gt;
:::To place electric reward information in perspective, some internal status information is needed, that is supplied by reading internal variables like energy levels (battery voltage , load current) or physiological state (internal variables like &amp;quot;ready to feed&amp;quot;. &lt;br /&gt;
::: More advances implementations could look up previous experiences, and rate of change in physiological status as well as brain hormone levels and excitation states (see below under internal states and hormones&amp;quot;).&lt;br /&gt;
:::Development status: To be designed.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing hormone levels&#039;&#039;&#039;&lt;br /&gt;
::: Certain activities or combinations of activities can stimulate the production of hormones. This could be implemented as slow changing values in memory. Hormone levels might modulate the effect of sensory input or behavioural output, and act as a slow form of memory.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing rewards and deterrents&#039;&#039;&#039;&lt;br /&gt;
::: Electronic organisms live on electricity, and are rewarded by sensing the presence of a voltage and current. This sensory organ is just sensing the analog voltage measured by the sensory organ. It simulates the perception of food such as nectar. Most logical position is at the tip of an appendage. &lt;br /&gt;
::: &#039;&#039;Development status: implemented and removed (needs mutiplexing). Mechanical movement (servo) to make electrical contact: testing phase.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Brain ==&lt;br /&gt;
::&#039;&#039;&#039;Subsumption architecture&#039;&#039;&#039;&lt;br /&gt;
:::The Electronic organisms has a software brain that receives sensory input both from the environment and internal status. The brain reads all inputs about every 50 msec, and produces command for actuators that produce behaviour. These behaviours can be as simple as a colour changes of a led (signaling sensory status) or movements of body and body and appendages. The aim is to make the lower levels as stateless as possible i.e. the brain uses its real time vision of the word as a model instead of some abstract internal representation. The processing principle roughly follow the subsumption architecture (Brooks 1986).&lt;br /&gt;
&lt;br /&gt;
:::Wikipedia writes about this technique:&lt;br /&gt;
::::&amp;quot;&#039;&#039;[Behaviours] are organized into a hierarchy of layers. Each layer implements a particular level of behavioral competence, and higher levels are able to subsume lower levels (= integrate/combine lower levels to a more comprehensive whole) in order to create viable behavior. For example, a robot&#039;s lowest layer could be &amp;quot;avoid an object&amp;quot;. The second layer would be &amp;quot;wander around&amp;quot;, which runs beneath the third layer &amp;quot;explore the world&amp;quot;.[...]The subsumption architecture creates a system in which the higher layers utilize the lower-level competencies. The layers, which all receive sensor-information, work in parallel and generate outputs. These outputs can be commands to actuators, or signals that suppress or inhibit other layers.&amp;quot;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::My current implementation uses the opposite order. The high priority levels conduct the simplest behavioural tasks, and when these high priority but simple behavioural levels are happy more complex task can get control. This approach is still experimental, but in any case easy enough to reverse again.&lt;br /&gt;
&lt;br /&gt;
:::The behavioural levels &#039;&#039;all&#039;&#039; compete for control of the robot. Each behavioural layer evaluates its sensory input and determines if it wants to control the outputs (to change its input according to its (implied) goal, e.g. mechanoreceptors (microswitches) will only request control if the switch is closed. After all the behavioural levels are evaluated, and their request flags set or reset an arbitrate routine  selects the highest active layer that will run the robot behaviorual output for the next 50 msec.&lt;br /&gt;
:::See Anderson (2007) for a clear explanations and actual implementation examples.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Brain subsystems&#039;&#039;&#039;&lt;br /&gt;
:::More complicated or slow tasks (like sound processing or US echo detection) can be executed in separate processor boards that report their status  to the main  controller. Conceptually this is not different from subroutines for tasks.&lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Nervous system&#039;&#039;&#039;&lt;br /&gt;
::: The currently (sort of) running implementation of the brain is using a real time loop in a very simple cooperative multitasking system ([https://yiweimao.github.io/blog/async_microcontroller/ YiweiMao scheduler]) and inmplemented on an Arduino Uno &lt;br /&gt;
::: &#039;&#039;Development status: operational, but under active development.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Associative memory&#039;&#039;&#039;&lt;br /&gt;
::: Associative memory in it current, simplest form will be implemented as memory locations for particular sensory input combinations.  inputs that coincide increase a counter for that combination (learning those combinations). This allows both Pawlow  and operand conditioning.&lt;br /&gt;
:::&#039;&#039;Development status: not yet implemented, proof of concept done ~50 years ago :).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Excitation state and hormones&#039;&#039;&#039;&lt;br /&gt;
::: Hormones are internal variables with levels that act as slow changing memory for previous (combinations of) states.&lt;br /&gt;
::: A default breakdown speed can be set that slowly decrease hormone levels. Particular sensory input could increase the levels again. Reaching high levels of certain hormones can be a goal in itself, and subject to learning behaviour.&lt;br /&gt;
::: &#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Satisfaction&#039;&#039;&#039;&lt;br /&gt;
:::Signals to end feeding behaviour can -in addition to electrical food running out- also come from internal signals (satiation, internal hormonal signals, (too) long time periods with little change of events)&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Future prediction&#039;&#039;&#039;&lt;br /&gt;
:::This is currently way out of scope, but neural-net like implementations that store event sequences, predict likely outcomes of current inputs and act accordingly are fully feasible.&lt;br /&gt;
::: See Rickenbacher 1975 for an example that is probably  a bit more traceable than -for instance- modern neural network code like Tensorflow. &lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Effectors ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;main motors&#039;&#039;&#039;&lt;br /&gt;
:::The main moves of the organism are implemented by two wheels driven by two [https://leaphy.store/product/tt-motor-10cm-jumper-female/ DC motors] with build in gearboxes) and a [https://leaphy.store/product/motor-shield/ motor shield]. Motor speed is controlled by pulse width modualation (PMW)) present in the processor. Steering is done by differential motorspeed, a third backside &amp;quot;wheel&amp;quot; is a simple short passive wooden stand. This works well on reasonable flat surfaces, but needs improvement is the next robot (Terzo).&lt;br /&gt;
:::&#039;&#039;Motor development status: Operational at a basic level, PID control and extra power at startup to get smooth startup at low speed is needed.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Movable mouthparts&#039;&#039;&#039;&lt;br /&gt;
:::Appendages like extendable mouthparts controlled by [https://isking-modellbahn.de/modelcraft-es-030-Servo-top-line-steuerelektronik servo]&#039;s can be used for feeding on electrical food. Currently one servo controlling a proboscis (mouthpart for feeding) is present.&lt;br /&gt;
:::&#039;&#039;Development status: Operational in priciple, untested in practice, needs 3D printing of parts&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;[https://leaphy.store/product/rgb-led-single/ Three colour led]&#039;&#039;&#039;&lt;br /&gt;
::: can be used for signaling status of whatever state we want.&lt;br /&gt;
:::&#039;&#039;Development status: Operational &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Piezo beeper &#039;&#039;&#039;&lt;br /&gt;
::: Present on the [https://leaphy.store/product/motor-shield/ motor shield] can be used to create a variety of sounds,for instance to signal happines, distress or alarm.&lt;br /&gt;
:::&#039;&#039;Development status: Operational, but specific sounds need to be designed&lt;br /&gt;
&lt;br /&gt;
== Behavioural levels ==&lt;br /&gt;
&lt;br /&gt;
:: Behaviour in subsumption architecture is organised in levels that compete for control, the highest priority behaviour (lowest rank, top of list) will control the robot for 50 msec. When lower levels are silent higher levels get control.&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Overview of current behavioral levels and  their most important inputs for controlling requests&#039;&#039;&#039;. &lt;br /&gt;
::See the actual calls for details.&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;Layer &amp;quot;distress&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::If unable to meet the absolute basic requirement for battery voltage or movement CALL for help. In STUCK, try reflexes to get loose, pause regular. If nothing works eventually HIBERNATE &lt;br /&gt;
&lt;br /&gt;
::::Goal:  deal with the really difficult situations &lt;br /&gt;
::::0  HIBERNATE // hope for better times...&lt;br /&gt;
::::1  STUCK // try to solve non-movement when motors run...&lt;br /&gt;
::::2  CALL  // call for help&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;stay free&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::The primary sensory input activating this level are Bumper sensors and Ultrasonics, but also hormones for high emotional levels reached by an overload of sensory input or a high number of failing tries to reach some goal. Freeze will stop movement for an serious amount of time to reduce overload Fight will move quickly forward and get very close to an object possibly even disregarding US and bumpers and hitting the object. Escape will try to free the bumpers Evade will try keep a safe distance from objects Flight will try to run straight for a relative long time (using a countdown timer) but will subsumed by lower levels.&lt;br /&gt;
&lt;br /&gt;
::::Goal: avoid stressors. &lt;br /&gt;
::::3  FREEZE  // simulated dead&lt;br /&gt;
::::4  FIGHT   // Try to intimidate &lt;br /&gt;
::::5  ESCAPE  // Escape from touch&lt;br /&gt;
::::6  EVADE   // keep distance&lt;br /&gt;
::::7  FLIGHT  // run away  &lt;br /&gt;
&lt;br /&gt;
:::layer &#039;&#039;&#039;&amp;quot;external control&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
::::8 MANUAL&lt;br /&gt;
::::Goals: No distress. Stay free, but otherwise otherwise obey external commands&lt;br /&gt;
This level is only requesting control if external commands are present in sensordata. The behaviour is self-reinforcing so once activated it keeps controlling the creature as long as new commands arrive within resonable time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:: Stay tuned, more comming soon&lt;br /&gt;
&lt;br /&gt;
== Implementation details ==&lt;br /&gt;
: Stay tuned, more comming soon&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Anderson, D.P. (2007)&#039;&#039;&#039; https://www.dprg.org/articles/2007-03a/&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Bettosini et al., 2022&#039;&#039;&#039; Torocó: A Subsumption Architecture Implementation, in: 2022 8th International Conference on Automation, Robotics and Applications (ICARA) IEEE, Prague, Czech Republic, pp. 27–32. . https://doi.org/10.1109/ICARA55094.2022.9738521&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Brooks, R.A. (1986)&#039;&#039;&#039; A Robust Layer Control System for a Mobile Robot, IEEE Journal of Robotics and Automation RA-2, 14-23&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Rickenbacher (1975)&#039;&#039;&#039; Lernen und Motivation als relevanzgesteuerte Datenverarbeitung: Ein Computer-Simulationsmodell elementarer kognitiv-affektiver Prozesse. Birkhäuser Verag Basel.&lt;/div&gt;</summary>
		<author><name>Peterr</name></author>
	</entry>
	<entry>
		<id>https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15292</id>
		<title>Leaphy Robot</title>
		<link rel="alternate" type="text/html" href="https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15292"/>
		<updated>2025-10-01T20:51:55Z</updated>

		<summary type="html">&lt;p&gt;Peterr: /* Behavioural levels */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Name=Leaphy robot with subsumption architecture&lt;br /&gt;
|Skills=software hardware electronics biology&lt;br /&gt;
|Status=Active&lt;br /&gt;
|Niche=robotics&lt;br /&gt;
|Purpose=Fun&lt;br /&gt;
|Picture=Leaphy back side view.jpg&lt;br /&gt;
|Tool=No&lt;br /&gt;
|Location=Space, home&lt;br /&gt;
|Cost=Very small given what is already present and what is available in the space (everything!!)&lt;br /&gt;
|Category=Electronics&lt;br /&gt;
}}&lt;br /&gt;
== Electronic insect-like creature ==&lt;br /&gt;
&#039;&#039;&#039;Physiological, Behavioural and environmental overview&#039;&#039;&#039; &amp;lt;br&amp;gt;&lt;br /&gt;
peterr 2022- 2025 (with &#039;&#039;very&#039;&#039; long pauses)&lt;br /&gt;
&lt;br /&gt;
====Document history====&lt;br /&gt;
* Currently this is a living document and this wiki contains the latest version&lt;br /&gt;
* September 2025 subsumption architecture design &amp;amp; transfer to nurdspace wiki&lt;br /&gt;
* August    2025 Documentation for scheduler&lt;br /&gt;
* March     2023 Draft version 0.2  - terminology cleanup and scope&lt;br /&gt;
* November  2022 First document sketches &amp;amp; ideas&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project==&lt;br /&gt;
The insect like creature based on the original [https://leaphy.store/product/leaphy-original-los/ leaphyrobot] has a set of functionalities that together allow it to effectively find, and feed on targets that provides electricity as a reward.&lt;br /&gt;
Learning strategies to improve success rate can be implemented.&lt;br /&gt;
Sexual signaling, event prediction, mating behaviour, genetic exchange and evolution are in principle possible but are currently still (far) out of scope. The system at it&#039;s highest level can be seen as a feedback loop: sensory input =&amp;gt; behavioural selection =&amp;gt; motor output =&amp;gt; new sensory input. The original design (2022) was meant to live in wind tunnel, and find odour sources to feed, but currently the emphasis has shifted from odour detection to more general sensory processing using subsumption architecture, [https://nurdspace.nl/Leaphy_Robot#Brain see below].&lt;br /&gt;
&lt;br /&gt;
== Sensory inputs ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Mechanoreceptor - sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
:::Micro switch based tactile hairs. &lt;br /&gt;
:::&#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Ultrasound - Distance sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
::: Ultrasonic pulses detect obstacles and trigger reflex avoidance behaviour&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Better directional responses would be possible with more than one US sensor. &lt;br /&gt;
:::: This would need a dedicated embedded processor. &lt;br /&gt;
:::: &#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing light intensity&#039;&#039;&#039;&lt;br /&gt;
::: Two LDR photoreceptors measure front-left light level and front-right light level&lt;br /&gt;
::: Total light intensity (sum) is available as an analog voltage&lt;br /&gt;
::: The difference between the inputs is also available, and signals what side to turn to, to approach or avoid the light.&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing sound (audio)&#039;&#039;&#039;&lt;br /&gt;
::: A subunit with its own processor, containing an Electret microphone to measure ambiant sound level, frequency and sound patterns. &lt;br /&gt;
::: Can be used in classical (Pawlow) and operand conditioning experiments. Will detect both absolute sound levels (for startle or avoidance responses) and can contain feature detectors (e.g. chirp intervals for leaf hopper like  communication and courting  behaviour of two leaphy&#039;s).  &lt;br /&gt;
::: In addition, an Audeme Movi speech recognition shield (see https://www.audeme.com/movi.html) could be used to process voice commands&lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented, but Movi shield &amp;quot;proof of concept&amp;quot; done&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;PIR movement sensor&#039;&#039;&#039;&lt;br /&gt;
::: In addition to light intensity, an infra red motion sensors can be used to detect movements (humans, or the cat for that matter) see for instance https://www.adafruit.com/product/4871 &lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented but PIR (similar to the adafruit thingy) available&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Sensing wind direction &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based tactile hairs?  Something like https://www.instructables.com/Low-Cost-Low-Speed-Wind-Sensor-1/ with shielding? or sensitive temperature measurements?&lt;br /&gt;
:::; Note: Wind direction sensing in the wind tunnel is currently replaced by sensing light gradients parallel to the wind direction because the wind sensor is not available yet. &lt;br /&gt;
:::: &#039;&#039;Development status: To be designed, high priority for the windtunnel version with odour processing as a main goal, low priority for the a free walking space/nurdspace version described here.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Volatiles (odours) &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based perception of volatiles like alcohol (fruit-fly like behaviours), Carbon dioxide (mosquito like behaviour), or VOC&#039;s (most plant eating insects). The sensor produces a voltage level proportional to the intensity of the stimulus. Using a threshold can generate a presence/absence signal. &lt;br /&gt;
::: The interval between odour pulses is a proxy for the distance to the source. Note that an odour &amp;quot;gradient&amp;quot; does not exist!&lt;br /&gt;
&lt;br /&gt;
::: Current implementation uses a SGP30 board. The time constant of the the sensor is in the order of 1 second, but &amp;quot;whiffs&amp;quot; of odour could be detected faster by using a feature detector that looks for sudden steps in the signal. This will also act as an sensory adaptation mechanism: in the absence of change the output go&#039;s to zero.&lt;br /&gt;
::: &#039;&#039;Development status: Sensor: worked, currently broken&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground color&#039;&#039;&#039;&lt;br /&gt;
::: This sensor measures ground colour and the output can be used to test for a particular condition (e.g. being at a target position). It can also be used to simulate trail pheromones implemented as colors next to the  trail followed. This sense can also take the role of short distance &amp;quot; present at target&amp;quot; stimuli.&lt;br /&gt;
::: &#039;&#039; Development status: Operational &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground reflection level&#039;&#039;&#039;&lt;br /&gt;
::: Two sensors &#039;line followers&#039; that both provide a binary present/absent signal of ground reflection.&lt;br /&gt;
::: Can be used to simulate trail following behaviour on a network of lines  (combined with (led) ground colours.&lt;br /&gt;
::: &#039;&#039;Development status: testing phase&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Future extensions: A combination of voltage levels and pulse frequency coding in the source could be used to simulate a spectrum of &amp;quot;chemical&amp;quot; inputs.  &lt;br /&gt;
:::: Feature detectors could extract particular frequencies and/or patterns to recognise for instance &amp;quot;&#039;&#039;toxic&#039;&#039;&amp;quot; substances. &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Proprioception (internal &amp;quot;feeling&amp;quot;)&#039;&#039;&#039;&lt;br /&gt;
::: Checking for instance for body movement when motors move, or for force feedback when extending electrical honey sucking mouthparts&lt;br /&gt;
::: Development status:To be developed, as yet low priority. &lt;br /&gt;
 &lt;br /&gt;
:: &#039;&#039;&#039;Sensing internal physiological states &#039;&#039;&#039;&lt;br /&gt;
:::To place electric reward information in perspective, some internal status information is needed, that is supplied by reading internal variables like energy levels (battery voltage , load current) or physiological state (internal variables like &amp;quot;ready to feed&amp;quot;. &lt;br /&gt;
::: More advances implementations could look up previous experiences, and rate of change in physiological status as well as brain hormone levels and excitation states (see below under internal states and hormones&amp;quot;).&lt;br /&gt;
:::Development status: To be designed.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing hormone levels&#039;&#039;&#039;&lt;br /&gt;
::: Certain activities or combinations of activities can stimulate the production of hormones. This could be implemented as slow changing values in memory. Hormone levels might modulate the effect of sensory input or behavioural output, and act as a slow form of memory.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing rewards and deterrents&#039;&#039;&#039;&lt;br /&gt;
::: Electronic organisms live on electricity, and are rewarded by sensing the presence of a voltage and current. This sensory organ is just sensing the analog voltage measured by the sensory organ. It simulates the perception of food such as nectar. Most logical position is at the tip of an appendage. &lt;br /&gt;
::: &#039;&#039;Development status: implemented and removed (needs mutiplexing). Mechanical movement (servo) to make electrical contact: testing phase.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Brain ==&lt;br /&gt;
::&#039;&#039;&#039;Subsumption architecture&#039;&#039;&#039;&lt;br /&gt;
:::The Electronic organisms has a software brain that receives sensory input both from the environment and internal status. The brain reads all inputs about every 50 msec, and produces command for actuators that produce behaviour. These behaviours can be as simple as a colour changes of a led (signaling sensory status) or movements of body and body and appendages. The aim is to make the lower levels as stateless as possible i.e. the brain uses its real time vision of the word as a model instead of some abstract internal representation. The processing principle roughly follow the subsumption architecture (Brooks 1986).&lt;br /&gt;
&lt;br /&gt;
:::Wikipedia writes about this technique:&lt;br /&gt;
::::&amp;quot;&#039;&#039;[Behaviours] are organized into a hierarchy of layers. Each layer implements a particular level of behavioral competence, and higher levels are able to subsume lower levels (= integrate/combine lower levels to a more comprehensive whole) in order to create viable behavior. For example, a robot&#039;s lowest layer could be &amp;quot;avoid an object&amp;quot;. The second layer would be &amp;quot;wander around&amp;quot;, which runs beneath the third layer &amp;quot;explore the world&amp;quot;.[...]The subsumption architecture creates a system in which the higher layers utilize the lower-level competencies. The layers, which all receive sensor-information, work in parallel and generate outputs. These outputs can be commands to actuators, or signals that suppress or inhibit other layers.&amp;quot;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::My current implementation uses the opposite order. The high priority levels conduct the simplest behavioural tasks, and when these high priority but simple behavioural levels are happy more complex task can get control. This approach is still experimental, but in any case easy enough to reverse again.&lt;br /&gt;
&lt;br /&gt;
:::The behavioural levels &#039;&#039;all&#039;&#039; compete for control of the robot. Each behavioural layer evaluates its sensory input and determines if it wants to control the outputs (to change its input according to its (implied) goal, e.g. mechanoreceptors (microswitches) will only request control if the switch is closed. After all the behavioural levels are evaluated, and their request flags set or reset an arbitrate routine  selects the highest active layer that will run the robot behaviorual output for the next 50 msec.&lt;br /&gt;
:::See Anderson (2007) for a clear explanations and actual implementation examples.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Brain subsystems&#039;&#039;&#039;&lt;br /&gt;
:::More complicated or slow tasks (like sound processing or US echo detection) can be executed in separate processor boards that report their status  to the main  controller. Conceptually this is not different from subroutines for tasks.&lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Nervous system&#039;&#039;&#039;&lt;br /&gt;
::: The currently (sort of) running implementation of the brain is using a real time loop in a very simple cooperative multitasking system ([https://yiweimao.github.io/blog/async_microcontroller/ YiweiMao scheduler]) and inmplemented on an Arduino Uno &lt;br /&gt;
::: &#039;&#039;Development status: operational, but under active development.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Associative memory&#039;&#039;&#039;&lt;br /&gt;
::: Associative memory in it current, simplest form will be implemented as memory locations for particular sensory input combinations.  inputs that coincide increase a counter for that combination (learning those combinations). This allows both Pawlow  and operand conditioning.&lt;br /&gt;
:::&#039;&#039;Development status: not yet implemented, proof of concept done ~50 years ago :).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Excitation state and hormones&#039;&#039;&#039;&lt;br /&gt;
::: Hormones are internal variables with levels that act as slow changing memory for previous (combinations of) states.&lt;br /&gt;
::: A default breakdown speed can be set that slowly decrease hormone levels. Particular sensory input could increase the levels again. Reaching high levels of certain hormones can be a goal in itself, and subject to learning behaviour.&lt;br /&gt;
::: &#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Satisfaction&#039;&#039;&#039;&lt;br /&gt;
:::Signals to end feeding behaviour can -in addition to electrical food running out- also come from internal signals (satiation, internal hormonal signals, (too) long time periods with little change of events)&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Future prediction&#039;&#039;&#039;&lt;br /&gt;
:::This is currently way out of scope, but neural-net like implementations that store event sequences, predict likely outcomes of current inputs and act accordingly are fully feasible.&lt;br /&gt;
::: See Rickenbacher 1975 for an example that is probably  a bit more traceable than -for instance- modern neural network code like Tensorflow. &lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Effectors ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;main motors&#039;&#039;&#039;&lt;br /&gt;
:::The main moves of the organism are implemented by two wheels driven by two [https://leaphy.store/product/tt-motor-10cm-jumper-female/ DC motors] with build in gearboxes) and a [https://leaphy.store/product/motor-shield/ motor shield]. Motor speed is controlled by pulse width modualation (PMW)) present in the processor. Steering is done by differential motorspeed, a third backside &amp;quot;wheel&amp;quot; is a simple short passive wooden stand. This works well on reasonable flat surfaces, but needs improvement is the next robot (Terzo).&lt;br /&gt;
:::&#039;&#039;Motor development status: Operational at a basic level, PID control and extra power at startup to get smooth startup at low speed is needed.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Movable mouthparts&#039;&#039;&#039;&lt;br /&gt;
:::Appendages like extendable mouthparts controlled by [https://isking-modellbahn.de/modelcraft-es-030-Servo-top-line-steuerelektronik servo]&#039;s can be used for feeding on electrical food. Currently one servo controlling a proboscis (mouthpart for feeding) is present.&lt;br /&gt;
:::&#039;&#039;Development status: Operational in priciple, untested in practice, needs 3D printing of parts&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;[https://leaphy.store/product/rgb-led-single/ Three colour led]&#039;&#039;&#039;&lt;br /&gt;
::: can be used for signaling status of whatever state we want.&lt;br /&gt;
:::&#039;&#039;Development status: Operational &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Piezo beeper &#039;&#039;&#039;&lt;br /&gt;
::: Present on the [https://leaphy.store/product/motor-shield/ motor shield] can be used to create a variety of sounds,for instance to signal happines, distress or alarm.&lt;br /&gt;
:::&#039;&#039;Development status: Operational, but specific sounds need to be designed&lt;br /&gt;
&lt;br /&gt;
== Behavioural levels ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;Behaviour in subsumption architecture is organised in levels that compete for control, the highest priority behaviour (lowest rank, top of list) will control the robot for 50 msec &#039;&#039; When lower levels are silent higher levels get control.&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Overview of current behavioral levels and  their most important inputs for controlling requests&#039;&#039;&#039;. &lt;br /&gt;
::See the actual calls for details.&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;Layer &amp;quot;distress&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::If unable to meet the absolute basic requirement for battery voltage or movement CALL for help. In STUCK, try reflexes to get loose, pause regular. If nothing works eventually HIBERNATE &lt;br /&gt;
&lt;br /&gt;
::::Goal:  deal with the really difficult situations &lt;br /&gt;
::::0  HIBERNATE // hope for better times...&lt;br /&gt;
::::1  STUCK // try to solve non-movement when motors run...&lt;br /&gt;
::::2  CALL  // call for help&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;stay free&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::The primary sensory input activating this level are Bumper sensors and Ultrasonics, but also hormones for high emotional levels reached by an overload of sensory input or a high number of failing tries to reach some goal. Freeze will stop movement for an serious amount of time to reduce overload Fight will move quickly forward and get very close to an object possibly even disregarding US and bumpers and hitting the object. Escape will try to free the bumpers Evade will try keep a safe distance from objects Flight will try to run straight for a relative long time (using a countdown timer) but will subsumed by lower levels.&lt;br /&gt;
&lt;br /&gt;
::::Goal: avoid stressors. &lt;br /&gt;
::::3  FREEZE  // simulated dead&lt;br /&gt;
::::4  FIGHT   // Try to intimidate &lt;br /&gt;
::::5  ESCAPE  // Escape from touch&lt;br /&gt;
::::6  EVADE   // keep distance&lt;br /&gt;
::::7  FLIGHT  // run away  &lt;br /&gt;
&lt;br /&gt;
:::layer &#039;&#039;&#039;&amp;quot;external control&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
::::8 MANUAL&lt;br /&gt;
::::Goals: No distress. Stay free, but otherwise otherwise obey external commands&lt;br /&gt;
This level is only requesting control if external commands are present in sensordata. The behaviour is self-reinforcing so once activated it keeps controlling the creature as long as new commands arrive within resonable time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:: Stay tuned, more comming soon&lt;br /&gt;
&lt;br /&gt;
== Implementation details ==&lt;br /&gt;
: Stay tuned, more comming soon&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Anderson, D.P. (2007)&#039;&#039;&#039; https://www.dprg.org/articles/2007-03a/&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Bettosini et al., 2022&#039;&#039;&#039; Torocó: A Subsumption Architecture Implementation, in: 2022 8th International Conference on Automation, Robotics and Applications (ICARA) IEEE, Prague, Czech Republic, pp. 27–32. . https://doi.org/10.1109/ICARA55094.2022.9738521&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Brooks, R.A. (1986)&#039;&#039;&#039; A Robust Layer Control System for a Mobile Robot, IEEE Journal of Robotics and Automation RA-2, 14-23&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Rickenbacher (1975)&#039;&#039;&#039; Lernen und Motivation als relevanzgesteuerte Datenverarbeitung: Ein Computer-Simulationsmodell elementarer kognitiv-affektiver Prozesse. Birkhäuser Verag Basel.&lt;/div&gt;</summary>
		<author><name>Peterr</name></author>
	</entry>
	<entry>
		<id>https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15291</id>
		<title>Leaphy Robot</title>
		<link rel="alternate" type="text/html" href="https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15291"/>
		<updated>2025-10-01T20:51:04Z</updated>

		<summary type="html">&lt;p&gt;Peterr: /* Behavioural levels */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Name=Leaphy robot with subsumption architecture&lt;br /&gt;
|Skills=software hardware electronics biology&lt;br /&gt;
|Status=Active&lt;br /&gt;
|Niche=robotics&lt;br /&gt;
|Purpose=Fun&lt;br /&gt;
|Picture=Leaphy back side view.jpg&lt;br /&gt;
|Tool=No&lt;br /&gt;
|Location=Space, home&lt;br /&gt;
|Cost=Very small given what is already present and what is available in the space (everything!!)&lt;br /&gt;
|Category=Electronics&lt;br /&gt;
}}&lt;br /&gt;
== Electronic insect-like creature ==&lt;br /&gt;
&#039;&#039;&#039;Physiological, Behavioural and environmental overview&#039;&#039;&#039; &amp;lt;br&amp;gt;&lt;br /&gt;
peterr 2022- 2025 (with &#039;&#039;very&#039;&#039; long pauses)&lt;br /&gt;
&lt;br /&gt;
====Document history====&lt;br /&gt;
* Currently this is a living document and this wiki contains the latest version&lt;br /&gt;
* September 2025 subsumption architecture design &amp;amp; transfer to nurdspace wiki&lt;br /&gt;
* August    2025 Documentation for scheduler&lt;br /&gt;
* March     2023 Draft version 0.2  - terminology cleanup and scope&lt;br /&gt;
* November  2022 First document sketches &amp;amp; ideas&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project==&lt;br /&gt;
The insect like creature based on the original [https://leaphy.store/product/leaphy-original-los/ leaphyrobot] has a set of functionalities that together allow it to effectively find, and feed on targets that provides electricity as a reward.&lt;br /&gt;
Learning strategies to improve success rate can be implemented.&lt;br /&gt;
Sexual signaling, event prediction, mating behaviour, genetic exchange and evolution are in principle possible but are currently still (far) out of scope. The system at it&#039;s highest level can be seen as a feedback loop: sensory input =&amp;gt; behavioural selection =&amp;gt; motor output =&amp;gt; new sensory input. The original design (2022) was meant to live in wind tunnel, and find odour sources to feed, but currently the emphasis has shifted from odour detection to more general sensory processing using subsumption architecture, [https://nurdspace.nl/Leaphy_Robot#Brain see below].&lt;br /&gt;
&lt;br /&gt;
== Sensory inputs ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Mechanoreceptor - sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
:::Micro switch based tactile hairs. &lt;br /&gt;
:::&#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Ultrasound - Distance sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
::: Ultrasonic pulses detect obstacles and trigger reflex avoidance behaviour&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Better directional responses would be possible with more than one US sensor. &lt;br /&gt;
:::: This would need a dedicated embedded processor. &lt;br /&gt;
:::: &#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing light intensity&#039;&#039;&#039;&lt;br /&gt;
::: Two LDR photoreceptors measure front-left light level and front-right light level&lt;br /&gt;
::: Total light intensity (sum) is available as an analog voltage&lt;br /&gt;
::: The difference between the inputs is also available, and signals what side to turn to, to approach or avoid the light.&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing sound (audio)&#039;&#039;&#039;&lt;br /&gt;
::: A subunit with its own processor, containing an Electret microphone to measure ambiant sound level, frequency and sound patterns. &lt;br /&gt;
::: Can be used in classical (Pawlow) and operand conditioning experiments. Will detect both absolute sound levels (for startle or avoidance responses) and can contain feature detectors (e.g. chirp intervals for leaf hopper like  communication and courting  behaviour of two leaphy&#039;s).  &lt;br /&gt;
::: In addition, an Audeme Movi speech recognition shield (see https://www.audeme.com/movi.html) could be used to process voice commands&lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented, but Movi shield &amp;quot;proof of concept&amp;quot; done&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;PIR movement sensor&#039;&#039;&#039;&lt;br /&gt;
::: In addition to light intensity, an infra red motion sensors can be used to detect movements (humans, or the cat for that matter) see for instance https://www.adafruit.com/product/4871 &lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented but PIR (similar to the adafruit thingy) available&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Sensing wind direction &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based tactile hairs?  Something like https://www.instructables.com/Low-Cost-Low-Speed-Wind-Sensor-1/ with shielding? or sensitive temperature measurements?&lt;br /&gt;
:::; Note: Wind direction sensing in the wind tunnel is currently replaced by sensing light gradients parallel to the wind direction because the wind sensor is not available yet. &lt;br /&gt;
:::: &#039;&#039;Development status: To be designed, high priority for the windtunnel version with odour processing as a main goal, low priority for the a free walking space/nurdspace version described here.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Volatiles (odours) &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based perception of volatiles like alcohol (fruit-fly like behaviours), Carbon dioxide (mosquito like behaviour), or VOC&#039;s (most plant eating insects). The sensor produces a voltage level proportional to the intensity of the stimulus. Using a threshold can generate a presence/absence signal. &lt;br /&gt;
::: The interval between odour pulses is a proxy for the distance to the source. Note that an odour &amp;quot;gradient&amp;quot; does not exist!&lt;br /&gt;
&lt;br /&gt;
::: Current implementation uses a SGP30 board. The time constant of the the sensor is in the order of 1 second, but &amp;quot;whiffs&amp;quot; of odour could be detected faster by using a feature detector that looks for sudden steps in the signal. This will also act as an sensory adaptation mechanism: in the absence of change the output go&#039;s to zero.&lt;br /&gt;
::: &#039;&#039;Development status: Sensor: worked, currently broken&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground color&#039;&#039;&#039;&lt;br /&gt;
::: This sensor measures ground colour and the output can be used to test for a particular condition (e.g. being at a target position). It can also be used to simulate trail pheromones implemented as colors next to the  trail followed. This sense can also take the role of short distance &amp;quot; present at target&amp;quot; stimuli.&lt;br /&gt;
::: &#039;&#039; Development status: Operational &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground reflection level&#039;&#039;&#039;&lt;br /&gt;
::: Two sensors &#039;line followers&#039; that both provide a binary present/absent signal of ground reflection.&lt;br /&gt;
::: Can be used to simulate trail following behaviour on a network of lines  (combined with (led) ground colours.&lt;br /&gt;
::: &#039;&#039;Development status: testing phase&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Future extensions: A combination of voltage levels and pulse frequency coding in the source could be used to simulate a spectrum of &amp;quot;chemical&amp;quot; inputs.  &lt;br /&gt;
:::: Feature detectors could extract particular frequencies and/or patterns to recognise for instance &amp;quot;&#039;&#039;toxic&#039;&#039;&amp;quot; substances. &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Proprioception (internal &amp;quot;feeling&amp;quot;)&#039;&#039;&#039;&lt;br /&gt;
::: Checking for instance for body movement when motors move, or for force feedback when extending electrical honey sucking mouthparts&lt;br /&gt;
::: Development status:To be developed, as yet low priority. &lt;br /&gt;
 &lt;br /&gt;
:: &#039;&#039;&#039;Sensing internal physiological states &#039;&#039;&#039;&lt;br /&gt;
:::To place electric reward information in perspective, some internal status information is needed, that is supplied by reading internal variables like energy levels (battery voltage , load current) or physiological state (internal variables like &amp;quot;ready to feed&amp;quot;. &lt;br /&gt;
::: More advances implementations could look up previous experiences, and rate of change in physiological status as well as brain hormone levels and excitation states (see below under internal states and hormones&amp;quot;).&lt;br /&gt;
:::Development status: To be designed.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing hormone levels&#039;&#039;&#039;&lt;br /&gt;
::: Certain activities or combinations of activities can stimulate the production of hormones. This could be implemented as slow changing values in memory. Hormone levels might modulate the effect of sensory input or behavioural output, and act as a slow form of memory.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing rewards and deterrents&#039;&#039;&#039;&lt;br /&gt;
::: Electronic organisms live on electricity, and are rewarded by sensing the presence of a voltage and current. This sensory organ is just sensing the analog voltage measured by the sensory organ. It simulates the perception of food such as nectar. Most logical position is at the tip of an appendage. &lt;br /&gt;
::: &#039;&#039;Development status: implemented and removed (needs mutiplexing). Mechanical movement (servo) to make electrical contact: testing phase.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Brain ==&lt;br /&gt;
::&#039;&#039;&#039;Subsumption architecture&#039;&#039;&#039;&lt;br /&gt;
:::The Electronic organisms has a software brain that receives sensory input both from the environment and internal status. The brain reads all inputs about every 50 msec, and produces command for actuators that produce behaviour. These behaviours can be as simple as a colour changes of a led (signaling sensory status) or movements of body and body and appendages. The aim is to make the lower levels as stateless as possible i.e. the brain uses its real time vision of the word as a model instead of some abstract internal representation. The processing principle roughly follow the subsumption architecture (Brooks 1986).&lt;br /&gt;
&lt;br /&gt;
:::Wikipedia writes about this technique:&lt;br /&gt;
::::&amp;quot;&#039;&#039;[Behaviours] are organized into a hierarchy of layers. Each layer implements a particular level of behavioral competence, and higher levels are able to subsume lower levels (= integrate/combine lower levels to a more comprehensive whole) in order to create viable behavior. For example, a robot&#039;s lowest layer could be &amp;quot;avoid an object&amp;quot;. The second layer would be &amp;quot;wander around&amp;quot;, which runs beneath the third layer &amp;quot;explore the world&amp;quot;.[...]The subsumption architecture creates a system in which the higher layers utilize the lower-level competencies. The layers, which all receive sensor-information, work in parallel and generate outputs. These outputs can be commands to actuators, or signals that suppress or inhibit other layers.&amp;quot;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::My current implementation uses the opposite order. The high priority levels conduct the simplest behavioural tasks, and when these high priority but simple behavioural levels are happy more complex task can get control. This approach is still experimental, but in any case easy enough to reverse again.&lt;br /&gt;
&lt;br /&gt;
:::The behavioural levels &#039;&#039;all&#039;&#039; compete for control of the robot. Each behavioural layer evaluates its sensory input and determines if it wants to control the outputs (to change its input according to its (implied) goal, e.g. mechanoreceptors (microswitches) will only request control if the switch is closed. After all the behavioural levels are evaluated, and their request flags set or reset an arbitrate routine  selects the highest active layer that will run the robot behaviorual output for the next 50 msec.&lt;br /&gt;
:::See Anderson (2007) for a clear explanations and actual implementation examples.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Brain subsystems&#039;&#039;&#039;&lt;br /&gt;
:::More complicated or slow tasks (like sound processing or US echo detection) can be executed in separate processor boards that report their status  to the main  controller. Conceptually this is not different from subroutines for tasks.&lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Nervous system&#039;&#039;&#039;&lt;br /&gt;
::: The currently (sort of) running implementation of the brain is using a real time loop in a very simple cooperative multitasking system ([https://yiweimao.github.io/blog/async_microcontroller/ YiweiMao scheduler]) and inmplemented on an Arduino Uno &lt;br /&gt;
::: &#039;&#039;Development status: operational, but under active development.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Associative memory&#039;&#039;&#039;&lt;br /&gt;
::: Associative memory in it current, simplest form will be implemented as memory locations for particular sensory input combinations.  inputs that coincide increase a counter for that combination (learning those combinations). This allows both Pawlow  and operand conditioning.&lt;br /&gt;
:::&#039;&#039;Development status: not yet implemented, proof of concept done ~50 years ago :).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Excitation state and hormones&#039;&#039;&#039;&lt;br /&gt;
::: Hormones are internal variables with levels that act as slow changing memory for previous (combinations of) states.&lt;br /&gt;
::: A default breakdown speed can be set that slowly decrease hormone levels. Particular sensory input could increase the levels again. Reaching high levels of certain hormones can be a goal in itself, and subject to learning behaviour.&lt;br /&gt;
::: &#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Satisfaction&#039;&#039;&#039;&lt;br /&gt;
:::Signals to end feeding behaviour can -in addition to electrical food running out- also come from internal signals (satiation, internal hormonal signals, (too) long time periods with little change of events)&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Future prediction&#039;&#039;&#039;&lt;br /&gt;
:::This is currently way out of scope, but neural-net like implementations that store event sequences, predict likely outcomes of current inputs and act accordingly are fully feasible.&lt;br /&gt;
::: See Rickenbacher 1975 for an example that is probably  a bit more traceable than -for instance- modern neural network code like Tensorflow. &lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Effectors ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;main motors&#039;&#039;&#039;&lt;br /&gt;
:::The main moves of the organism are implemented by two wheels driven by two [https://leaphy.store/product/tt-motor-10cm-jumper-female/ DC motors] with build in gearboxes) and a [https://leaphy.store/product/motor-shield/ motor shield]. Motor speed is controlled by pulse width modualation (PMW)) present in the processor. Steering is done by differential motorspeed, a third backside &amp;quot;wheel&amp;quot; is a simple short passive wooden stand. This works well on reasonable flat surfaces, but needs improvement is the next robot (Terzo).&lt;br /&gt;
:::&#039;&#039;Motor development status: Operational at a basic level, PID control and extra power at startup to get smooth startup at low speed is needed.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Movable mouthparts&#039;&#039;&#039;&lt;br /&gt;
:::Appendages like extendable mouthparts controlled by [https://isking-modellbahn.de/modelcraft-es-030-Servo-top-line-steuerelektronik servo]&#039;s can be used for feeding on electrical food. Currently one servo controlling a proboscis (mouthpart for feeding) is present.&lt;br /&gt;
:::&#039;&#039;Development status: Operational in priciple, untested in practice, needs 3D printing of parts&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;[https://leaphy.store/product/rgb-led-single/ Three colour led]&#039;&#039;&#039;&lt;br /&gt;
::: can be used for signaling status of whatever state we want.&lt;br /&gt;
:::&#039;&#039;Development status: Operational &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Piezo beeper &#039;&#039;&#039;&lt;br /&gt;
::: Present on the [https://leaphy.store/product/motor-shield/ motor shield] can be used to create a variety of sounds,for instance to signal happines, distress or alarm.&lt;br /&gt;
:::&#039;&#039;Development status: Operational, but specific sounds need to be designed&lt;br /&gt;
&lt;br /&gt;
== Behavioural levels ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;Behaviour in subsumption architecture is organised in levels that compete for control, the highest priority behaviour (lowest rank, top of list) will control the robot for 50 msec &#039;&#039; When lower levels are silent higher levels get control.&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Overview of current behavioral levels and  their most important inputs for controlling requests&#039;&#039;&#039;. &lt;br /&gt;
::See the actual calls for details.&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;Layer &amp;quot;distress&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::If unable to meet the absolute basic requirement for battery voltage or movement CALL for help. In STUCK, try reflexes to get loose, pause regular. If nothing works eventually HIBERNATE &lt;br /&gt;
&lt;br /&gt;
::::Goal:  deal with the really difficult situations &lt;br /&gt;
::::0  HIBERNATE // hope for better times...&lt;br /&gt;
::::1  STUCK // try to solve non-movement when motors run...&lt;br /&gt;
::::2  CALL  // call for help&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;stay free&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::The primary sensory input activating this level are Bumper sensors and Ultrasonics, but also hormones for high emotional levels reached by an overload of sensory input or a high number of failing tries to reach some goal. Freeze will stop movement for an serious amount of time to reduce overload Fight will move quickly forward and get very close to an object possibly even disregarding US and bumpers and hitting the object. Escape will try to free the bumpers Evade will try keep a safe distance from objects Flight will try to run straight for a relative long time (using a countdown timer) but will subsumed by lower levels.&lt;br /&gt;
&lt;br /&gt;
::::Goal: avoid stressors. &lt;br /&gt;
::::3  FREEZE  // simulated dead&lt;br /&gt;
::::4  FIGHT   // Try to intimidate &lt;br /&gt;
::::5  ESCAPE  // Escape from touch&lt;br /&gt;
::::6  EVADE   // keep distance&lt;br /&gt;
::::7  FLIGHT  // run away  &lt;br /&gt;
&lt;br /&gt;
:::layer &amp;quot;external control&amp;quot;:::&lt;br /&gt;
::::8 MANUAL&lt;br /&gt;
::::Goals: No distress. Stay free, but otherwise otherwise obey external commands&lt;br /&gt;
This level is only requesting control if external commands are present in sensordata. The behaviour is self-reinforcing so once activated it keeps controlling the creature as long as new commands arrive within resonable time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:: Stay tuned, more comming soon&lt;br /&gt;
&lt;br /&gt;
== Implementation details ==&lt;br /&gt;
: Stay tuned, more comming soon&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Anderson, D.P. (2007)&#039;&#039;&#039; https://www.dprg.org/articles/2007-03a/&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Bettosini et al., 2022&#039;&#039;&#039; Torocó: A Subsumption Architecture Implementation, in: 2022 8th International Conference on Automation, Robotics and Applications (ICARA) IEEE, Prague, Czech Republic, pp. 27–32. . https://doi.org/10.1109/ICARA55094.2022.9738521&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Brooks, R.A. (1986)&#039;&#039;&#039; A Robust Layer Control System for a Mobile Robot, IEEE Journal of Robotics and Automation RA-2, 14-23&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Rickenbacher (1975)&#039;&#039;&#039; Lernen und Motivation als relevanzgesteuerte Datenverarbeitung: Ein Computer-Simulationsmodell elementarer kognitiv-affektiver Prozesse. Birkhäuser Verag Basel.&lt;/div&gt;</summary>
		<author><name>Peterr</name></author>
	</entry>
	<entry>
		<id>https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15290</id>
		<title>Leaphy Robot</title>
		<link rel="alternate" type="text/html" href="https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15290"/>
		<updated>2025-10-01T20:50:24Z</updated>

		<summary type="html">&lt;p&gt;Peterr: /* Behavioural levels */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Name=Leaphy robot with subsumption architecture&lt;br /&gt;
|Skills=software hardware electronics biology&lt;br /&gt;
|Status=Active&lt;br /&gt;
|Niche=robotics&lt;br /&gt;
|Purpose=Fun&lt;br /&gt;
|Picture=Leaphy back side view.jpg&lt;br /&gt;
|Tool=No&lt;br /&gt;
|Location=Space, home&lt;br /&gt;
|Cost=Very small given what is already present and what is available in the space (everything!!)&lt;br /&gt;
|Category=Electronics&lt;br /&gt;
}}&lt;br /&gt;
== Electronic insect-like creature ==&lt;br /&gt;
&#039;&#039;&#039;Physiological, Behavioural and environmental overview&#039;&#039;&#039; &amp;lt;br&amp;gt;&lt;br /&gt;
peterr 2022- 2025 (with &#039;&#039;very&#039;&#039; long pauses)&lt;br /&gt;
&lt;br /&gt;
====Document history====&lt;br /&gt;
* Currently this is a living document and this wiki contains the latest version&lt;br /&gt;
* September 2025 subsumption architecture design &amp;amp; transfer to nurdspace wiki&lt;br /&gt;
* August    2025 Documentation for scheduler&lt;br /&gt;
* March     2023 Draft version 0.2  - terminology cleanup and scope&lt;br /&gt;
* November  2022 First document sketches &amp;amp; ideas&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project==&lt;br /&gt;
The insect like creature based on the original [https://leaphy.store/product/leaphy-original-los/ leaphyrobot] has a set of functionalities that together allow it to effectively find, and feed on targets that provides electricity as a reward.&lt;br /&gt;
Learning strategies to improve success rate can be implemented.&lt;br /&gt;
Sexual signaling, event prediction, mating behaviour, genetic exchange and evolution are in principle possible but are currently still (far) out of scope. The system at it&#039;s highest level can be seen as a feedback loop: sensory input =&amp;gt; behavioural selection =&amp;gt; motor output =&amp;gt; new sensory input. The original design (2022) was meant to live in wind tunnel, and find odour sources to feed, but currently the emphasis has shifted from odour detection to more general sensory processing using subsumption architecture, [https://nurdspace.nl/Leaphy_Robot#Brain see below].&lt;br /&gt;
&lt;br /&gt;
== Sensory inputs ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Mechanoreceptor - sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
:::Micro switch based tactile hairs. &lt;br /&gt;
:::&#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Ultrasound - Distance sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
::: Ultrasonic pulses detect obstacles and trigger reflex avoidance behaviour&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Better directional responses would be possible with more than one US sensor. &lt;br /&gt;
:::: This would need a dedicated embedded processor. &lt;br /&gt;
:::: &#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing light intensity&#039;&#039;&#039;&lt;br /&gt;
::: Two LDR photoreceptors measure front-left light level and front-right light level&lt;br /&gt;
::: Total light intensity (sum) is available as an analog voltage&lt;br /&gt;
::: The difference between the inputs is also available, and signals what side to turn to, to approach or avoid the light.&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing sound (audio)&#039;&#039;&#039;&lt;br /&gt;
::: A subunit with its own processor, containing an Electret microphone to measure ambiant sound level, frequency and sound patterns. &lt;br /&gt;
::: Can be used in classical (Pawlow) and operand conditioning experiments. Will detect both absolute sound levels (for startle or avoidance responses) and can contain feature detectors (e.g. chirp intervals for leaf hopper like  communication and courting  behaviour of two leaphy&#039;s).  &lt;br /&gt;
::: In addition, an Audeme Movi speech recognition shield (see https://www.audeme.com/movi.html) could be used to process voice commands&lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented, but Movi shield &amp;quot;proof of concept&amp;quot; done&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;PIR movement sensor&#039;&#039;&#039;&lt;br /&gt;
::: In addition to light intensity, an infra red motion sensors can be used to detect movements (humans, or the cat for that matter) see for instance https://www.adafruit.com/product/4871 &lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented but PIR (similar to the adafruit thingy) available&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Sensing wind direction &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based tactile hairs?  Something like https://www.instructables.com/Low-Cost-Low-Speed-Wind-Sensor-1/ with shielding? or sensitive temperature measurements?&lt;br /&gt;
:::; Note: Wind direction sensing in the wind tunnel is currently replaced by sensing light gradients parallel to the wind direction because the wind sensor is not available yet. &lt;br /&gt;
:::: &#039;&#039;Development status: To be designed, high priority for the windtunnel version with odour processing as a main goal, low priority for the a free walking space/nurdspace version described here.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Volatiles (odours) &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based perception of volatiles like alcohol (fruit-fly like behaviours), Carbon dioxide (mosquito like behaviour), or VOC&#039;s (most plant eating insects). The sensor produces a voltage level proportional to the intensity of the stimulus. Using a threshold can generate a presence/absence signal. &lt;br /&gt;
::: The interval between odour pulses is a proxy for the distance to the source. Note that an odour &amp;quot;gradient&amp;quot; does not exist!&lt;br /&gt;
&lt;br /&gt;
::: Current implementation uses a SGP30 board. The time constant of the the sensor is in the order of 1 second, but &amp;quot;whiffs&amp;quot; of odour could be detected faster by using a feature detector that looks for sudden steps in the signal. This will also act as an sensory adaptation mechanism: in the absence of change the output go&#039;s to zero.&lt;br /&gt;
::: &#039;&#039;Development status: Sensor: worked, currently broken&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground color&#039;&#039;&#039;&lt;br /&gt;
::: This sensor measures ground colour and the output can be used to test for a particular condition (e.g. being at a target position). It can also be used to simulate trail pheromones implemented as colors next to the  trail followed. This sense can also take the role of short distance &amp;quot; present at target&amp;quot; stimuli.&lt;br /&gt;
::: &#039;&#039; Development status: Operational &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground reflection level&#039;&#039;&#039;&lt;br /&gt;
::: Two sensors &#039;line followers&#039; that both provide a binary present/absent signal of ground reflection.&lt;br /&gt;
::: Can be used to simulate trail following behaviour on a network of lines  (combined with (led) ground colours.&lt;br /&gt;
::: &#039;&#039;Development status: testing phase&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Future extensions: A combination of voltage levels and pulse frequency coding in the source could be used to simulate a spectrum of &amp;quot;chemical&amp;quot; inputs.  &lt;br /&gt;
:::: Feature detectors could extract particular frequencies and/or patterns to recognise for instance &amp;quot;&#039;&#039;toxic&#039;&#039;&amp;quot; substances. &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Proprioception (internal &amp;quot;feeling&amp;quot;)&#039;&#039;&#039;&lt;br /&gt;
::: Checking for instance for body movement when motors move, or for force feedback when extending electrical honey sucking mouthparts&lt;br /&gt;
::: Development status:To be developed, as yet low priority. &lt;br /&gt;
 &lt;br /&gt;
:: &#039;&#039;&#039;Sensing internal physiological states &#039;&#039;&#039;&lt;br /&gt;
:::To place electric reward information in perspective, some internal status information is needed, that is supplied by reading internal variables like energy levels (battery voltage , load current) or physiological state (internal variables like &amp;quot;ready to feed&amp;quot;. &lt;br /&gt;
::: More advances implementations could look up previous experiences, and rate of change in physiological status as well as brain hormone levels and excitation states (see below under internal states and hormones&amp;quot;).&lt;br /&gt;
:::Development status: To be designed.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing hormone levels&#039;&#039;&#039;&lt;br /&gt;
::: Certain activities or combinations of activities can stimulate the production of hormones. This could be implemented as slow changing values in memory. Hormone levels might modulate the effect of sensory input or behavioural output, and act as a slow form of memory.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing rewards and deterrents&#039;&#039;&#039;&lt;br /&gt;
::: Electronic organisms live on electricity, and are rewarded by sensing the presence of a voltage and current. This sensory organ is just sensing the analog voltage measured by the sensory organ. It simulates the perception of food such as nectar. Most logical position is at the tip of an appendage. &lt;br /&gt;
::: &#039;&#039;Development status: implemented and removed (needs mutiplexing). Mechanical movement (servo) to make electrical contact: testing phase.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Brain ==&lt;br /&gt;
::&#039;&#039;&#039;Subsumption architecture&#039;&#039;&#039;&lt;br /&gt;
:::The Electronic organisms has a software brain that receives sensory input both from the environment and internal status. The brain reads all inputs about every 50 msec, and produces command for actuators that produce behaviour. These behaviours can be as simple as a colour changes of a led (signaling sensory status) or movements of body and body and appendages. The aim is to make the lower levels as stateless as possible i.e. the brain uses its real time vision of the word as a model instead of some abstract internal representation. The processing principle roughly follow the subsumption architecture (Brooks 1986).&lt;br /&gt;
&lt;br /&gt;
:::Wikipedia writes about this technique:&lt;br /&gt;
::::&amp;quot;&#039;&#039;[Behaviours] are organized into a hierarchy of layers. Each layer implements a particular level of behavioral competence, and higher levels are able to subsume lower levels (= integrate/combine lower levels to a more comprehensive whole) in order to create viable behavior. For example, a robot&#039;s lowest layer could be &amp;quot;avoid an object&amp;quot;. The second layer would be &amp;quot;wander around&amp;quot;, which runs beneath the third layer &amp;quot;explore the world&amp;quot;.[...]The subsumption architecture creates a system in which the higher layers utilize the lower-level competencies. The layers, which all receive sensor-information, work in parallel and generate outputs. These outputs can be commands to actuators, or signals that suppress or inhibit other layers.&amp;quot;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::My current implementation uses the opposite order. The high priority levels conduct the simplest behavioural tasks, and when these high priority but simple behavioural levels are happy more complex task can get control. This approach is still experimental, but in any case easy enough to reverse again.&lt;br /&gt;
&lt;br /&gt;
:::The behavioural levels &#039;&#039;all&#039;&#039; compete for control of the robot. Each behavioural layer evaluates its sensory input and determines if it wants to control the outputs (to change its input according to its (implied) goal, e.g. mechanoreceptors (microswitches) will only request control if the switch is closed. After all the behavioural levels are evaluated, and their request flags set or reset an arbitrate routine  selects the highest active layer that will run the robot behaviorual output for the next 50 msec.&lt;br /&gt;
:::See Anderson (2007) for a clear explanations and actual implementation examples.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Brain subsystems&#039;&#039;&#039;&lt;br /&gt;
:::More complicated or slow tasks (like sound processing or US echo detection) can be executed in separate processor boards that report their status  to the main  controller. Conceptually this is not different from subroutines for tasks.&lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Nervous system&#039;&#039;&#039;&lt;br /&gt;
::: The currently (sort of) running implementation of the brain is using a real time loop in a very simple cooperative multitasking system ([https://yiweimao.github.io/blog/async_microcontroller/ YiweiMao scheduler]) and inmplemented on an Arduino Uno &lt;br /&gt;
::: &#039;&#039;Development status: operational, but under active development.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Associative memory&#039;&#039;&#039;&lt;br /&gt;
::: Associative memory in it current, simplest form will be implemented as memory locations for particular sensory input combinations.  inputs that coincide increase a counter for that combination (learning those combinations). This allows both Pawlow  and operand conditioning.&lt;br /&gt;
:::&#039;&#039;Development status: not yet implemented, proof of concept done ~50 years ago :).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Excitation state and hormones&#039;&#039;&#039;&lt;br /&gt;
::: Hormones are internal variables with levels that act as slow changing memory for previous (combinations of) states.&lt;br /&gt;
::: A default breakdown speed can be set that slowly decrease hormone levels. Particular sensory input could increase the levels again. Reaching high levels of certain hormones can be a goal in itself, and subject to learning behaviour.&lt;br /&gt;
::: &#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Satisfaction&#039;&#039;&#039;&lt;br /&gt;
:::Signals to end feeding behaviour can -in addition to electrical food running out- also come from internal signals (satiation, internal hormonal signals, (too) long time periods with little change of events)&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Future prediction&#039;&#039;&#039;&lt;br /&gt;
:::This is currently way out of scope, but neural-net like implementations that store event sequences, predict likely outcomes of current inputs and act accordingly are fully feasible.&lt;br /&gt;
::: See Rickenbacher 1975 for an example that is probably  a bit more traceable than -for instance- modern neural network code like Tensorflow. &lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Effectors ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;main motors&#039;&#039;&#039;&lt;br /&gt;
:::The main moves of the organism are implemented by two wheels driven by two [https://leaphy.store/product/tt-motor-10cm-jumper-female/ DC motors] with build in gearboxes) and a [https://leaphy.store/product/motor-shield/ motor shield]. Motor speed is controlled by pulse width modualation (PMW)) present in the processor. Steering is done by differential motorspeed, a third backside &amp;quot;wheel&amp;quot; is a simple short passive wooden stand. This works well on reasonable flat surfaces, but needs improvement is the next robot (Terzo).&lt;br /&gt;
:::&#039;&#039;Motor development status: Operational at a basic level, PID control and extra power at startup to get smooth startup at low speed is needed.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Movable mouthparts&#039;&#039;&#039;&lt;br /&gt;
:::Appendages like extendable mouthparts controlled by [https://isking-modellbahn.de/modelcraft-es-030-Servo-top-line-steuerelektronik servo]&#039;s can be used for feeding on electrical food. Currently one servo controlling a proboscis (mouthpart for feeding) is present.&lt;br /&gt;
:::&#039;&#039;Development status: Operational in priciple, untested in practice, needs 3D printing of parts&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;[https://leaphy.store/product/rgb-led-single/ Three colour led]&#039;&#039;&#039;&lt;br /&gt;
::: can be used for signaling status of whatever state we want.&lt;br /&gt;
:::&#039;&#039;Development status: Operational &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Piezo beeper &#039;&#039;&#039;&lt;br /&gt;
::: Present on the [https://leaphy.store/product/motor-shield/ motor shield] can be used to create a variety of sounds,for instance to signal happines, distress or alarm.&lt;br /&gt;
:::&#039;&#039;Development status: Operational, but specific sounds need to be designed&lt;br /&gt;
&lt;br /&gt;
== Behavioural levels ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;Behaviour in subsumption architecture is organised in levels that compete for control, the highest priority behaviour (lowest rank, top of list) will control the robot for 50 msec &#039;&#039; When lower levels are silent higher levels get control.&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Overview of current behavioral levels and  their most important inputs for controlling requests&#039;&#039;&#039;. &lt;br /&gt;
::See the actual calls for details.&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;Layer &amp;quot;distress&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::If unable to meet the absolute basic requirement for battery voltage or movement CALL for help. In STUCK, try reflexes to get loose, pause regular. If nothing works eventually HIBERNATE &lt;br /&gt;
&lt;br /&gt;
::::Goal:  deal with the really difficult situations &lt;br /&gt;
::::0  HIBERNATE // hope for better times...&lt;br /&gt;
::::1  STUCK // try to solve non-movement when motors run...&lt;br /&gt;
::::2  CALL  // call for help&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;stay free&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::The primary sensory input activating this level are Bumper sensors and Ultrasonics, but also hormones for high emotional levels reached by an overload of sensory input or a high number of failing tries to reach some goal. Freeze will stop movement for an serious amount of time to reduce overload Fight will move quickly forward and get very close to an object possibly even disregarding US and bumpers and hitting the object. Escape will try to free the bumpers Evade will try keep a safe distance from objects Flight will try to run straight for a relative long time (using a countdown timer) but will subsumed by lower levels.&lt;br /&gt;
&lt;br /&gt;
::::Goal: avoid stressors. &lt;br /&gt;
::::3  FREEZE  // simulated dead&lt;br /&gt;
::::4  FIGHT   // Try to intimidate &lt;br /&gt;
::::5  ESCAPE  // Escape from touch&lt;br /&gt;
::::6  EVADE   // keep distance&lt;br /&gt;
::::7  FLIGHT  // run away  &lt;br /&gt;
&lt;br /&gt;
:::&amp;quot;&amp;quot;&amp;quot;layer &amp;quot;external control&amp;quot;:::&lt;br /&gt;
::::8 MANUAL&lt;br /&gt;
::::Goals: No distress. Stay free, but otherwise otherwise obey external commands&lt;br /&gt;
This level is only requesting control if external commands are present in sensordata. The behaviour is self-reinforcing so once activated it keeps controlling the creature as long as new commands arrive within resonable time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:: Stay tuned, more comming soon&lt;br /&gt;
&lt;br /&gt;
== Implementation details ==&lt;br /&gt;
: Stay tuned, more comming soon&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Anderson, D.P. (2007)&#039;&#039;&#039; https://www.dprg.org/articles/2007-03a/&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Bettosini et al., 2022&#039;&#039;&#039; Torocó: A Subsumption Architecture Implementation, in: 2022 8th International Conference on Automation, Robotics and Applications (ICARA) IEEE, Prague, Czech Republic, pp. 27–32. . https://doi.org/10.1109/ICARA55094.2022.9738521&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Brooks, R.A. (1986)&#039;&#039;&#039; A Robust Layer Control System for a Mobile Robot, IEEE Journal of Robotics and Automation RA-2, 14-23&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Rickenbacher (1975)&#039;&#039;&#039; Lernen und Motivation als relevanzgesteuerte Datenverarbeitung: Ein Computer-Simulationsmodell elementarer kognitiv-affektiver Prozesse. Birkhäuser Verag Basel.&lt;/div&gt;</summary>
		<author><name>Peterr</name></author>
	</entry>
	<entry>
		<id>https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15289</id>
		<title>Leaphy Robot</title>
		<link rel="alternate" type="text/html" href="https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15289"/>
		<updated>2025-10-01T20:48:30Z</updated>

		<summary type="html">&lt;p&gt;Peterr: /* Behavioural levels */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Name=Leaphy robot with subsumption architecture&lt;br /&gt;
|Skills=software hardware electronics biology&lt;br /&gt;
|Status=Active&lt;br /&gt;
|Niche=robotics&lt;br /&gt;
|Purpose=Fun&lt;br /&gt;
|Picture=Leaphy back side view.jpg&lt;br /&gt;
|Tool=No&lt;br /&gt;
|Location=Space, home&lt;br /&gt;
|Cost=Very small given what is already present and what is available in the space (everything!!)&lt;br /&gt;
|Category=Electronics&lt;br /&gt;
}}&lt;br /&gt;
== Electronic insect-like creature ==&lt;br /&gt;
&#039;&#039;&#039;Physiological, Behavioural and environmental overview&#039;&#039;&#039; &amp;lt;br&amp;gt;&lt;br /&gt;
peterr 2022- 2025 (with &#039;&#039;very&#039;&#039; long pauses)&lt;br /&gt;
&lt;br /&gt;
====Document history====&lt;br /&gt;
* Currently this is a living document and this wiki contains the latest version&lt;br /&gt;
* September 2025 subsumption architecture design &amp;amp; transfer to nurdspace wiki&lt;br /&gt;
* August    2025 Documentation for scheduler&lt;br /&gt;
* March     2023 Draft version 0.2  - terminology cleanup and scope&lt;br /&gt;
* November  2022 First document sketches &amp;amp; ideas&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project==&lt;br /&gt;
The insect like creature based on the original [https://leaphy.store/product/leaphy-original-los/ leaphyrobot] has a set of functionalities that together allow it to effectively find, and feed on targets that provides electricity as a reward.&lt;br /&gt;
Learning strategies to improve success rate can be implemented.&lt;br /&gt;
Sexual signaling, event prediction, mating behaviour, genetic exchange and evolution are in principle possible but are currently still (far) out of scope. The system at it&#039;s highest level can be seen as a feedback loop: sensory input =&amp;gt; behavioural selection =&amp;gt; motor output =&amp;gt; new sensory input. The original design (2022) was meant to live in wind tunnel, and find odour sources to feed, but currently the emphasis has shifted from odour detection to more general sensory processing using subsumption architecture, [https://nurdspace.nl/Leaphy_Robot#Brain see below].&lt;br /&gt;
&lt;br /&gt;
== Sensory inputs ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Mechanoreceptor - sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
:::Micro switch based tactile hairs. &lt;br /&gt;
:::&#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Ultrasound - Distance sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
::: Ultrasonic pulses detect obstacles and trigger reflex avoidance behaviour&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Better directional responses would be possible with more than one US sensor. &lt;br /&gt;
:::: This would need a dedicated embedded processor. &lt;br /&gt;
:::: &#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing light intensity&#039;&#039;&#039;&lt;br /&gt;
::: Two LDR photoreceptors measure front-left light level and front-right light level&lt;br /&gt;
::: Total light intensity (sum) is available as an analog voltage&lt;br /&gt;
::: The difference between the inputs is also available, and signals what side to turn to, to approach or avoid the light.&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing sound (audio)&#039;&#039;&#039;&lt;br /&gt;
::: A subunit with its own processor, containing an Electret microphone to measure ambiant sound level, frequency and sound patterns. &lt;br /&gt;
::: Can be used in classical (Pawlow) and operand conditioning experiments. Will detect both absolute sound levels (for startle or avoidance responses) and can contain feature detectors (e.g. chirp intervals for leaf hopper like  communication and courting  behaviour of two leaphy&#039;s).  &lt;br /&gt;
::: In addition, an Audeme Movi speech recognition shield (see https://www.audeme.com/movi.html) could be used to process voice commands&lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented, but Movi shield &amp;quot;proof of concept&amp;quot; done&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;PIR movement sensor&#039;&#039;&#039;&lt;br /&gt;
::: In addition to light intensity, an infra red motion sensors can be used to detect movements (humans, or the cat for that matter) see for instance https://www.adafruit.com/product/4871 &lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented but PIR (similar to the adafruit thingy) available&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Sensing wind direction &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based tactile hairs?  Something like https://www.instructables.com/Low-Cost-Low-Speed-Wind-Sensor-1/ with shielding? or sensitive temperature measurements?&lt;br /&gt;
:::; Note: Wind direction sensing in the wind tunnel is currently replaced by sensing light gradients parallel to the wind direction because the wind sensor is not available yet. &lt;br /&gt;
:::: &#039;&#039;Development status: To be designed, high priority for the windtunnel version with odour processing as a main goal, low priority for the a free walking space/nurdspace version described here.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Volatiles (odours) &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based perception of volatiles like alcohol (fruit-fly like behaviours), Carbon dioxide (mosquito like behaviour), or VOC&#039;s (most plant eating insects). The sensor produces a voltage level proportional to the intensity of the stimulus. Using a threshold can generate a presence/absence signal. &lt;br /&gt;
::: The interval between odour pulses is a proxy for the distance to the source. Note that an odour &amp;quot;gradient&amp;quot; does not exist!&lt;br /&gt;
&lt;br /&gt;
::: Current implementation uses a SGP30 board. The time constant of the the sensor is in the order of 1 second, but &amp;quot;whiffs&amp;quot; of odour could be detected faster by using a feature detector that looks for sudden steps in the signal. This will also act as an sensory adaptation mechanism: in the absence of change the output go&#039;s to zero.&lt;br /&gt;
::: &#039;&#039;Development status: Sensor: worked, currently broken&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground color&#039;&#039;&#039;&lt;br /&gt;
::: This sensor measures ground colour and the output can be used to test for a particular condition (e.g. being at a target position). It can also be used to simulate trail pheromones implemented as colors next to the  trail followed. This sense can also take the role of short distance &amp;quot; present at target&amp;quot; stimuli.&lt;br /&gt;
::: &#039;&#039; Development status: Operational &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground reflection level&#039;&#039;&#039;&lt;br /&gt;
::: Two sensors &#039;line followers&#039; that both provide a binary present/absent signal of ground reflection.&lt;br /&gt;
::: Can be used to simulate trail following behaviour on a network of lines  (combined with (led) ground colours.&lt;br /&gt;
::: &#039;&#039;Development status: testing phase&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Future extensions: A combination of voltage levels and pulse frequency coding in the source could be used to simulate a spectrum of &amp;quot;chemical&amp;quot; inputs.  &lt;br /&gt;
:::: Feature detectors could extract particular frequencies and/or patterns to recognise for instance &amp;quot;&#039;&#039;toxic&#039;&#039;&amp;quot; substances. &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Proprioception (internal &amp;quot;feeling&amp;quot;)&#039;&#039;&#039;&lt;br /&gt;
::: Checking for instance for body movement when motors move, or for force feedback when extending electrical honey sucking mouthparts&lt;br /&gt;
::: Development status:To be developed, as yet low priority. &lt;br /&gt;
 &lt;br /&gt;
:: &#039;&#039;&#039;Sensing internal physiological states &#039;&#039;&#039;&lt;br /&gt;
:::To place electric reward information in perspective, some internal status information is needed, that is supplied by reading internal variables like energy levels (battery voltage , load current) or physiological state (internal variables like &amp;quot;ready to feed&amp;quot;. &lt;br /&gt;
::: More advances implementations could look up previous experiences, and rate of change in physiological status as well as brain hormone levels and excitation states (see below under internal states and hormones&amp;quot;).&lt;br /&gt;
:::Development status: To be designed.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing hormone levels&#039;&#039;&#039;&lt;br /&gt;
::: Certain activities or combinations of activities can stimulate the production of hormones. This could be implemented as slow changing values in memory. Hormone levels might modulate the effect of sensory input or behavioural output, and act as a slow form of memory.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing rewards and deterrents&#039;&#039;&#039;&lt;br /&gt;
::: Electronic organisms live on electricity, and are rewarded by sensing the presence of a voltage and current. This sensory organ is just sensing the analog voltage measured by the sensory organ. It simulates the perception of food such as nectar. Most logical position is at the tip of an appendage. &lt;br /&gt;
::: &#039;&#039;Development status: implemented and removed (needs mutiplexing). Mechanical movement (servo) to make electrical contact: testing phase.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Brain ==&lt;br /&gt;
::&#039;&#039;&#039;Subsumption architecture&#039;&#039;&#039;&lt;br /&gt;
:::The Electronic organisms has a software brain that receives sensory input both from the environment and internal status. The brain reads all inputs about every 50 msec, and produces command for actuators that produce behaviour. These behaviours can be as simple as a colour changes of a led (signaling sensory status) or movements of body and body and appendages. The aim is to make the lower levels as stateless as possible i.e. the brain uses its real time vision of the word as a model instead of some abstract internal representation. The processing principle roughly follow the subsumption architecture (Brooks 1986).&lt;br /&gt;
&lt;br /&gt;
:::Wikipedia writes about this technique:&lt;br /&gt;
::::&amp;quot;&#039;&#039;[Behaviours] are organized into a hierarchy of layers. Each layer implements a particular level of behavioral competence, and higher levels are able to subsume lower levels (= integrate/combine lower levels to a more comprehensive whole) in order to create viable behavior. For example, a robot&#039;s lowest layer could be &amp;quot;avoid an object&amp;quot;. The second layer would be &amp;quot;wander around&amp;quot;, which runs beneath the third layer &amp;quot;explore the world&amp;quot;.[...]The subsumption architecture creates a system in which the higher layers utilize the lower-level competencies. The layers, which all receive sensor-information, work in parallel and generate outputs. These outputs can be commands to actuators, or signals that suppress or inhibit other layers.&amp;quot;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::My current implementation uses the opposite order. The high priority levels conduct the simplest behavioural tasks, and when these high priority but simple behavioural levels are happy more complex task can get control. This approach is still experimental, but in any case easy enough to reverse again.&lt;br /&gt;
&lt;br /&gt;
:::The behavioural levels &#039;&#039;all&#039;&#039; compete for control of the robot. Each behavioural layer evaluates its sensory input and determines if it wants to control the outputs (to change its input according to its (implied) goal, e.g. mechanoreceptors (microswitches) will only request control if the switch is closed. After all the behavioural levels are evaluated, and their request flags set or reset an arbitrate routine  selects the highest active layer that will run the robot behaviorual output for the next 50 msec.&lt;br /&gt;
:::See Anderson (2007) for a clear explanations and actual implementation examples.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Brain subsystems&#039;&#039;&#039;&lt;br /&gt;
:::More complicated or slow tasks (like sound processing or US echo detection) can be executed in separate processor boards that report their status  to the main  controller. Conceptually this is not different from subroutines for tasks.&lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Nervous system&#039;&#039;&#039;&lt;br /&gt;
::: The currently (sort of) running implementation of the brain is using a real time loop in a very simple cooperative multitasking system ([https://yiweimao.github.io/blog/async_microcontroller/ YiweiMao scheduler]) and inmplemented on an Arduino Uno &lt;br /&gt;
::: &#039;&#039;Development status: operational, but under active development.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Associative memory&#039;&#039;&#039;&lt;br /&gt;
::: Associative memory in it current, simplest form will be implemented as memory locations for particular sensory input combinations.  inputs that coincide increase a counter for that combination (learning those combinations). This allows both Pawlow  and operand conditioning.&lt;br /&gt;
:::&#039;&#039;Development status: not yet implemented, proof of concept done ~50 years ago :).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Excitation state and hormones&#039;&#039;&#039;&lt;br /&gt;
::: Hormones are internal variables with levels that act as slow changing memory for previous (combinations of) states.&lt;br /&gt;
::: A default breakdown speed can be set that slowly decrease hormone levels. Particular sensory input could increase the levels again. Reaching high levels of certain hormones can be a goal in itself, and subject to learning behaviour.&lt;br /&gt;
::: &#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Satisfaction&#039;&#039;&#039;&lt;br /&gt;
:::Signals to end feeding behaviour can -in addition to electrical food running out- also come from internal signals (satiation, internal hormonal signals, (too) long time periods with little change of events)&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Future prediction&#039;&#039;&#039;&lt;br /&gt;
:::This is currently way out of scope, but neural-net like implementations that store event sequences, predict likely outcomes of current inputs and act accordingly are fully feasible.&lt;br /&gt;
::: See Rickenbacher 1975 for an example that is probably  a bit more traceable than -for instance- modern neural network code like Tensorflow. &lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Effectors ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;main motors&#039;&#039;&#039;&lt;br /&gt;
:::The main moves of the organism are implemented by two wheels driven by two [https://leaphy.store/product/tt-motor-10cm-jumper-female/ DC motors] with build in gearboxes) and a [https://leaphy.store/product/motor-shield/ motor shield]. Motor speed is controlled by pulse width modualation (PMW)) present in the processor. Steering is done by differential motorspeed, a third backside &amp;quot;wheel&amp;quot; is a simple short passive wooden stand. This works well on reasonable flat surfaces, but needs improvement is the next robot (Terzo).&lt;br /&gt;
:::&#039;&#039;Motor development status: Operational at a basic level, PID control and extra power at startup to get smooth startup at low speed is needed.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Movable mouthparts&#039;&#039;&#039;&lt;br /&gt;
:::Appendages like extendable mouthparts controlled by [https://isking-modellbahn.de/modelcraft-es-030-Servo-top-line-steuerelektronik servo]&#039;s can be used for feeding on electrical food. Currently one servo controlling a proboscis (mouthpart for feeding) is present.&lt;br /&gt;
:::&#039;&#039;Development status: Operational in priciple, untested in practice, needs 3D printing of parts&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;[https://leaphy.store/product/rgb-led-single/ Three colour led]&#039;&#039;&#039;&lt;br /&gt;
::: can be used for signaling status of whatever state we want.&lt;br /&gt;
:::&#039;&#039;Development status: Operational &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Piezo beeper &#039;&#039;&#039;&lt;br /&gt;
::: Present on the [https://leaphy.store/product/motor-shield/ motor shield] can be used to create a variety of sounds,for instance to signal happines, distress or alarm.&lt;br /&gt;
:::&#039;&#039;Development status: Operational, but specific sounds need to be designed&lt;br /&gt;
&lt;br /&gt;
== Behavioural levels ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;Behaviour in subsumption architecture is organised in levels that compete for control, the highest priority behaviour (lowest rank, top of list) will control the robot for 50 msec &#039;&#039; When lower levels are silent higher levels get control.&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Overview of current behavioral levels and  their most immportant inputs for controlling requests&#039;&#039;&#039;. &lt;br /&gt;
::See the actual calls for details.&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;Layer &amp;quot;distresss&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::If unable to meet the absolute basic requirement for battery voltage or movement CALL for help. In STUCK, try reflexes to get loose, pause regular. If nothing works eventually HIBERNATE &lt;br /&gt;
&lt;br /&gt;
::::Goal:  deal with the really difficult situations &lt;br /&gt;
::::0  HIBERNATE // hope for better times...&lt;br /&gt;
::::1  STUCK // try to solve non-movement when motors run...&lt;br /&gt;
::::2  CALL  // call for help&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;stay free&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::The primary sensory input activating this level are Bumper sensors and Utrasonics, but also hormones for high emotional levels reached by an overlaod of sensory input or a high number of failing tries to reach some goal. Freeze will stop movement for an serious amount of time to reduce overload Fight will move qucikly forward and get very close to an object possily even disregarding US and bumpers and hiting the object Escape will try to free the bumpers Evade will try keep a safe distance from objects Flight will try to run straight for a relative long time (using a countdown timer) but will subsumed by lower levels.&lt;br /&gt;
&lt;br /&gt;
::::Goal: avoid stressors. &lt;br /&gt;
::::3  FREEZE  // simulated dead&lt;br /&gt;
::::4  FIGHT   // Try to intimidiate &lt;br /&gt;
::::5  ESCAPE  // Escape from touch&lt;br /&gt;
::::6  EVADE   // keep distance&lt;br /&gt;
::::7  FLIGHT  // run away  &lt;br /&gt;
&lt;br /&gt;
:::&amp;quot;&amp;quot;&amp;quot;layer &amp;quot;external control&amp;quot;:::&lt;br /&gt;
::::8 MANUAL&lt;br /&gt;
::::Goals: No distress. Stay free, but otherwise otherwise obey external commands&lt;br /&gt;
This level is only requesting control if external commands are present in sensordata. The behaviour is self-reinforcing so once activated it keeps controlling the creature as long as new commands arrive within resonable time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:: Stay tuned, more comming soon&lt;br /&gt;
&lt;br /&gt;
== Implementation details ==&lt;br /&gt;
: Stay tuned, more comming soon&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Anderson, D.P. (2007)&#039;&#039;&#039; https://www.dprg.org/articles/2007-03a/&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Bettosini et al., 2022&#039;&#039;&#039; Torocó: A Subsumption Architecture Implementation, in: 2022 8th International Conference on Automation, Robotics and Applications (ICARA) IEEE, Prague, Czech Republic, pp. 27–32. . https://doi.org/10.1109/ICARA55094.2022.9738521&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Brooks, R.A. (1986)&#039;&#039;&#039; A Robust Layer Control System for a Mobile Robot, IEEE Journal of Robotics and Automation RA-2, 14-23&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Rickenbacher (1975)&#039;&#039;&#039; Lernen und Motivation als relevanzgesteuerte Datenverarbeitung: Ein Computer-Simulationsmodell elementarer kognitiv-affektiver Prozesse. Birkhäuser Verag Basel.&lt;/div&gt;</summary>
		<author><name>Peterr</name></author>
	</entry>
	<entry>
		<id>https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15288</id>
		<title>Leaphy Robot</title>
		<link rel="alternate" type="text/html" href="https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15288"/>
		<updated>2025-10-01T20:44:50Z</updated>

		<summary type="html">&lt;p&gt;Peterr: /* Behavioural levels */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Name=Leaphy robot with subsumption architecture&lt;br /&gt;
|Skills=software hardware electronics biology&lt;br /&gt;
|Status=Active&lt;br /&gt;
|Niche=robotics&lt;br /&gt;
|Purpose=Fun&lt;br /&gt;
|Picture=Leaphy back side view.jpg&lt;br /&gt;
|Tool=No&lt;br /&gt;
|Location=Space, home&lt;br /&gt;
|Cost=Very small given what is already present and what is available in the space (everything!!)&lt;br /&gt;
|Category=Electronics&lt;br /&gt;
}}&lt;br /&gt;
== Electronic insect-like creature ==&lt;br /&gt;
&#039;&#039;&#039;Physiological, Behavioural and environmental overview&#039;&#039;&#039; &amp;lt;br&amp;gt;&lt;br /&gt;
peterr 2022- 2025 (with &#039;&#039;very&#039;&#039; long pauses)&lt;br /&gt;
&lt;br /&gt;
====Document history====&lt;br /&gt;
* Currently this is a living document and this wiki contains the latest version&lt;br /&gt;
* September 2025 subsumption architecture design &amp;amp; transfer to nurdspace wiki&lt;br /&gt;
* August    2025 Documentation for scheduler&lt;br /&gt;
* March     2023 Draft version 0.2  - terminology cleanup and scope&lt;br /&gt;
* November  2022 First document sketches &amp;amp; ideas&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project==&lt;br /&gt;
The insect like creature based on the original [https://leaphy.store/product/leaphy-original-los/ leaphyrobot] has a set of functionalities that together allow it to effectively find, and feed on targets that provides electricity as a reward.&lt;br /&gt;
Learning strategies to improve success rate can be implemented.&lt;br /&gt;
Sexual signaling, event prediction, mating behaviour, genetic exchange and evolution are in principle possible but are currently still (far) out of scope. The system at it&#039;s highest level can be seen as a feedback loop: sensory input =&amp;gt; behavioural selection =&amp;gt; motor output =&amp;gt; new sensory input. The original design (2022) was meant to live in wind tunnel, and find odour sources to feed, but currently the emphasis has shifted from odour detection to more general sensory processing using subsumption architecture, [https://nurdspace.nl/Leaphy_Robot#Brain see below].&lt;br /&gt;
&lt;br /&gt;
== Sensory inputs ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Mechanoreceptor - sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
:::Micro switch based tactile hairs. &lt;br /&gt;
:::&#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Ultrasound - Distance sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
::: Ultrasonic pulses detect obstacles and trigger reflex avoidance behaviour&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Better directional responses would be possible with more than one US sensor. &lt;br /&gt;
:::: This would need a dedicated embedded processor. &lt;br /&gt;
:::: &#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing light intensity&#039;&#039;&#039;&lt;br /&gt;
::: Two LDR photoreceptors measure front-left light level and front-right light level&lt;br /&gt;
::: Total light intensity (sum) is available as an analog voltage&lt;br /&gt;
::: The difference between the inputs is also available, and signals what side to turn to, to approach or avoid the light.&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing sound (audio)&#039;&#039;&#039;&lt;br /&gt;
::: A subunit with its own processor, containing an Electret microphone to measure ambiant sound level, frequency and sound patterns. &lt;br /&gt;
::: Can be used in classical (Pawlow) and operand conditioning experiments. Will detect both absolute sound levels (for startle or avoidance responses) and can contain feature detectors (e.g. chirp intervals for leaf hopper like  communication and courting  behaviour of two leaphy&#039;s).  &lt;br /&gt;
::: In addition, an Audeme Movi speech recognition shield (see https://www.audeme.com/movi.html) could be used to process voice commands&lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented, but Movi shield &amp;quot;proof of concept&amp;quot; done&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;PIR movement sensor&#039;&#039;&#039;&lt;br /&gt;
::: In addition to light intensity, an infra red motion sensors can be used to detect movements (humans, or the cat for that matter) see for instance https://www.adafruit.com/product/4871 &lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented but PIR (similar to the adafruit thingy) available&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Sensing wind direction &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based tactile hairs?  Something like https://www.instructables.com/Low-Cost-Low-Speed-Wind-Sensor-1/ with shielding? or sensitive temperature measurements?&lt;br /&gt;
:::; Note: Wind direction sensing in the wind tunnel is currently replaced by sensing light gradients parallel to the wind direction because the wind sensor is not available yet. &lt;br /&gt;
:::: &#039;&#039;Development status: To be designed, high priority for the windtunnel version with odour processing as a main goal, low priority for the a free walking space/nurdspace version described here.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Volatiles (odours) &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based perception of volatiles like alcohol (fruit-fly like behaviours), Carbon dioxide (mosquito like behaviour), or VOC&#039;s (most plant eating insects). The sensor produces a voltage level proportional to the intensity of the stimulus. Using a threshold can generate a presence/absence signal. &lt;br /&gt;
::: The interval between odour pulses is a proxy for the distance to the source. Note that an odour &amp;quot;gradient&amp;quot; does not exist!&lt;br /&gt;
&lt;br /&gt;
::: Current implementation uses a SGP30 board. The time constant of the the sensor is in the order of 1 second, but &amp;quot;whiffs&amp;quot; of odour could be detected faster by using a feature detector that looks for sudden steps in the signal. This will also act as an sensory adaptation mechanism: in the absence of change the output go&#039;s to zero.&lt;br /&gt;
::: &#039;&#039;Development status: Sensor: worked, currently broken&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground color&#039;&#039;&#039;&lt;br /&gt;
::: This sensor measures ground colour and the output can be used to test for a particular condition (e.g. being at a target position). It can also be used to simulate trail pheromones implemented as colors next to the  trail followed. This sense can also take the role of short distance &amp;quot; present at target&amp;quot; stimuli.&lt;br /&gt;
::: &#039;&#039; Development status: Operational &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground reflection level&#039;&#039;&#039;&lt;br /&gt;
::: Two sensors &#039;line followers&#039; that both provide a binary present/absent signal of ground reflection.&lt;br /&gt;
::: Can be used to simulate trail following behaviour on a network of lines  (combined with (led) ground colours.&lt;br /&gt;
::: &#039;&#039;Development status: testing phase&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Future extensions: A combination of voltage levels and pulse frequency coding in the source could be used to simulate a spectrum of &amp;quot;chemical&amp;quot; inputs.  &lt;br /&gt;
:::: Feature detectors could extract particular frequencies and/or patterns to recognise for instance &amp;quot;&#039;&#039;toxic&#039;&#039;&amp;quot; substances. &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Proprioception (internal &amp;quot;feeling&amp;quot;)&#039;&#039;&#039;&lt;br /&gt;
::: Checking for instance for body movement when motors move, or for force feedback when extending electrical honey sucking mouthparts&lt;br /&gt;
::: Development status:To be developed, as yet low priority. &lt;br /&gt;
 &lt;br /&gt;
:: &#039;&#039;&#039;Sensing internal physiological states &#039;&#039;&#039;&lt;br /&gt;
:::To place electric reward information in perspective, some internal status information is needed, that is supplied by reading internal variables like energy levels (battery voltage , load current) or physiological state (internal variables like &amp;quot;ready to feed&amp;quot;. &lt;br /&gt;
::: More advances implementations could look up previous experiences, and rate of change in physiological status as well as brain hormone levels and excitation states (see below under internal states and hormones&amp;quot;).&lt;br /&gt;
:::Development status: To be designed.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing hormone levels&#039;&#039;&#039;&lt;br /&gt;
::: Certain activities or combinations of activities can stimulate the production of hormones. This could be implemented as slow changing values in memory. Hormone levels might modulate the effect of sensory input or behavioural output, and act as a slow form of memory.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing rewards and deterrents&#039;&#039;&#039;&lt;br /&gt;
::: Electronic organisms live on electricity, and are rewarded by sensing the presence of a voltage and current. This sensory organ is just sensing the analog voltage measured by the sensory organ. It simulates the perception of food such as nectar. Most logical position is at the tip of an appendage. &lt;br /&gt;
::: &#039;&#039;Development status: implemented and removed (needs mutiplexing). Mechanical movement (servo) to make electrical contact: testing phase.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Brain ==&lt;br /&gt;
::&#039;&#039;&#039;Subsumption architecture&#039;&#039;&#039;&lt;br /&gt;
:::The Electronic organisms has a software brain that receives sensory input both from the environment and internal status. The brain reads all inputs about every 50 msec, and produces command for actuators that produce behaviour. These behaviours can be as simple as a colour changes of a led (signaling sensory status) or movements of body and body and appendages. The aim is to make the lower levels as stateless as possible i.e. the brain uses its real time vision of the word as a model instead of some abstract internal representation. The processing principle roughly follow the subsumption architecture (Brooks 1986).&lt;br /&gt;
&lt;br /&gt;
:::Wikipedia writes about this technique:&lt;br /&gt;
::::&amp;quot;&#039;&#039;[Behaviours] are organized into a hierarchy of layers. Each layer implements a particular level of behavioral competence, and higher levels are able to subsume lower levels (= integrate/combine lower levels to a more comprehensive whole) in order to create viable behavior. For example, a robot&#039;s lowest layer could be &amp;quot;avoid an object&amp;quot;. The second layer would be &amp;quot;wander around&amp;quot;, which runs beneath the third layer &amp;quot;explore the world&amp;quot;.[...]The subsumption architecture creates a system in which the higher layers utilize the lower-level competencies. The layers, which all receive sensor-information, work in parallel and generate outputs. These outputs can be commands to actuators, or signals that suppress or inhibit other layers.&amp;quot;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::My current implementation uses the opposite order. The high priority levels conduct the simplest behavioural tasks, and when these high priority but simple behavioural levels are happy more complex task can get control. This approach is still experimental, but in any case easy enough to reverse again.&lt;br /&gt;
&lt;br /&gt;
:::The behavioural levels &#039;&#039;all&#039;&#039; compete for control of the robot. Each behavioural layer evaluates its sensory input and determines if it wants to control the outputs (to change its input according to its (implied) goal, e.g. mechanoreceptors (microswitches) will only request control if the switch is closed. After all the behavioural levels are evaluated, and their request flags set or reset an arbitrate routine  selects the highest active layer that will run the robot behaviorual output for the next 50 msec.&lt;br /&gt;
:::See Anderson (2007) for a clear explanations and actual implementation examples.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Brain subsystems&#039;&#039;&#039;&lt;br /&gt;
:::More complicated or slow tasks (like sound processing or US echo detection) can be executed in separate processor boards that report their status  to the main  controller. Conceptually this is not different from subroutines for tasks.&lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Nervous system&#039;&#039;&#039;&lt;br /&gt;
::: The currently (sort of) running implementation of the brain is using a real time loop in a very simple cooperative multitasking system ([https://yiweimao.github.io/blog/async_microcontroller/ YiweiMao scheduler]) and inmplemented on an Arduino Uno &lt;br /&gt;
::: &#039;&#039;Development status: operational, but under active development.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Associative memory&#039;&#039;&#039;&lt;br /&gt;
::: Associative memory in it current, simplest form will be implemented as memory locations for particular sensory input combinations.  inputs that coincide increase a counter for that combination (learning those combinations). This allows both Pawlow  and operand conditioning.&lt;br /&gt;
:::&#039;&#039;Development status: not yet implemented, proof of concept done ~50 years ago :).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Excitation state and hormones&#039;&#039;&#039;&lt;br /&gt;
::: Hormones are internal variables with levels that act as slow changing memory for previous (combinations of) states.&lt;br /&gt;
::: A default breakdown speed can be set that slowly decrease hormone levels. Particular sensory input could increase the levels again. Reaching high levels of certain hormones can be a goal in itself, and subject to learning behaviour.&lt;br /&gt;
::: &#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Satisfaction&#039;&#039;&#039;&lt;br /&gt;
:::Signals to end feeding behaviour can -in addition to electrical food running out- also come from internal signals (satiation, internal hormonal signals, (too) long time periods with little change of events)&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Future prediction&#039;&#039;&#039;&lt;br /&gt;
:::This is currently way out of scope, but neural-net like implementations that store event sequences, predict likely outcomes of current inputs and act accordingly are fully feasible.&lt;br /&gt;
::: See Rickenbacher 1975 for an example that is probably  a bit more traceable than -for instance- modern neural network code like Tensorflow. &lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Effectors ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;main motors&#039;&#039;&#039;&lt;br /&gt;
:::The main moves of the organism are implemented by two wheels driven by two [https://leaphy.store/product/tt-motor-10cm-jumper-female/ DC motors] with build in gearboxes) and a [https://leaphy.store/product/motor-shield/ motor shield]. Motor speed is controlled by pulse width modualation (PMW)) present in the processor. Steering is done by differential motorspeed, a third backside &amp;quot;wheel&amp;quot; is a simple short passive wooden stand. This works well on reasonable flat surfaces, but needs improvement is the next robot (Terzo).&lt;br /&gt;
:::&#039;&#039;Motor development status: Operational at a basic level, PID control and extra power at startup to get smooth startup at low speed is needed.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Movable mouthparts&#039;&#039;&#039;&lt;br /&gt;
:::Appendages like extendable mouthparts controlled by [https://isking-modellbahn.de/modelcraft-es-030-Servo-top-line-steuerelektronik servo]&#039;s can be used for feeding on electrical food. Currently one servo controlling a proboscis (mouthpart for feeding) is present.&lt;br /&gt;
:::&#039;&#039;Development status: Operational in priciple, untested in practice, needs 3D printing of parts&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;[https://leaphy.store/product/rgb-led-single/ Three colour led]&#039;&#039;&#039;&lt;br /&gt;
::: can be used for signaling status of whatever state we want.&lt;br /&gt;
:::&#039;&#039;Development status: Operational &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Piezo beeper &#039;&#039;&#039;&lt;br /&gt;
::: Present on the [https://leaphy.store/product/motor-shield/ motor shield] can be used to create a variety of sounds,for instance to signal happines, distress or alarm.&lt;br /&gt;
:::&#039;&#039;Development status: Operational, but specific sounds need to be designed&lt;br /&gt;
&lt;br /&gt;
== Behavioural levels ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;behaviour in subsumption architecture is organised in levels that compete for control, the highest priority behaviour (lowest rank, top of list) will control the robot for 50 msec &#039;&#039; When lower levels are silent higher levels get control.&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Overview of current behavioral levels and  their most immportant inputs for controlling requests&#039;&#039;&#039;. &lt;br /&gt;
::See the actual calls for details.&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;Layer &amp;quot;distresss&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::If unable to meet the absolute basic requirement for battery voltage or movement CALL for help. In STUCK, try reflexes to get loose, pause regular. If nothing works eventually HIBERNATE &lt;br /&gt;
&lt;br /&gt;
::::Goal:  deal with the really difficult situations &lt;br /&gt;
::::0  HIBERNATE // hope for better times...&lt;br /&gt;
::::1  STUCK // try to solve non-movement when motors run...&lt;br /&gt;
::::2  CALL  // call for help&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;stay free&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::The primary sensory input activating this level are Bumper sensors and Utrasonics, but also hormones for high emotional levels reached by an overlaod of sensory input or a high number of failing tries to reach some goal. Freeze will stop movement for an serious amount of time to reduce overload Fight will move qucikly forward and get very close to an object possily even disregarding US and bumpers and hiting the object Escape will try to free the bumpers Evade will try keep a safe distance from objects Flight will try to run straight for a relative long time (using a countdown timer) but will subsumed by lower levels.&lt;br /&gt;
&lt;br /&gt;
::::Goal: avoid stressors. &lt;br /&gt;
::::3  FREEZE  // simulated dead&lt;br /&gt;
::::4  FIGHT   // Try to intimidiate &lt;br /&gt;
::::5  ESCAPE  // Escape from touch&lt;br /&gt;
::::6  EVADE   // keep distance&lt;br /&gt;
::::7  FLIGHT  // run away  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:: Stay tuned, more comming soon&lt;br /&gt;
&lt;br /&gt;
== Implementation details ==&lt;br /&gt;
: Stay tuned, more comming soon&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Anderson, D.P. (2007)&#039;&#039;&#039; https://www.dprg.org/articles/2007-03a/&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Bettosini et al., 2022&#039;&#039;&#039; Torocó: A Subsumption Architecture Implementation, in: 2022 8th International Conference on Automation, Robotics and Applications (ICARA) IEEE, Prague, Czech Republic, pp. 27–32. . https://doi.org/10.1109/ICARA55094.2022.9738521&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Brooks, R.A. (1986)&#039;&#039;&#039; A Robust Layer Control System for a Mobile Robot, IEEE Journal of Robotics and Automation RA-2, 14-23&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Rickenbacher (1975)&#039;&#039;&#039; Lernen und Motivation als relevanzgesteuerte Datenverarbeitung: Ein Computer-Simulationsmodell elementarer kognitiv-affektiver Prozesse. Birkhäuser Verag Basel.&lt;/div&gt;</summary>
		<author><name>Peterr</name></author>
	</entry>
	<entry>
		<id>https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15287</id>
		<title>Leaphy Robot</title>
		<link rel="alternate" type="text/html" href="https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15287"/>
		<updated>2025-10-01T20:41:05Z</updated>

		<summary type="html">&lt;p&gt;Peterr: /* Behavioural levels */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Name=Leaphy robot with subsumption architecture&lt;br /&gt;
|Skills=software hardware electronics biology&lt;br /&gt;
|Status=Active&lt;br /&gt;
|Niche=robotics&lt;br /&gt;
|Purpose=Fun&lt;br /&gt;
|Picture=Leaphy back side view.jpg&lt;br /&gt;
|Tool=No&lt;br /&gt;
|Location=Space, home&lt;br /&gt;
|Cost=Very small given what is already present and what is available in the space (everything!!)&lt;br /&gt;
|Category=Electronics&lt;br /&gt;
}}&lt;br /&gt;
== Electronic insect-like creature ==&lt;br /&gt;
&#039;&#039;&#039;Physiological, Behavioural and environmental overview&#039;&#039;&#039; &amp;lt;br&amp;gt;&lt;br /&gt;
peterr 2022- 2025 (with &#039;&#039;very&#039;&#039; long pauses)&lt;br /&gt;
&lt;br /&gt;
====Document history====&lt;br /&gt;
* Currently this is a living document and this wiki contains the latest version&lt;br /&gt;
* September 2025 subsumption architecture design &amp;amp; transfer to nurdspace wiki&lt;br /&gt;
* August    2025 Documentation for scheduler&lt;br /&gt;
* March     2023 Draft version 0.2  - terminology cleanup and scope&lt;br /&gt;
* November  2022 First document sketches &amp;amp; ideas&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project==&lt;br /&gt;
The insect like creature based on the original [https://leaphy.store/product/leaphy-original-los/ leaphyrobot] has a set of functionalities that together allow it to effectively find, and feed on targets that provides electricity as a reward.&lt;br /&gt;
Learning strategies to improve success rate can be implemented.&lt;br /&gt;
Sexual signaling, event prediction, mating behaviour, genetic exchange and evolution are in principle possible but are currently still (far) out of scope. The system at it&#039;s highest level can be seen as a feedback loop: sensory input =&amp;gt; behavioural selection =&amp;gt; motor output =&amp;gt; new sensory input. The original design (2022) was meant to live in wind tunnel, and find odour sources to feed, but currently the emphasis has shifted from odour detection to more general sensory processing using subsumption architecture, [https://nurdspace.nl/Leaphy_Robot#Brain see below].&lt;br /&gt;
&lt;br /&gt;
== Sensory inputs ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Mechanoreceptor - sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
:::Micro switch based tactile hairs. &lt;br /&gt;
:::&#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Ultrasound - Distance sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
::: Ultrasonic pulses detect obstacles and trigger reflex avoidance behaviour&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Better directional responses would be possible with more than one US sensor. &lt;br /&gt;
:::: This would need a dedicated embedded processor. &lt;br /&gt;
:::: &#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing light intensity&#039;&#039;&#039;&lt;br /&gt;
::: Two LDR photoreceptors measure front-left light level and front-right light level&lt;br /&gt;
::: Total light intensity (sum) is available as an analog voltage&lt;br /&gt;
::: The difference between the inputs is also available, and signals what side to turn to, to approach or avoid the light.&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing sound (audio)&#039;&#039;&#039;&lt;br /&gt;
::: A subunit with its own processor, containing an Electret microphone to measure ambiant sound level, frequency and sound patterns. &lt;br /&gt;
::: Can be used in classical (Pawlow) and operand conditioning experiments. Will detect both absolute sound levels (for startle or avoidance responses) and can contain feature detectors (e.g. chirp intervals for leaf hopper like  communication and courting  behaviour of two leaphy&#039;s).  &lt;br /&gt;
::: In addition, an Audeme Movi speech recognition shield (see https://www.audeme.com/movi.html) could be used to process voice commands&lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented, but Movi shield &amp;quot;proof of concept&amp;quot; done&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;PIR movement sensor&#039;&#039;&#039;&lt;br /&gt;
::: In addition to light intensity, an infra red motion sensors can be used to detect movements (humans, or the cat for that matter) see for instance https://www.adafruit.com/product/4871 &lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented but PIR (similar to the adafruit thingy) available&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Sensing wind direction &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based tactile hairs?  Something like https://www.instructables.com/Low-Cost-Low-Speed-Wind-Sensor-1/ with shielding? or sensitive temperature measurements?&lt;br /&gt;
:::; Note: Wind direction sensing in the wind tunnel is currently replaced by sensing light gradients parallel to the wind direction because the wind sensor is not available yet. &lt;br /&gt;
:::: &#039;&#039;Development status: To be designed, high priority for the windtunnel version with odour processing as a main goal, low priority for the a free walking space/nurdspace version described here.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Volatiles (odours) &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based perception of volatiles like alcohol (fruit-fly like behaviours), Carbon dioxide (mosquito like behaviour), or VOC&#039;s (most plant eating insects). The sensor produces a voltage level proportional to the intensity of the stimulus. Using a threshold can generate a presence/absence signal. &lt;br /&gt;
::: The interval between odour pulses is a proxy for the distance to the source. Note that an odour &amp;quot;gradient&amp;quot; does not exist!&lt;br /&gt;
&lt;br /&gt;
::: Current implementation uses a SGP30 board. The time constant of the the sensor is in the order of 1 second, but &amp;quot;whiffs&amp;quot; of odour could be detected faster by using a feature detector that looks for sudden steps in the signal. This will also act as an sensory adaptation mechanism: in the absence of change the output go&#039;s to zero.&lt;br /&gt;
::: &#039;&#039;Development status: Sensor: worked, currently broken&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground color&#039;&#039;&#039;&lt;br /&gt;
::: This sensor measures ground colour and the output can be used to test for a particular condition (e.g. being at a target position). It can also be used to simulate trail pheromones implemented as colors next to the  trail followed. This sense can also take the role of short distance &amp;quot; present at target&amp;quot; stimuli.&lt;br /&gt;
::: &#039;&#039; Development status: Operational &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground reflection level&#039;&#039;&#039;&lt;br /&gt;
::: Two sensors &#039;line followers&#039; that both provide a binary present/absent signal of ground reflection.&lt;br /&gt;
::: Can be used to simulate trail following behaviour on a network of lines  (combined with (led) ground colours.&lt;br /&gt;
::: &#039;&#039;Development status: testing phase&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Future extensions: A combination of voltage levels and pulse frequency coding in the source could be used to simulate a spectrum of &amp;quot;chemical&amp;quot; inputs.  &lt;br /&gt;
:::: Feature detectors could extract particular frequencies and/or patterns to recognise for instance &amp;quot;&#039;&#039;toxic&#039;&#039;&amp;quot; substances. &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Proprioception (internal &amp;quot;feeling&amp;quot;)&#039;&#039;&#039;&lt;br /&gt;
::: Checking for instance for body movement when motors move, or for force feedback when extending electrical honey sucking mouthparts&lt;br /&gt;
::: Development status:To be developed, as yet low priority. &lt;br /&gt;
 &lt;br /&gt;
:: &#039;&#039;&#039;Sensing internal physiological states &#039;&#039;&#039;&lt;br /&gt;
:::To place electric reward information in perspective, some internal status information is needed, that is supplied by reading internal variables like energy levels (battery voltage , load current) or physiological state (internal variables like &amp;quot;ready to feed&amp;quot;. &lt;br /&gt;
::: More advances implementations could look up previous experiences, and rate of change in physiological status as well as brain hormone levels and excitation states (see below under internal states and hormones&amp;quot;).&lt;br /&gt;
:::Development status: To be designed.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing hormone levels&#039;&#039;&#039;&lt;br /&gt;
::: Certain activities or combinations of activities can stimulate the production of hormones. This could be implemented as slow changing values in memory. Hormone levels might modulate the effect of sensory input or behavioural output, and act as a slow form of memory.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing rewards and deterrents&#039;&#039;&#039;&lt;br /&gt;
::: Electronic organisms live on electricity, and are rewarded by sensing the presence of a voltage and current. This sensory organ is just sensing the analog voltage measured by the sensory organ. It simulates the perception of food such as nectar. Most logical position is at the tip of an appendage. &lt;br /&gt;
::: &#039;&#039;Development status: implemented and removed (needs mutiplexing). Mechanical movement (servo) to make electrical contact: testing phase.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Brain ==&lt;br /&gt;
::&#039;&#039;&#039;Subsumption architecture&#039;&#039;&#039;&lt;br /&gt;
:::The Electronic organisms has a software brain that receives sensory input both from the environment and internal status. The brain reads all inputs about every 50 msec, and produces command for actuators that produce behaviour. These behaviours can be as simple as a colour changes of a led (signaling sensory status) or movements of body and body and appendages. The aim is to make the lower levels as stateless as possible i.e. the brain uses its real time vision of the word as a model instead of some abstract internal representation. The processing principle roughly follow the subsumption architecture (Brooks 1986).&lt;br /&gt;
&lt;br /&gt;
:::Wikipedia writes about this technique:&lt;br /&gt;
::::&amp;quot;&#039;&#039;[Behaviours] are organized into a hierarchy of layers. Each layer implements a particular level of behavioral competence, and higher levels are able to subsume lower levels (= integrate/combine lower levels to a more comprehensive whole) in order to create viable behavior. For example, a robot&#039;s lowest layer could be &amp;quot;avoid an object&amp;quot;. The second layer would be &amp;quot;wander around&amp;quot;, which runs beneath the third layer &amp;quot;explore the world&amp;quot;.[...]The subsumption architecture creates a system in which the higher layers utilize the lower-level competencies. The layers, which all receive sensor-information, work in parallel and generate outputs. These outputs can be commands to actuators, or signals that suppress or inhibit other layers.&amp;quot;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::My current implementation uses the opposite order. The high priority levels conduct the simplest behavioural tasks, and when these high priority but simple behavioural levels are happy more complex task can get control. This approach is still experimental, but in any case easy enough to reverse again.&lt;br /&gt;
&lt;br /&gt;
:::The behavioural levels &#039;&#039;all&#039;&#039; compete for control of the robot. Each behavioural layer evaluates its sensory input and determines if it wants to control the outputs (to change its input according to its (implied) goal, e.g. mechanoreceptors (microswitches) will only request control if the switch is closed. After all the behavioural levels are evaluated, and their request flags set or reset an arbitrate routine  selects the highest active layer that will run the robot behaviorual output for the next 50 msec.&lt;br /&gt;
:::See Anderson (2007) for a clear explanations and actual implementation examples.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Brain subsystems&#039;&#039;&#039;&lt;br /&gt;
:::More complicated or slow tasks (like sound processing or US echo detection) can be executed in separate processor boards that report their status  to the main  controller. Conceptually this is not different from subroutines for tasks.&lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Nervous system&#039;&#039;&#039;&lt;br /&gt;
::: The currently (sort of) running implementation of the brain is using a real time loop in a very simple cooperative multitasking system ([https://yiweimao.github.io/blog/async_microcontroller/ YiweiMao scheduler]) and inmplemented on an Arduino Uno &lt;br /&gt;
::: &#039;&#039;Development status: operational, but under active development.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Associative memory&#039;&#039;&#039;&lt;br /&gt;
::: Associative memory in it current, simplest form will be implemented as memory locations for particular sensory input combinations.  inputs that coincide increase a counter for that combination (learning those combinations). This allows both Pawlow  and operand conditioning.&lt;br /&gt;
:::&#039;&#039;Development status: not yet implemented, proof of concept done ~50 years ago :).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Excitation state and hormones&#039;&#039;&#039;&lt;br /&gt;
::: Hormones are internal variables with levels that act as slow changing memory for previous (combinations of) states.&lt;br /&gt;
::: A default breakdown speed can be set that slowly decrease hormone levels. Particular sensory input could increase the levels again. Reaching high levels of certain hormones can be a goal in itself, and subject to learning behaviour.&lt;br /&gt;
::: &#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Satisfaction&#039;&#039;&#039;&lt;br /&gt;
:::Signals to end feeding behaviour can -in addition to electrical food running out- also come from internal signals (satiation, internal hormonal signals, (too) long time periods with little change of events)&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Future prediction&#039;&#039;&#039;&lt;br /&gt;
:::This is currently way out of scope, but neural-net like implementations that store event sequences, predict likely outcomes of current inputs and act accordingly are fully feasible.&lt;br /&gt;
::: See Rickenbacher 1975 for an example that is probably  a bit more traceable than -for instance- modern neural network code like Tensorflow. &lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Effectors ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;main motors&#039;&#039;&#039;&lt;br /&gt;
:::The main moves of the organism are implemented by two wheels driven by two [https://leaphy.store/product/tt-motor-10cm-jumper-female/ DC motors] with build in gearboxes) and a [https://leaphy.store/product/motor-shield/ motor shield]. Motor speed is controlled by pulse width modualation (PMW)) present in the processor. Steering is done by differential motorspeed, a third backside &amp;quot;wheel&amp;quot; is a simple short passive wooden stand. This works well on reasonable flat surfaces, but needs improvement is the next robot (Terzo).&lt;br /&gt;
:::&#039;&#039;Motor development status: Operational at a basic level, PID control and extra power at startup to get smooth startup at low speed is needed.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Movable mouthparts&#039;&#039;&#039;&lt;br /&gt;
:::Appendages like extendable mouthparts controlled by [https://isking-modellbahn.de/modelcraft-es-030-Servo-top-line-steuerelektronik servo]&#039;s can be used for feeding on electrical food. Currently one servo controlling a proboscis (mouthpart for feeding) is present.&lt;br /&gt;
:::&#039;&#039;Development status: Operational in priciple, untested in practice, needs 3D printing of parts&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;[https://leaphy.store/product/rgb-led-single/ Three colour led]&#039;&#039;&#039;&lt;br /&gt;
::: can be used for signaling status of whatever state we want.&lt;br /&gt;
:::&#039;&#039;Development status: Operational &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Piezo beeper &#039;&#039;&#039;&lt;br /&gt;
::: Present on the [https://leaphy.store/product/motor-shield/ motor shield] can be used to create a variety of sounds,for instance to signal happines, distress or alarm.&lt;br /&gt;
:::&#039;&#039;Development status: Operational, but specific sounds need to be designed&lt;br /&gt;
&lt;br /&gt;
== Behavioural levels ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;behaviour in subsumption architecture is organised in levels that compete for control, the highest priority behaviour will control the robot for 50 msec &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Overview of current behavioral levels and  their most immportant inputs for controlling requests&#039;&#039;&#039;. &lt;br /&gt;
::See the actual calls for details.&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;Layer &amp;quot;distresss&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::If unable to meet the absolute basic requirement for battery voltage or movement CALL for help. In STUCK, try reflexes to get loose, pause regular. If nothing works eventually HIBERNATE &lt;br /&gt;
&lt;br /&gt;
::::Goal:  deal with the really difficult situations &lt;br /&gt;
::::0  HIBERNATE // hope for better times...&lt;br /&gt;
::::1  STUCK // try to solve non-movement when motors run...&lt;br /&gt;
::::2  CALL  // call for help&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;layer &amp;quot;stay free&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::The primary sensory input activating this level are Bumper sensors and Utrasonics, but also hormones for high emotional levels reached by an overlaod of sensory input or a high number of failing tries to reach some goal. Freeze will stop movement for an serious amount of time to reduce overload Fight will move qucikly forward and get very close to an object possily even disregarding US and bumpers and hiting the object Escape will try to free the bumpers Evade will try keep a safe distance from objects Flight will try to run straight for a relative long time (using a countdown timer) but will subsumed by lower levels.&lt;br /&gt;
&lt;br /&gt;
::::Goal: avoid stressors. &lt;br /&gt;
::::3  FREEZE  // simulated dead&lt;br /&gt;
::::4  FIGHT   // Try to intimidiate &lt;br /&gt;
::::5  ESCAPE  // Escape from touch&lt;br /&gt;
::::6  EVADE   // keep distance&lt;br /&gt;
::::7  FLIGHT  // run away  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:: Stay tuned, more comming soon&lt;br /&gt;
&lt;br /&gt;
== Implementation details ==&lt;br /&gt;
: Stay tuned, more comming soon&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Anderson, D.P. (2007)&#039;&#039;&#039; https://www.dprg.org/articles/2007-03a/&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Bettosini et al., 2022&#039;&#039;&#039; Torocó: A Subsumption Architecture Implementation, in: 2022 8th International Conference on Automation, Robotics and Applications (ICARA) IEEE, Prague, Czech Republic, pp. 27–32. . https://doi.org/10.1109/ICARA55094.2022.9738521&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Brooks, R.A. (1986)&#039;&#039;&#039; A Robust Layer Control System for a Mobile Robot, IEEE Journal of Robotics and Automation RA-2, 14-23&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Rickenbacher (1975)&#039;&#039;&#039; Lernen und Motivation als relevanzgesteuerte Datenverarbeitung: Ein Computer-Simulationsmodell elementarer kognitiv-affektiver Prozesse. Birkhäuser Verag Basel.&lt;/div&gt;</summary>
		<author><name>Peterr</name></author>
	</entry>
	<entry>
		<id>https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15286</id>
		<title>Leaphy Robot</title>
		<link rel="alternate" type="text/html" href="https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15286"/>
		<updated>2025-10-01T20:36:28Z</updated>

		<summary type="html">&lt;p&gt;Peterr: /* Behavioural levels */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Name=Leaphy robot with subsumption architecture&lt;br /&gt;
|Skills=software hardware electronics biology&lt;br /&gt;
|Status=Active&lt;br /&gt;
|Niche=robotics&lt;br /&gt;
|Purpose=Fun&lt;br /&gt;
|Picture=Leaphy back side view.jpg&lt;br /&gt;
|Tool=No&lt;br /&gt;
|Location=Space, home&lt;br /&gt;
|Cost=Very small given what is already present and what is available in the space (everything!!)&lt;br /&gt;
|Category=Electronics&lt;br /&gt;
}}&lt;br /&gt;
== Electronic insect-like creature ==&lt;br /&gt;
&#039;&#039;&#039;Physiological, Behavioural and environmental overview&#039;&#039;&#039; &amp;lt;br&amp;gt;&lt;br /&gt;
peterr 2022- 2025 (with &#039;&#039;very&#039;&#039; long pauses)&lt;br /&gt;
&lt;br /&gt;
====Document history====&lt;br /&gt;
* Currently this is a living document and this wiki contains the latest version&lt;br /&gt;
* September 2025 subsumption architecture design &amp;amp; transfer to nurdspace wiki&lt;br /&gt;
* August    2025 Documentation for scheduler&lt;br /&gt;
* March     2023 Draft version 0.2  - terminology cleanup and scope&lt;br /&gt;
* November  2022 First document sketches &amp;amp; ideas&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project==&lt;br /&gt;
The insect like creature based on the original [https://leaphy.store/product/leaphy-original-los/ leaphyrobot] has a set of functionalities that together allow it to effectively find, and feed on targets that provides electricity as a reward.&lt;br /&gt;
Learning strategies to improve success rate can be implemented.&lt;br /&gt;
Sexual signaling, event prediction, mating behaviour, genetic exchange and evolution are in principle possible but are currently still (far) out of scope. The system at it&#039;s highest level can be seen as a feedback loop: sensory input =&amp;gt; behavioural selection =&amp;gt; motor output =&amp;gt; new sensory input. The original design (2022) was meant to live in wind tunnel, and find odour sources to feed, but currently the emphasis has shifted from odour detection to more general sensory processing using subsumption architecture, [https://nurdspace.nl/Leaphy_Robot#Brain see below].&lt;br /&gt;
&lt;br /&gt;
== Sensory inputs ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Mechanoreceptor - sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
:::Micro switch based tactile hairs. &lt;br /&gt;
:::&#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Ultrasound - Distance sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
::: Ultrasonic pulses detect obstacles and trigger reflex avoidance behaviour&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Better directional responses would be possible with more than one US sensor. &lt;br /&gt;
:::: This would need a dedicated embedded processor. &lt;br /&gt;
:::: &#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing light intensity&#039;&#039;&#039;&lt;br /&gt;
::: Two LDR photoreceptors measure front-left light level and front-right light level&lt;br /&gt;
::: Total light intensity (sum) is available as an analog voltage&lt;br /&gt;
::: The difference between the inputs is also available, and signals what side to turn to, to approach or avoid the light.&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing sound (audio)&#039;&#039;&#039;&lt;br /&gt;
::: A subunit with its own processor, containing an Electret microphone to measure ambiant sound level, frequency and sound patterns. &lt;br /&gt;
::: Can be used in classical (Pawlow) and operand conditioning experiments. Will detect both absolute sound levels (for startle or avoidance responses) and can contain feature detectors (e.g. chirp intervals for leaf hopper like  communication and courting  behaviour of two leaphy&#039;s).  &lt;br /&gt;
::: In addition, an Audeme Movi speech recognition shield (see https://www.audeme.com/movi.html) could be used to process voice commands&lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented, but Movi shield &amp;quot;proof of concept&amp;quot; done&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;PIR movement sensor&#039;&#039;&#039;&lt;br /&gt;
::: In addition to light intensity, an infra red motion sensors can be used to detect movements (humans, or the cat for that matter) see for instance https://www.adafruit.com/product/4871 &lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented but PIR (similar to the adafruit thingy) available&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Sensing wind direction &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based tactile hairs?  Something like https://www.instructables.com/Low-Cost-Low-Speed-Wind-Sensor-1/ with shielding? or sensitive temperature measurements?&lt;br /&gt;
:::; Note: Wind direction sensing in the wind tunnel is currently replaced by sensing light gradients parallel to the wind direction because the wind sensor is not available yet. &lt;br /&gt;
:::: &#039;&#039;Development status: To be designed, high priority for the windtunnel version with odour processing as a main goal, low priority for the a free walking space/nurdspace version described here.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Volatiles (odours) &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based perception of volatiles like alcohol (fruit-fly like behaviours), Carbon dioxide (mosquito like behaviour), or VOC&#039;s (most plant eating insects). The sensor produces a voltage level proportional to the intensity of the stimulus. Using a threshold can generate a presence/absence signal. &lt;br /&gt;
::: The interval between odour pulses is a proxy for the distance to the source. Note that an odour &amp;quot;gradient&amp;quot; does not exist!&lt;br /&gt;
&lt;br /&gt;
::: Current implementation uses a SGP30 board. The time constant of the the sensor is in the order of 1 second, but &amp;quot;whiffs&amp;quot; of odour could be detected faster by using a feature detector that looks for sudden steps in the signal. This will also act as an sensory adaptation mechanism: in the absence of change the output go&#039;s to zero.&lt;br /&gt;
::: &#039;&#039;Development status: Sensor: worked, currently broken&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground color&#039;&#039;&#039;&lt;br /&gt;
::: This sensor measures ground colour and the output can be used to test for a particular condition (e.g. being at a target position). It can also be used to simulate trail pheromones implemented as colors next to the  trail followed. This sense can also take the role of short distance &amp;quot; present at target&amp;quot; stimuli.&lt;br /&gt;
::: &#039;&#039; Development status: Operational &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground reflection level&#039;&#039;&#039;&lt;br /&gt;
::: Two sensors &#039;line followers&#039; that both provide a binary present/absent signal of ground reflection.&lt;br /&gt;
::: Can be used to simulate trail following behaviour on a network of lines  (combined with (led) ground colours.&lt;br /&gt;
::: &#039;&#039;Development status: testing phase&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Future extensions: A combination of voltage levels and pulse frequency coding in the source could be used to simulate a spectrum of &amp;quot;chemical&amp;quot; inputs.  &lt;br /&gt;
:::: Feature detectors could extract particular frequencies and/or patterns to recognise for instance &amp;quot;&#039;&#039;toxic&#039;&#039;&amp;quot; substances. &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Proprioception (internal &amp;quot;feeling&amp;quot;)&#039;&#039;&#039;&lt;br /&gt;
::: Checking for instance for body movement when motors move, or for force feedback when extending electrical honey sucking mouthparts&lt;br /&gt;
::: Development status:To be developed, as yet low priority. &lt;br /&gt;
 &lt;br /&gt;
:: &#039;&#039;&#039;Sensing internal physiological states &#039;&#039;&#039;&lt;br /&gt;
:::To place electric reward information in perspective, some internal status information is needed, that is supplied by reading internal variables like energy levels (battery voltage , load current) or physiological state (internal variables like &amp;quot;ready to feed&amp;quot;. &lt;br /&gt;
::: More advances implementations could look up previous experiences, and rate of change in physiological status as well as brain hormone levels and excitation states (see below under internal states and hormones&amp;quot;).&lt;br /&gt;
:::Development status: To be designed.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing hormone levels&#039;&#039;&#039;&lt;br /&gt;
::: Certain activities or combinations of activities can stimulate the production of hormones. This could be implemented as slow changing values in memory. Hormone levels might modulate the effect of sensory input or behavioural output, and act as a slow form of memory.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing rewards and deterrents&#039;&#039;&#039;&lt;br /&gt;
::: Electronic organisms live on electricity, and are rewarded by sensing the presence of a voltage and current. This sensory organ is just sensing the analog voltage measured by the sensory organ. It simulates the perception of food such as nectar. Most logical position is at the tip of an appendage. &lt;br /&gt;
::: &#039;&#039;Development status: implemented and removed (needs mutiplexing). Mechanical movement (servo) to make electrical contact: testing phase.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Brain ==&lt;br /&gt;
::&#039;&#039;&#039;Subsumption architecture&#039;&#039;&#039;&lt;br /&gt;
:::The Electronic organisms has a software brain that receives sensory input both from the environment and internal status. The brain reads all inputs about every 50 msec, and produces command for actuators that produce behaviour. These behaviours can be as simple as a colour changes of a led (signaling sensory status) or movements of body and body and appendages. The aim is to make the lower levels as stateless as possible i.e. the brain uses its real time vision of the word as a model instead of some abstract internal representation. The processing principle roughly follow the subsumption architecture (Brooks 1986).&lt;br /&gt;
&lt;br /&gt;
:::Wikipedia writes about this technique:&lt;br /&gt;
::::&amp;quot;&#039;&#039;[Behaviours] are organized into a hierarchy of layers. Each layer implements a particular level of behavioral competence, and higher levels are able to subsume lower levels (= integrate/combine lower levels to a more comprehensive whole) in order to create viable behavior. For example, a robot&#039;s lowest layer could be &amp;quot;avoid an object&amp;quot;. The second layer would be &amp;quot;wander around&amp;quot;, which runs beneath the third layer &amp;quot;explore the world&amp;quot;.[...]The subsumption architecture creates a system in which the higher layers utilize the lower-level competencies. The layers, which all receive sensor-information, work in parallel and generate outputs. These outputs can be commands to actuators, or signals that suppress or inhibit other layers.&amp;quot;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::My current implementation uses the opposite order. The high priority levels conduct the simplest behavioural tasks, and when these high priority but simple behavioural levels are happy more complex task can get control. This approach is still experimental, but in any case easy enough to reverse again.&lt;br /&gt;
&lt;br /&gt;
:::The behavioural levels &#039;&#039;all&#039;&#039; compete for control of the robot. Each behavioural layer evaluates its sensory input and determines if it wants to control the outputs (to change its input according to its (implied) goal, e.g. mechanoreceptors (microswitches) will only request control if the switch is closed. After all the behavioural levels are evaluated, and their request flags set or reset an arbitrate routine  selects the highest active layer that will run the robot behaviorual output for the next 50 msec.&lt;br /&gt;
:::See Anderson (2007) for a clear explanations and actual implementation examples.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Brain subsystems&#039;&#039;&#039;&lt;br /&gt;
:::More complicated or slow tasks (like sound processing or US echo detection) can be executed in separate processor boards that report their status  to the main  controller. Conceptually this is not different from subroutines for tasks.&lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Nervous system&#039;&#039;&#039;&lt;br /&gt;
::: The currently (sort of) running implementation of the brain is using a real time loop in a very simple cooperative multitasking system ([https://yiweimao.github.io/blog/async_microcontroller/ YiweiMao scheduler]) and inmplemented on an Arduino Uno &lt;br /&gt;
::: &#039;&#039;Development status: operational, but under active development.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Associative memory&#039;&#039;&#039;&lt;br /&gt;
::: Associative memory in it current, simplest form will be implemented as memory locations for particular sensory input combinations.  inputs that coincide increase a counter for that combination (learning those combinations). This allows both Pawlow  and operand conditioning.&lt;br /&gt;
:::&#039;&#039;Development status: not yet implemented, proof of concept done ~50 years ago :).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Excitation state and hormones&#039;&#039;&#039;&lt;br /&gt;
::: Hormones are internal variables with levels that act as slow changing memory for previous (combinations of) states.&lt;br /&gt;
::: A default breakdown speed can be set that slowly decrease hormone levels. Particular sensory input could increase the levels again. Reaching high levels of certain hormones can be a goal in itself, and subject to learning behaviour.&lt;br /&gt;
::: &#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Satisfaction&#039;&#039;&#039;&lt;br /&gt;
:::Signals to end feeding behaviour can -in addition to electrical food running out- also come from internal signals (satiation, internal hormonal signals, (too) long time periods with little change of events)&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Future prediction&#039;&#039;&#039;&lt;br /&gt;
:::This is currently way out of scope, but neural-net like implementations that store event sequences, predict likely outcomes of current inputs and act accordingly are fully feasible.&lt;br /&gt;
::: See Rickenbacher 1975 for an example that is probably  a bit more traceable than -for instance- modern neural network code like Tensorflow. &lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Effectors ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;main motors&#039;&#039;&#039;&lt;br /&gt;
:::The main moves of the organism are implemented by two wheels driven by two [https://leaphy.store/product/tt-motor-10cm-jumper-female/ DC motors] with build in gearboxes) and a [https://leaphy.store/product/motor-shield/ motor shield]. Motor speed is controlled by pulse width modualation (PMW)) present in the processor. Steering is done by differential motorspeed, a third backside &amp;quot;wheel&amp;quot; is a simple short passive wooden stand. This works well on reasonable flat surfaces, but needs improvement is the next robot (Terzo).&lt;br /&gt;
:::&#039;&#039;Motor development status: Operational at a basic level, PID control and extra power at startup to get smooth startup at low speed is needed.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Movable mouthparts&#039;&#039;&#039;&lt;br /&gt;
:::Appendages like extendable mouthparts controlled by [https://isking-modellbahn.de/modelcraft-es-030-Servo-top-line-steuerelektronik servo]&#039;s can be used for feeding on electrical food. Currently one servo controlling a proboscis (mouthpart for feeding) is present.&lt;br /&gt;
:::&#039;&#039;Development status: Operational in priciple, untested in practice, needs 3D printing of parts&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;[https://leaphy.store/product/rgb-led-single/ Three colour led]&#039;&#039;&#039;&lt;br /&gt;
::: can be used for signaling status of whatever state we want.&lt;br /&gt;
:::&#039;&#039;Development status: Operational &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Piezo beeper &#039;&#039;&#039;&lt;br /&gt;
::: Present on the [https://leaphy.store/product/motor-shield/ motor shield] can be used to create a variety of sounds,for instance to signal happines, distress or alarm.&lt;br /&gt;
:::&#039;&#039;Development status: Operational, but specific sounds need to be designed&lt;br /&gt;
&lt;br /&gt;
== Behavioural levels ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;behaviour in subsumption architecture is organised in levels that compete for control, the highest priority behaviour will control the robot for 50 msec &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Overview of current behavioral levels and  their most immportant inputs for controlling requests&#039;&#039;&#039;. &lt;br /&gt;
::See the actual calls for details.&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;Layer &amp;quot;distresss&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
:::If unable to meet the absolute basic requirement for battery voltage or movement CALL for help. In STUCK, try reflexes to get loose, pause regular. If nothing works eventually HIBERNATE &lt;br /&gt;
&lt;br /&gt;
::::Goal:  deal with the really difficult situations &lt;br /&gt;
::::0  HIBERNATE // hope for better times...&lt;br /&gt;
::::1  STUCK // try to solve non-movement when motors run...&lt;br /&gt;
::::2  CALL  // call for help&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:: Stay tuned, more comming soon&lt;br /&gt;
&lt;br /&gt;
== Implementation details ==&lt;br /&gt;
: Stay tuned, more comming soon&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Anderson, D.P. (2007)&#039;&#039;&#039; https://www.dprg.org/articles/2007-03a/&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Bettosini et al., 2022&#039;&#039;&#039; Torocó: A Subsumption Architecture Implementation, in: 2022 8th International Conference on Automation, Robotics and Applications (ICARA) IEEE, Prague, Czech Republic, pp. 27–32. . https://doi.org/10.1109/ICARA55094.2022.9738521&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Brooks, R.A. (1986)&#039;&#039;&#039; A Robust Layer Control System for a Mobile Robot, IEEE Journal of Robotics and Automation RA-2, 14-23&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Rickenbacher (1975)&#039;&#039;&#039; Lernen und Motivation als relevanzgesteuerte Datenverarbeitung: Ein Computer-Simulationsmodell elementarer kognitiv-affektiver Prozesse. Birkhäuser Verag Basel.&lt;/div&gt;</summary>
		<author><name>Peterr</name></author>
	</entry>
	<entry>
		<id>https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15285</id>
		<title>Leaphy Robot</title>
		<link rel="alternate" type="text/html" href="https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15285"/>
		<updated>2025-10-01T20:35:24Z</updated>

		<summary type="html">&lt;p&gt;Peterr: /* Behavioural levels */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Name=Leaphy robot with subsumption architecture&lt;br /&gt;
|Skills=software hardware electronics biology&lt;br /&gt;
|Status=Active&lt;br /&gt;
|Niche=robotics&lt;br /&gt;
|Purpose=Fun&lt;br /&gt;
|Picture=Leaphy back side view.jpg&lt;br /&gt;
|Tool=No&lt;br /&gt;
|Location=Space, home&lt;br /&gt;
|Cost=Very small given what is already present and what is available in the space (everything!!)&lt;br /&gt;
|Category=Electronics&lt;br /&gt;
}}&lt;br /&gt;
== Electronic insect-like creature ==&lt;br /&gt;
&#039;&#039;&#039;Physiological, Behavioural and environmental overview&#039;&#039;&#039; &amp;lt;br&amp;gt;&lt;br /&gt;
peterr 2022- 2025 (with &#039;&#039;very&#039;&#039; long pauses)&lt;br /&gt;
&lt;br /&gt;
====Document history====&lt;br /&gt;
* Currently this is a living document and this wiki contains the latest version&lt;br /&gt;
* September 2025 subsumption architecture design &amp;amp; transfer to nurdspace wiki&lt;br /&gt;
* August    2025 Documentation for scheduler&lt;br /&gt;
* March     2023 Draft version 0.2  - terminology cleanup and scope&lt;br /&gt;
* November  2022 First document sketches &amp;amp; ideas&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project==&lt;br /&gt;
The insect like creature based on the original [https://leaphy.store/product/leaphy-original-los/ leaphyrobot] has a set of functionalities that together allow it to effectively find, and feed on targets that provides electricity as a reward.&lt;br /&gt;
Learning strategies to improve success rate can be implemented.&lt;br /&gt;
Sexual signaling, event prediction, mating behaviour, genetic exchange and evolution are in principle possible but are currently still (far) out of scope. The system at it&#039;s highest level can be seen as a feedback loop: sensory input =&amp;gt; behavioural selection =&amp;gt; motor output =&amp;gt; new sensory input. The original design (2022) was meant to live in wind tunnel, and find odour sources to feed, but currently the emphasis has shifted from odour detection to more general sensory processing using subsumption architecture, [https://nurdspace.nl/Leaphy_Robot#Brain see below].&lt;br /&gt;
&lt;br /&gt;
== Sensory inputs ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Mechanoreceptor - sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
:::Micro switch based tactile hairs. &lt;br /&gt;
:::&#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Ultrasound - Distance sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
::: Ultrasonic pulses detect obstacles and trigger reflex avoidance behaviour&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Better directional responses would be possible with more than one US sensor. &lt;br /&gt;
:::: This would need a dedicated embedded processor. &lt;br /&gt;
:::: &#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing light intensity&#039;&#039;&#039;&lt;br /&gt;
::: Two LDR photoreceptors measure front-left light level and front-right light level&lt;br /&gt;
::: Total light intensity (sum) is available as an analog voltage&lt;br /&gt;
::: The difference between the inputs is also available, and signals what side to turn to, to approach or avoid the light.&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing sound (audio)&#039;&#039;&#039;&lt;br /&gt;
::: A subunit with its own processor, containing an Electret microphone to measure ambiant sound level, frequency and sound patterns. &lt;br /&gt;
::: Can be used in classical (Pawlow) and operand conditioning experiments. Will detect both absolute sound levels (for startle or avoidance responses) and can contain feature detectors (e.g. chirp intervals for leaf hopper like  communication and courting  behaviour of two leaphy&#039;s).  &lt;br /&gt;
::: In addition, an Audeme Movi speech recognition shield (see https://www.audeme.com/movi.html) could be used to process voice commands&lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented, but Movi shield &amp;quot;proof of concept&amp;quot; done&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;PIR movement sensor&#039;&#039;&#039;&lt;br /&gt;
::: In addition to light intensity, an infra red motion sensors can be used to detect movements (humans, or the cat for that matter) see for instance https://www.adafruit.com/product/4871 &lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented but PIR (similar to the adafruit thingy) available&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Sensing wind direction &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based tactile hairs?  Something like https://www.instructables.com/Low-Cost-Low-Speed-Wind-Sensor-1/ with shielding? or sensitive temperature measurements?&lt;br /&gt;
:::; Note: Wind direction sensing in the wind tunnel is currently replaced by sensing light gradients parallel to the wind direction because the wind sensor is not available yet. &lt;br /&gt;
:::: &#039;&#039;Development status: To be designed, high priority for the windtunnel version with odour processing as a main goal, low priority for the a free walking space/nurdspace version described here.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Volatiles (odours) &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based perception of volatiles like alcohol (fruit-fly like behaviours), Carbon dioxide (mosquito like behaviour), or VOC&#039;s (most plant eating insects). The sensor produces a voltage level proportional to the intensity of the stimulus. Using a threshold can generate a presence/absence signal. &lt;br /&gt;
::: The interval between odour pulses is a proxy for the distance to the source. Note that an odour &amp;quot;gradient&amp;quot; does not exist!&lt;br /&gt;
&lt;br /&gt;
::: Current implementation uses a SGP30 board. The time constant of the the sensor is in the order of 1 second, but &amp;quot;whiffs&amp;quot; of odour could be detected faster by using a feature detector that looks for sudden steps in the signal. This will also act as an sensory adaptation mechanism: in the absence of change the output go&#039;s to zero.&lt;br /&gt;
::: &#039;&#039;Development status: Sensor: worked, currently broken&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground color&#039;&#039;&#039;&lt;br /&gt;
::: This sensor measures ground colour and the output can be used to test for a particular condition (e.g. being at a target position). It can also be used to simulate trail pheromones implemented as colors next to the  trail followed. This sense can also take the role of short distance &amp;quot; present at target&amp;quot; stimuli.&lt;br /&gt;
::: &#039;&#039; Development status: Operational &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground reflection level&#039;&#039;&#039;&lt;br /&gt;
::: Two sensors &#039;line followers&#039; that both provide a binary present/absent signal of ground reflection.&lt;br /&gt;
::: Can be used to simulate trail following behaviour on a network of lines  (combined with (led) ground colours.&lt;br /&gt;
::: &#039;&#039;Development status: testing phase&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Future extensions: A combination of voltage levels and pulse frequency coding in the source could be used to simulate a spectrum of &amp;quot;chemical&amp;quot; inputs.  &lt;br /&gt;
:::: Feature detectors could extract particular frequencies and/or patterns to recognise for instance &amp;quot;&#039;&#039;toxic&#039;&#039;&amp;quot; substances. &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Proprioception (internal &amp;quot;feeling&amp;quot;)&#039;&#039;&#039;&lt;br /&gt;
::: Checking for instance for body movement when motors move, or for force feedback when extending electrical honey sucking mouthparts&lt;br /&gt;
::: Development status:To be developed, as yet low priority. &lt;br /&gt;
 &lt;br /&gt;
:: &#039;&#039;&#039;Sensing internal physiological states &#039;&#039;&#039;&lt;br /&gt;
:::To place electric reward information in perspective, some internal status information is needed, that is supplied by reading internal variables like energy levels (battery voltage , load current) or physiological state (internal variables like &amp;quot;ready to feed&amp;quot;. &lt;br /&gt;
::: More advances implementations could look up previous experiences, and rate of change in physiological status as well as brain hormone levels and excitation states (see below under internal states and hormones&amp;quot;).&lt;br /&gt;
:::Development status: To be designed.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing hormone levels&#039;&#039;&#039;&lt;br /&gt;
::: Certain activities or combinations of activities can stimulate the production of hormones. This could be implemented as slow changing values in memory. Hormone levels might modulate the effect of sensory input or behavioural output, and act as a slow form of memory.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing rewards and deterrents&#039;&#039;&#039;&lt;br /&gt;
::: Electronic organisms live on electricity, and are rewarded by sensing the presence of a voltage and current. This sensory organ is just sensing the analog voltage measured by the sensory organ. It simulates the perception of food such as nectar. Most logical position is at the tip of an appendage. &lt;br /&gt;
::: &#039;&#039;Development status: implemented and removed (needs mutiplexing). Mechanical movement (servo) to make electrical contact: testing phase.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Brain ==&lt;br /&gt;
::&#039;&#039;&#039;Subsumption architecture&#039;&#039;&#039;&lt;br /&gt;
:::The Electronic organisms has a software brain that receives sensory input both from the environment and internal status. The brain reads all inputs about every 50 msec, and produces command for actuators that produce behaviour. These behaviours can be as simple as a colour changes of a led (signaling sensory status) or movements of body and body and appendages. The aim is to make the lower levels as stateless as possible i.e. the brain uses its real time vision of the word as a model instead of some abstract internal representation. The processing principle roughly follow the subsumption architecture (Brooks 1986).&lt;br /&gt;
&lt;br /&gt;
:::Wikipedia writes about this technique:&lt;br /&gt;
::::&amp;quot;&#039;&#039;[Behaviours] are organized into a hierarchy of layers. Each layer implements a particular level of behavioral competence, and higher levels are able to subsume lower levels (= integrate/combine lower levels to a more comprehensive whole) in order to create viable behavior. For example, a robot&#039;s lowest layer could be &amp;quot;avoid an object&amp;quot;. The second layer would be &amp;quot;wander around&amp;quot;, which runs beneath the third layer &amp;quot;explore the world&amp;quot;.[...]The subsumption architecture creates a system in which the higher layers utilize the lower-level competencies. The layers, which all receive sensor-information, work in parallel and generate outputs. These outputs can be commands to actuators, or signals that suppress or inhibit other layers.&amp;quot;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::My current implementation uses the opposite order. The high priority levels conduct the simplest behavioural tasks, and when these high priority but simple behavioural levels are happy more complex task can get control. This approach is still experimental, but in any case easy enough to reverse again.&lt;br /&gt;
&lt;br /&gt;
:::The behavioural levels &#039;&#039;all&#039;&#039; compete for control of the robot. Each behavioural layer evaluates its sensory input and determines if it wants to control the outputs (to change its input according to its (implied) goal, e.g. mechanoreceptors (microswitches) will only request control if the switch is closed. After all the behavioural levels are evaluated, and their request flags set or reset an arbitrate routine  selects the highest active layer that will run the robot behaviorual output for the next 50 msec.&lt;br /&gt;
:::See Anderson (2007) for a clear explanations and actual implementation examples.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Brain subsystems&#039;&#039;&#039;&lt;br /&gt;
:::More complicated or slow tasks (like sound processing or US echo detection) can be executed in separate processor boards that report their status  to the main  controller. Conceptually this is not different from subroutines for tasks.&lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Nervous system&#039;&#039;&#039;&lt;br /&gt;
::: The currently (sort of) running implementation of the brain is using a real time loop in a very simple cooperative multitasking system ([https://yiweimao.github.io/blog/async_microcontroller/ YiweiMao scheduler]) and inmplemented on an Arduino Uno &lt;br /&gt;
::: &#039;&#039;Development status: operational, but under active development.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Associative memory&#039;&#039;&#039;&lt;br /&gt;
::: Associative memory in it current, simplest form will be implemented as memory locations for particular sensory input combinations.  inputs that coincide increase a counter for that combination (learning those combinations). This allows both Pawlow  and operand conditioning.&lt;br /&gt;
:::&#039;&#039;Development status: not yet implemented, proof of concept done ~50 years ago :).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Excitation state and hormones&#039;&#039;&#039;&lt;br /&gt;
::: Hormones are internal variables with levels that act as slow changing memory for previous (combinations of) states.&lt;br /&gt;
::: A default breakdown speed can be set that slowly decrease hormone levels. Particular sensory input could increase the levels again. Reaching high levels of certain hormones can be a goal in itself, and subject to learning behaviour.&lt;br /&gt;
::: &#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Satisfaction&#039;&#039;&#039;&lt;br /&gt;
:::Signals to end feeding behaviour can -in addition to electrical food running out- also come from internal signals (satiation, internal hormonal signals, (too) long time periods with little change of events)&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Future prediction&#039;&#039;&#039;&lt;br /&gt;
:::This is currently way out of scope, but neural-net like implementations that store event sequences, predict likely outcomes of current inputs and act accordingly are fully feasible.&lt;br /&gt;
::: See Rickenbacher 1975 for an example that is probably  a bit more traceable than -for instance- modern neural network code like Tensorflow. &lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Effectors ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;main motors&#039;&#039;&#039;&lt;br /&gt;
:::The main moves of the organism are implemented by two wheels driven by two [https://leaphy.store/product/tt-motor-10cm-jumper-female/ DC motors] with build in gearboxes) and a [https://leaphy.store/product/motor-shield/ motor shield]. Motor speed is controlled by pulse width modualation (PMW)) present in the processor. Steering is done by differential motorspeed, a third backside &amp;quot;wheel&amp;quot; is a simple short passive wooden stand. This works well on reasonable flat surfaces, but needs improvement is the next robot (Terzo).&lt;br /&gt;
:::&#039;&#039;Motor development status: Operational at a basic level, PID control and extra power at startup to get smooth startup at low speed is needed.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Movable mouthparts&#039;&#039;&#039;&lt;br /&gt;
:::Appendages like extendable mouthparts controlled by [https://isking-modellbahn.de/modelcraft-es-030-Servo-top-line-steuerelektronik servo]&#039;s can be used for feeding on electrical food. Currently one servo controlling a proboscis (mouthpart for feeding) is present.&lt;br /&gt;
:::&#039;&#039;Development status: Operational in priciple, untested in practice, needs 3D printing of parts&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;[https://leaphy.store/product/rgb-led-single/ Three colour led]&#039;&#039;&#039;&lt;br /&gt;
::: can be used for signaling status of whatever state we want.&lt;br /&gt;
:::&#039;&#039;Development status: Operational &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Piezo beeper &#039;&#039;&#039;&lt;br /&gt;
::: Present on the [https://leaphy.store/product/motor-shield/ motor shield] can be used to create a variety of sounds,for instance to signal happines, distress or alarm.&lt;br /&gt;
:::&#039;&#039;Development status: Operational, but specific sounds need to be designed&lt;br /&gt;
&lt;br /&gt;
== Behavioural levels ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;behaviour in subsumption architecture is organised in levels that compete for control, the highest priority behaviour will control the robot for 50 msec &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Overview of current behavioral levels and  their most immportant inputs for controlling requests&#039;&#039;&#039;. &lt;br /&gt;
::See the actual calls for details.&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;Layer &amp;quot;distresss&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
::::Goal:  deal with the really difficult situations &lt;br /&gt;
::::0  HIBERNATE // hope for better times...&lt;br /&gt;
::::1  STUCK // try to solve non-movement when motors run...&lt;br /&gt;
::::2  CALL  // call for help&lt;br /&gt;
&lt;br /&gt;
:::If unable to meet the absolute basic requirement for battery voltage or movement CALL for help. In STUCK, try reflexes to get loose, pause regular. If nothing works eventually HIBERNATE &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:: Stay tuned, more comming soon&lt;br /&gt;
&lt;br /&gt;
== Implementation details ==&lt;br /&gt;
: Stay tuned, more comming soon&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Anderson, D.P. (2007)&#039;&#039;&#039; https://www.dprg.org/articles/2007-03a/&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Bettosini et al., 2022&#039;&#039;&#039; Torocó: A Subsumption Architecture Implementation, in: 2022 8th International Conference on Automation, Robotics and Applications (ICARA) IEEE, Prague, Czech Republic, pp. 27–32. . https://doi.org/10.1109/ICARA55094.2022.9738521&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Brooks, R.A. (1986)&#039;&#039;&#039; A Robust Layer Control System for a Mobile Robot, IEEE Journal of Robotics and Automation RA-2, 14-23&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Rickenbacher (1975)&#039;&#039;&#039; Lernen und Motivation als relevanzgesteuerte Datenverarbeitung: Ein Computer-Simulationsmodell elementarer kognitiv-affektiver Prozesse. Birkhäuser Verag Basel.&lt;/div&gt;</summary>
		<author><name>Peterr</name></author>
	</entry>
	<entry>
		<id>https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15284</id>
		<title>Leaphy Robot</title>
		<link rel="alternate" type="text/html" href="https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15284"/>
		<updated>2025-10-01T20:34:58Z</updated>

		<summary type="html">&lt;p&gt;Peterr: /* Behavioural levels */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Name=Leaphy robot with subsumption architecture&lt;br /&gt;
|Skills=software hardware electronics biology&lt;br /&gt;
|Status=Active&lt;br /&gt;
|Niche=robotics&lt;br /&gt;
|Purpose=Fun&lt;br /&gt;
|Picture=Leaphy back side view.jpg&lt;br /&gt;
|Tool=No&lt;br /&gt;
|Location=Space, home&lt;br /&gt;
|Cost=Very small given what is already present and what is available in the space (everything!!)&lt;br /&gt;
|Category=Electronics&lt;br /&gt;
}}&lt;br /&gt;
== Electronic insect-like creature ==&lt;br /&gt;
&#039;&#039;&#039;Physiological, Behavioural and environmental overview&#039;&#039;&#039; &amp;lt;br&amp;gt;&lt;br /&gt;
peterr 2022- 2025 (with &#039;&#039;very&#039;&#039; long pauses)&lt;br /&gt;
&lt;br /&gt;
====Document history====&lt;br /&gt;
* Currently this is a living document and this wiki contains the latest version&lt;br /&gt;
* September 2025 subsumption architecture design &amp;amp; transfer to nurdspace wiki&lt;br /&gt;
* August    2025 Documentation for scheduler&lt;br /&gt;
* March     2023 Draft version 0.2  - terminology cleanup and scope&lt;br /&gt;
* November  2022 First document sketches &amp;amp; ideas&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project==&lt;br /&gt;
The insect like creature based on the original [https://leaphy.store/product/leaphy-original-los/ leaphyrobot] has a set of functionalities that together allow it to effectively find, and feed on targets that provides electricity as a reward.&lt;br /&gt;
Learning strategies to improve success rate can be implemented.&lt;br /&gt;
Sexual signaling, event prediction, mating behaviour, genetic exchange and evolution are in principle possible but are currently still (far) out of scope. The system at it&#039;s highest level can be seen as a feedback loop: sensory input =&amp;gt; behavioural selection =&amp;gt; motor output =&amp;gt; new sensory input. The original design (2022) was meant to live in wind tunnel, and find odour sources to feed, but currently the emphasis has shifted from odour detection to more general sensory processing using subsumption architecture, [https://nurdspace.nl/Leaphy_Robot#Brain see below].&lt;br /&gt;
&lt;br /&gt;
== Sensory inputs ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Mechanoreceptor - sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
:::Micro switch based tactile hairs. &lt;br /&gt;
:::&#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Ultrasound - Distance sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
::: Ultrasonic pulses detect obstacles and trigger reflex avoidance behaviour&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Better directional responses would be possible with more than one US sensor. &lt;br /&gt;
:::: This would need a dedicated embedded processor. &lt;br /&gt;
:::: &#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing light intensity&#039;&#039;&#039;&lt;br /&gt;
::: Two LDR photoreceptors measure front-left light level and front-right light level&lt;br /&gt;
::: Total light intensity (sum) is available as an analog voltage&lt;br /&gt;
::: The difference between the inputs is also available, and signals what side to turn to, to approach or avoid the light.&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing sound (audio)&#039;&#039;&#039;&lt;br /&gt;
::: A subunit with its own processor, containing an Electret microphone to measure ambiant sound level, frequency and sound patterns. &lt;br /&gt;
::: Can be used in classical (Pawlow) and operand conditioning experiments. Will detect both absolute sound levels (for startle or avoidance responses) and can contain feature detectors (e.g. chirp intervals for leaf hopper like  communication and courting  behaviour of two leaphy&#039;s).  &lt;br /&gt;
::: In addition, an Audeme Movi speech recognition shield (see https://www.audeme.com/movi.html) could be used to process voice commands&lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented, but Movi shield &amp;quot;proof of concept&amp;quot; done&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;PIR movement sensor&#039;&#039;&#039;&lt;br /&gt;
::: In addition to light intensity, an infra red motion sensors can be used to detect movements (humans, or the cat for that matter) see for instance https://www.adafruit.com/product/4871 &lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented but PIR (similar to the adafruit thingy) available&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Sensing wind direction &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based tactile hairs?  Something like https://www.instructables.com/Low-Cost-Low-Speed-Wind-Sensor-1/ with shielding? or sensitive temperature measurements?&lt;br /&gt;
:::; Note: Wind direction sensing in the wind tunnel is currently replaced by sensing light gradients parallel to the wind direction because the wind sensor is not available yet. &lt;br /&gt;
:::: &#039;&#039;Development status: To be designed, high priority for the windtunnel version with odour processing as a main goal, low priority for the a free walking space/nurdspace version described here.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Volatiles (odours) &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based perception of volatiles like alcohol (fruit-fly like behaviours), Carbon dioxide (mosquito like behaviour), or VOC&#039;s (most plant eating insects). The sensor produces a voltage level proportional to the intensity of the stimulus. Using a threshold can generate a presence/absence signal. &lt;br /&gt;
::: The interval between odour pulses is a proxy for the distance to the source. Note that an odour &amp;quot;gradient&amp;quot; does not exist!&lt;br /&gt;
&lt;br /&gt;
::: Current implementation uses a SGP30 board. The time constant of the the sensor is in the order of 1 second, but &amp;quot;whiffs&amp;quot; of odour could be detected faster by using a feature detector that looks for sudden steps in the signal. This will also act as an sensory adaptation mechanism: in the absence of change the output go&#039;s to zero.&lt;br /&gt;
::: &#039;&#039;Development status: Sensor: worked, currently broken&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground color&#039;&#039;&#039;&lt;br /&gt;
::: This sensor measures ground colour and the output can be used to test for a particular condition (e.g. being at a target position). It can also be used to simulate trail pheromones implemented as colors next to the  trail followed. This sense can also take the role of short distance &amp;quot; present at target&amp;quot; stimuli.&lt;br /&gt;
::: &#039;&#039; Development status: Operational &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground reflection level&#039;&#039;&#039;&lt;br /&gt;
::: Two sensors &#039;line followers&#039; that both provide a binary present/absent signal of ground reflection.&lt;br /&gt;
::: Can be used to simulate trail following behaviour on a network of lines  (combined with (led) ground colours.&lt;br /&gt;
::: &#039;&#039;Development status: testing phase&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Future extensions: A combination of voltage levels and pulse frequency coding in the source could be used to simulate a spectrum of &amp;quot;chemical&amp;quot; inputs.  &lt;br /&gt;
:::: Feature detectors could extract particular frequencies and/or patterns to recognise for instance &amp;quot;&#039;&#039;toxic&#039;&#039;&amp;quot; substances. &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Proprioception (internal &amp;quot;feeling&amp;quot;)&#039;&#039;&#039;&lt;br /&gt;
::: Checking for instance for body movement when motors move, or for force feedback when extending electrical honey sucking mouthparts&lt;br /&gt;
::: Development status:To be developed, as yet low priority. &lt;br /&gt;
 &lt;br /&gt;
:: &#039;&#039;&#039;Sensing internal physiological states &#039;&#039;&#039;&lt;br /&gt;
:::To place electric reward information in perspective, some internal status information is needed, that is supplied by reading internal variables like energy levels (battery voltage , load current) or physiological state (internal variables like &amp;quot;ready to feed&amp;quot;. &lt;br /&gt;
::: More advances implementations could look up previous experiences, and rate of change in physiological status as well as brain hormone levels and excitation states (see below under internal states and hormones&amp;quot;).&lt;br /&gt;
:::Development status: To be designed.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing hormone levels&#039;&#039;&#039;&lt;br /&gt;
::: Certain activities or combinations of activities can stimulate the production of hormones. This could be implemented as slow changing values in memory. Hormone levels might modulate the effect of sensory input or behavioural output, and act as a slow form of memory.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing rewards and deterrents&#039;&#039;&#039;&lt;br /&gt;
::: Electronic organisms live on electricity, and are rewarded by sensing the presence of a voltage and current. This sensory organ is just sensing the analog voltage measured by the sensory organ. It simulates the perception of food such as nectar. Most logical position is at the tip of an appendage. &lt;br /&gt;
::: &#039;&#039;Development status: implemented and removed (needs mutiplexing). Mechanical movement (servo) to make electrical contact: testing phase.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Brain ==&lt;br /&gt;
::&#039;&#039;&#039;Subsumption architecture&#039;&#039;&#039;&lt;br /&gt;
:::The Electronic organisms has a software brain that receives sensory input both from the environment and internal status. The brain reads all inputs about every 50 msec, and produces command for actuators that produce behaviour. These behaviours can be as simple as a colour changes of a led (signaling sensory status) or movements of body and body and appendages. The aim is to make the lower levels as stateless as possible i.e. the brain uses its real time vision of the word as a model instead of some abstract internal representation. The processing principle roughly follow the subsumption architecture (Brooks 1986).&lt;br /&gt;
&lt;br /&gt;
:::Wikipedia writes about this technique:&lt;br /&gt;
::::&amp;quot;&#039;&#039;[Behaviours] are organized into a hierarchy of layers. Each layer implements a particular level of behavioral competence, and higher levels are able to subsume lower levels (= integrate/combine lower levels to a more comprehensive whole) in order to create viable behavior. For example, a robot&#039;s lowest layer could be &amp;quot;avoid an object&amp;quot;. The second layer would be &amp;quot;wander around&amp;quot;, which runs beneath the third layer &amp;quot;explore the world&amp;quot;.[...]The subsumption architecture creates a system in which the higher layers utilize the lower-level competencies. The layers, which all receive sensor-information, work in parallel and generate outputs. These outputs can be commands to actuators, or signals that suppress or inhibit other layers.&amp;quot;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::My current implementation uses the opposite order. The high priority levels conduct the simplest behavioural tasks, and when these high priority but simple behavioural levels are happy more complex task can get control. This approach is still experimental, but in any case easy enough to reverse again.&lt;br /&gt;
&lt;br /&gt;
:::The behavioural levels &#039;&#039;all&#039;&#039; compete for control of the robot. Each behavioural layer evaluates its sensory input and determines if it wants to control the outputs (to change its input according to its (implied) goal, e.g. mechanoreceptors (microswitches) will only request control if the switch is closed. After all the behavioural levels are evaluated, and their request flags set or reset an arbitrate routine  selects the highest active layer that will run the robot behaviorual output for the next 50 msec.&lt;br /&gt;
:::See Anderson (2007) for a clear explanations and actual implementation examples.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Brain subsystems&#039;&#039;&#039;&lt;br /&gt;
:::More complicated or slow tasks (like sound processing or US echo detection) can be executed in separate processor boards that report their status  to the main  controller. Conceptually this is not different from subroutines for tasks.&lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Nervous system&#039;&#039;&#039;&lt;br /&gt;
::: The currently (sort of) running implementation of the brain is using a real time loop in a very simple cooperative multitasking system ([https://yiweimao.github.io/blog/async_microcontroller/ YiweiMao scheduler]) and inmplemented on an Arduino Uno &lt;br /&gt;
::: &#039;&#039;Development status: operational, but under active development.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Associative memory&#039;&#039;&#039;&lt;br /&gt;
::: Associative memory in it current, simplest form will be implemented as memory locations for particular sensory input combinations.  inputs that coincide increase a counter for that combination (learning those combinations). This allows both Pawlow  and operand conditioning.&lt;br /&gt;
:::&#039;&#039;Development status: not yet implemented, proof of concept done ~50 years ago :).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Excitation state and hormones&#039;&#039;&#039;&lt;br /&gt;
::: Hormones are internal variables with levels that act as slow changing memory for previous (combinations of) states.&lt;br /&gt;
::: A default breakdown speed can be set that slowly decrease hormone levels. Particular sensory input could increase the levels again. Reaching high levels of certain hormones can be a goal in itself, and subject to learning behaviour.&lt;br /&gt;
::: &#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Satisfaction&#039;&#039;&#039;&lt;br /&gt;
:::Signals to end feeding behaviour can -in addition to electrical food running out- also come from internal signals (satiation, internal hormonal signals, (too) long time periods with little change of events)&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Future prediction&#039;&#039;&#039;&lt;br /&gt;
:::This is currently way out of scope, but neural-net like implementations that store event sequences, predict likely outcomes of current inputs and act accordingly are fully feasible.&lt;br /&gt;
::: See Rickenbacher 1975 for an example that is probably  a bit more traceable than -for instance- modern neural network code like Tensorflow. &lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Effectors ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;main motors&#039;&#039;&#039;&lt;br /&gt;
:::The main moves of the organism are implemented by two wheels driven by two [https://leaphy.store/product/tt-motor-10cm-jumper-female/ DC motors] with build in gearboxes) and a [https://leaphy.store/product/motor-shield/ motor shield]. Motor speed is controlled by pulse width modualation (PMW)) present in the processor. Steering is done by differential motorspeed, a third backside &amp;quot;wheel&amp;quot; is a simple short passive wooden stand. This works well on reasonable flat surfaces, but needs improvement is the next robot (Terzo).&lt;br /&gt;
:::&#039;&#039;Motor development status: Operational at a basic level, PID control and extra power at startup to get smooth startup at low speed is needed.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Movable mouthparts&#039;&#039;&#039;&lt;br /&gt;
:::Appendages like extendable mouthparts controlled by [https://isking-modellbahn.de/modelcraft-es-030-Servo-top-line-steuerelektronik servo]&#039;s can be used for feeding on electrical food. Currently one servo controlling a proboscis (mouthpart for feeding) is present.&lt;br /&gt;
:::&#039;&#039;Development status: Operational in priciple, untested in practice, needs 3D printing of parts&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;[https://leaphy.store/product/rgb-led-single/ Three colour led]&#039;&#039;&#039;&lt;br /&gt;
::: can be used for signaling status of whatever state we want.&lt;br /&gt;
:::&#039;&#039;Development status: Operational &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Piezo beeper &#039;&#039;&#039;&lt;br /&gt;
::: Present on the [https://leaphy.store/product/motor-shield/ motor shield] can be used to create a variety of sounds,for instance to signal happines, distress or alarm.&lt;br /&gt;
:::&#039;&#039;Development status: Operational, but specific sounds need to be designed&lt;br /&gt;
&lt;br /&gt;
== Behavioural levels ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;behaviour in subsumption architecture is organised in levels that compete for control, the highest priority behaviour will control the robot for 50 msec &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Overview of current behavioral levels and  their most immportant inputs for controlling requests&#039;&#039;&#039;. &lt;br /&gt;
::See the actual calls for details.&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;Layer &amp;quot;distresss&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
::::Goal:  deal with the really difficult situations &lt;br /&gt;
::::0  HIBERNATE // hope for better times...&lt;br /&gt;
::::1  STUCK // try to solve non-movement when motors run...&lt;br /&gt;
::::2  CALL  // call for help&lt;br /&gt;
&lt;br /&gt;
 If unable to meet the absolute basic requirement for battery voltage or movement CALL for help. In STUCK, try reflexes to get loose, pause regular. If nothing works eventually HIBERNATE &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:: Stay tuned, more comming soon&lt;br /&gt;
&lt;br /&gt;
== Implementation details ==&lt;br /&gt;
: Stay tuned, more comming soon&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Anderson, D.P. (2007)&#039;&#039;&#039; https://www.dprg.org/articles/2007-03a/&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Bettosini et al., 2022&#039;&#039;&#039; Torocó: A Subsumption Architecture Implementation, in: 2022 8th International Conference on Automation, Robotics and Applications (ICARA) IEEE, Prague, Czech Republic, pp. 27–32. . https://doi.org/10.1109/ICARA55094.2022.9738521&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Brooks, R.A. (1986)&#039;&#039;&#039; A Robust Layer Control System for a Mobile Robot, IEEE Journal of Robotics and Automation RA-2, 14-23&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Rickenbacher (1975)&#039;&#039;&#039; Lernen und Motivation als relevanzgesteuerte Datenverarbeitung: Ein Computer-Simulationsmodell elementarer kognitiv-affektiver Prozesse. Birkhäuser Verag Basel.&lt;/div&gt;</summary>
		<author><name>Peterr</name></author>
	</entry>
	<entry>
		<id>https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15283</id>
		<title>Leaphy Robot</title>
		<link rel="alternate" type="text/html" href="https://nurdspace.nl/index.php?title=Leaphy_Robot&amp;diff=15283"/>
		<updated>2025-10-01T20:33:46Z</updated>

		<summary type="html">&lt;p&gt;Peterr: /* Behavioural levels */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Name=Leaphy robot with subsumption architecture&lt;br /&gt;
|Skills=software hardware electronics biology&lt;br /&gt;
|Status=Active&lt;br /&gt;
|Niche=robotics&lt;br /&gt;
|Purpose=Fun&lt;br /&gt;
|Picture=Leaphy back side view.jpg&lt;br /&gt;
|Tool=No&lt;br /&gt;
|Location=Space, home&lt;br /&gt;
|Cost=Very small given what is already present and what is available in the space (everything!!)&lt;br /&gt;
|Category=Electronics&lt;br /&gt;
}}&lt;br /&gt;
== Electronic insect-like creature ==&lt;br /&gt;
&#039;&#039;&#039;Physiological, Behavioural and environmental overview&#039;&#039;&#039; &amp;lt;br&amp;gt;&lt;br /&gt;
peterr 2022- 2025 (with &#039;&#039;very&#039;&#039; long pauses)&lt;br /&gt;
&lt;br /&gt;
====Document history====&lt;br /&gt;
* Currently this is a living document and this wiki contains the latest version&lt;br /&gt;
* September 2025 subsumption architecture design &amp;amp; transfer to nurdspace wiki&lt;br /&gt;
* August    2025 Documentation for scheduler&lt;br /&gt;
* March     2023 Draft version 0.2  - terminology cleanup and scope&lt;br /&gt;
* November  2022 First document sketches &amp;amp; ideas&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project==&lt;br /&gt;
The insect like creature based on the original [https://leaphy.store/product/leaphy-original-los/ leaphyrobot] has a set of functionalities that together allow it to effectively find, and feed on targets that provides electricity as a reward.&lt;br /&gt;
Learning strategies to improve success rate can be implemented.&lt;br /&gt;
Sexual signaling, event prediction, mating behaviour, genetic exchange and evolution are in principle possible but are currently still (far) out of scope. The system at it&#039;s highest level can be seen as a feedback loop: sensory input =&amp;gt; behavioural selection =&amp;gt; motor output =&amp;gt; new sensory input. The original design (2022) was meant to live in wind tunnel, and find odour sources to feed, but currently the emphasis has shifted from odour detection to more general sensory processing using subsumption architecture, [https://nurdspace.nl/Leaphy_Robot#Brain see below].&lt;br /&gt;
&lt;br /&gt;
== Sensory inputs ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Mechanoreceptor - sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
:::Micro switch based tactile hairs. &lt;br /&gt;
:::&#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Ultrasound - Distance sensing of obstacles&#039;&#039;&#039;&lt;br /&gt;
::: Ultrasonic pulses detect obstacles and trigger reflex avoidance behaviour&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Better directional responses would be possible with more than one US sensor. &lt;br /&gt;
:::: This would need a dedicated embedded processor. &lt;br /&gt;
:::: &#039;&#039;Development status: Not yet implemented&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing light intensity&#039;&#039;&#039;&lt;br /&gt;
::: Two LDR photoreceptors measure front-left light level and front-right light level&lt;br /&gt;
::: Total light intensity (sum) is available as an analog voltage&lt;br /&gt;
::: The difference between the inputs is also available, and signals what side to turn to, to approach or avoid the light.&lt;br /&gt;
::: &#039;&#039;Development status: Operational&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing sound (audio)&#039;&#039;&#039;&lt;br /&gt;
::: A subunit with its own processor, containing an Electret microphone to measure ambiant sound level, frequency and sound patterns. &lt;br /&gt;
::: Can be used in classical (Pawlow) and operand conditioning experiments. Will detect both absolute sound levels (for startle or avoidance responses) and can contain feature detectors (e.g. chirp intervals for leaf hopper like  communication and courting  behaviour of two leaphy&#039;s).  &lt;br /&gt;
::: In addition, an Audeme Movi speech recognition shield (see https://www.audeme.com/movi.html) could be used to process voice commands&lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented, but Movi shield &amp;quot;proof of concept&amp;quot; done&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;PIR movement sensor&#039;&#039;&#039;&lt;br /&gt;
::: In addition to light intensity, an infra red motion sensors can be used to detect movements (humans, or the cat for that matter) see for instance https://www.adafruit.com/product/4871 &lt;br /&gt;
::: &#039;&#039;Development status: Not yet implemented but PIR (similar to the adafruit thingy) available&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Sensing wind direction &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based tactile hairs?  Something like https://www.instructables.com/Low-Cost-Low-Speed-Wind-Sensor-1/ with shielding? or sensitive temperature measurements?&lt;br /&gt;
:::; Note: Wind direction sensing in the wind tunnel is currently replaced by sensing light gradients parallel to the wind direction because the wind sensor is not available yet. &lt;br /&gt;
:::: &#039;&#039;Development status: To be designed, high priority for the windtunnel version with odour processing as a main goal, low priority for the a free walking space/nurdspace version described here.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Volatiles (odours) &#039;&#039;&#039;&lt;br /&gt;
::: Semiconductor based perception of volatiles like alcohol (fruit-fly like behaviours), Carbon dioxide (mosquito like behaviour), or VOC&#039;s (most plant eating insects). The sensor produces a voltage level proportional to the intensity of the stimulus. Using a threshold can generate a presence/absence signal. &lt;br /&gt;
::: The interval between odour pulses is a proxy for the distance to the source. Note that an odour &amp;quot;gradient&amp;quot; does not exist!&lt;br /&gt;
&lt;br /&gt;
::: Current implementation uses a SGP30 board. The time constant of the the sensor is in the order of 1 second, but &amp;quot;whiffs&amp;quot; of odour could be detected faster by using a feature detector that looks for sudden steps in the signal. This will also act as an sensory adaptation mechanism: in the absence of change the output go&#039;s to zero.&lt;br /&gt;
::: &#039;&#039;Development status: Sensor: worked, currently broken&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground color&#039;&#039;&#039;&lt;br /&gt;
::: This sensor measures ground colour and the output can be used to test for a particular condition (e.g. being at a target position). It can also be used to simulate trail pheromones implemented as colors next to the  trail followed. This sense can also take the role of short distance &amp;quot; present at target&amp;quot; stimuli.&lt;br /&gt;
::: &#039;&#039; Development status: Operational &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing ground reflection level&#039;&#039;&#039;&lt;br /&gt;
::: Two sensors &#039;line followers&#039; that both provide a binary present/absent signal of ground reflection.&lt;br /&gt;
::: Can be used to simulate trail following behaviour on a network of lines  (combined with (led) ground colours.&lt;br /&gt;
::: &#039;&#039;Development status: testing phase&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::: Future extensions: A combination of voltage levels and pulse frequency coding in the source could be used to simulate a spectrum of &amp;quot;chemical&amp;quot; inputs.  &lt;br /&gt;
:::: Feature detectors could extract particular frequencies and/or patterns to recognise for instance &amp;quot;&#039;&#039;toxic&#039;&#039;&amp;quot; substances. &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Proprioception (internal &amp;quot;feeling&amp;quot;)&#039;&#039;&#039;&lt;br /&gt;
::: Checking for instance for body movement when motors move, or for force feedback when extending electrical honey sucking mouthparts&lt;br /&gt;
::: Development status:To be developed, as yet low priority. &lt;br /&gt;
 &lt;br /&gt;
:: &#039;&#039;&#039;Sensing internal physiological states &#039;&#039;&#039;&lt;br /&gt;
:::To place electric reward information in perspective, some internal status information is needed, that is supplied by reading internal variables like energy levels (battery voltage , load current) or physiological state (internal variables like &amp;quot;ready to feed&amp;quot;. &lt;br /&gt;
::: More advances implementations could look up previous experiences, and rate of change in physiological status as well as brain hormone levels and excitation states (see below under internal states and hormones&amp;quot;).&lt;br /&gt;
:::Development status: To be designed.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing hormone levels&#039;&#039;&#039;&lt;br /&gt;
::: Certain activities or combinations of activities can stimulate the production of hormones. This could be implemented as slow changing values in memory. Hormone levels might modulate the effect of sensory input or behavioural output, and act as a slow form of memory.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Sensing rewards and deterrents&#039;&#039;&#039;&lt;br /&gt;
::: Electronic organisms live on electricity, and are rewarded by sensing the presence of a voltage and current. This sensory organ is just sensing the analog voltage measured by the sensory organ. It simulates the perception of food such as nectar. Most logical position is at the tip of an appendage. &lt;br /&gt;
::: &#039;&#039;Development status: implemented and removed (needs mutiplexing). Mechanical movement (servo) to make electrical contact: testing phase.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Brain ==&lt;br /&gt;
::&#039;&#039;&#039;Subsumption architecture&#039;&#039;&#039;&lt;br /&gt;
:::The Electronic organisms has a software brain that receives sensory input both from the environment and internal status. The brain reads all inputs about every 50 msec, and produces command for actuators that produce behaviour. These behaviours can be as simple as a colour changes of a led (signaling sensory status) or movements of body and body and appendages. The aim is to make the lower levels as stateless as possible i.e. the brain uses its real time vision of the word as a model instead of some abstract internal representation. The processing principle roughly follow the subsumption architecture (Brooks 1986).&lt;br /&gt;
&lt;br /&gt;
:::Wikipedia writes about this technique:&lt;br /&gt;
::::&amp;quot;&#039;&#039;[Behaviours] are organized into a hierarchy of layers. Each layer implements a particular level of behavioral competence, and higher levels are able to subsume lower levels (= integrate/combine lower levels to a more comprehensive whole) in order to create viable behavior. For example, a robot&#039;s lowest layer could be &amp;quot;avoid an object&amp;quot;. The second layer would be &amp;quot;wander around&amp;quot;, which runs beneath the third layer &amp;quot;explore the world&amp;quot;.[...]The subsumption architecture creates a system in which the higher layers utilize the lower-level competencies. The layers, which all receive sensor-information, work in parallel and generate outputs. These outputs can be commands to actuators, or signals that suppress or inhibit other layers.&amp;quot;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::My current implementation uses the opposite order. The high priority levels conduct the simplest behavioural tasks, and when these high priority but simple behavioural levels are happy more complex task can get control. This approach is still experimental, but in any case easy enough to reverse again.&lt;br /&gt;
&lt;br /&gt;
:::The behavioural levels &#039;&#039;all&#039;&#039; compete for control of the robot. Each behavioural layer evaluates its sensory input and determines if it wants to control the outputs (to change its input according to its (implied) goal, e.g. mechanoreceptors (microswitches) will only request control if the switch is closed. After all the behavioural levels are evaluated, and their request flags set or reset an arbitrate routine  selects the highest active layer that will run the robot behaviorual output for the next 50 msec.&lt;br /&gt;
:::See Anderson (2007) for a clear explanations and actual implementation examples.&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Brain subsystems&#039;&#039;&#039;&lt;br /&gt;
:::More complicated or slow tasks (like sound processing or US echo detection) can be executed in separate processor boards that report their status  to the main  controller. Conceptually this is not different from subroutines for tasks.&lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Nervous system&#039;&#039;&#039;&lt;br /&gt;
::: The currently (sort of) running implementation of the brain is using a real time loop in a very simple cooperative multitasking system ([https://yiweimao.github.io/blog/async_microcontroller/ YiweiMao scheduler]) and inmplemented on an Arduino Uno &lt;br /&gt;
::: &#039;&#039;Development status: operational, but under active development.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Associative memory&#039;&#039;&#039;&lt;br /&gt;
::: Associative memory in it current, simplest form will be implemented as memory locations for particular sensory input combinations.  inputs that coincide increase a counter for that combination (learning those combinations). This allows both Pawlow  and operand conditioning.&lt;br /&gt;
:::&#039;&#039;Development status: not yet implemented, proof of concept done ~50 years ago :).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Excitation state and hormones&#039;&#039;&#039;&lt;br /&gt;
::: Hormones are internal variables with levels that act as slow changing memory for previous (combinations of) states.&lt;br /&gt;
::: A default breakdown speed can be set that slowly decrease hormone levels. Particular sensory input could increase the levels again. Reaching high levels of certain hormones can be a goal in itself, and subject to learning behaviour.&lt;br /&gt;
::: &#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Satisfaction&#039;&#039;&#039;&lt;br /&gt;
:::Signals to end feeding behaviour can -in addition to electrical food running out- also come from internal signals (satiation, internal hormonal signals, (too) long time periods with little change of events)&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Future prediction&#039;&#039;&#039;&lt;br /&gt;
:::This is currently way out of scope, but neural-net like implementations that store event sequences, predict likely outcomes of current inputs and act accordingly are fully feasible.&lt;br /&gt;
::: See Rickenbacher 1975 for an example that is probably  a bit more traceable than -for instance- modern neural network code like Tensorflow. &lt;br /&gt;
:::&#039;&#039;Development status: To be developed&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Effectors ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;main motors&#039;&#039;&#039;&lt;br /&gt;
:::The main moves of the organism are implemented by two wheels driven by two [https://leaphy.store/product/tt-motor-10cm-jumper-female/ DC motors] with build in gearboxes) and a [https://leaphy.store/product/motor-shield/ motor shield]. Motor speed is controlled by pulse width modualation (PMW)) present in the processor. Steering is done by differential motorspeed, a third backside &amp;quot;wheel&amp;quot; is a simple short passive wooden stand. This works well on reasonable flat surfaces, but needs improvement is the next robot (Terzo).&lt;br /&gt;
:::&#039;&#039;Motor development status: Operational at a basic level, PID control and extra power at startup to get smooth startup at low speed is needed.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Movable mouthparts&#039;&#039;&#039;&lt;br /&gt;
:::Appendages like extendable mouthparts controlled by [https://isking-modellbahn.de/modelcraft-es-030-Servo-top-line-steuerelektronik servo]&#039;s can be used for feeding on electrical food. Currently one servo controlling a proboscis (mouthpart for feeding) is present.&lt;br /&gt;
:::&#039;&#039;Development status: Operational in priciple, untested in practice, needs 3D printing of parts&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;[https://leaphy.store/product/rgb-led-single/ Three colour led]&#039;&#039;&#039;&lt;br /&gt;
::: can be used for signaling status of whatever state we want.&lt;br /&gt;
:::&#039;&#039;Development status: Operational &lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039; Piezo beeper &#039;&#039;&#039;&lt;br /&gt;
::: Present on the [https://leaphy.store/product/motor-shield/ motor shield] can be used to create a variety of sounds,for instance to signal happines, distress or alarm.&lt;br /&gt;
:::&#039;&#039;Development status: Operational, but specific sounds need to be designed&lt;br /&gt;
&lt;br /&gt;
== Behavioural levels ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;behaviour in subsumption architecture is organised in levels that compete for control, the highest priority behaviour will control the robot for 50 msec &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Overview of current behavioral levels and  their most immportant inputs for controlling requests&#039;&#039;&#039;. &lt;br /&gt;
See the actual calls for details.&lt;br /&gt;
&lt;br /&gt;
:::&#039;&#039;&#039;Layer &amp;quot;distresss&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
::::Goal:  deal with the really difficult situations &lt;br /&gt;
::::0  HIBERNATE // hope for better times...&lt;br /&gt;
::::1  STUCK // try to solve non-movement when motors run...&lt;br /&gt;
::::2  CALL  // call for help&lt;br /&gt;
&lt;br /&gt;
If unable to meet the absolute basic requirement for batery voltage or movement CALL for help. In STUCK, try reflexes to get loose, pause regular. If nothing works eventually HIBERNATE &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:: Stay tuned, more comming soon&lt;br /&gt;
&lt;br /&gt;
== Implementation details ==&lt;br /&gt;
: Stay tuned, more comming soon&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
:: &#039;&#039;&#039;Anderson, D.P. (2007)&#039;&#039;&#039; https://www.dprg.org/articles/2007-03a/&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Bettosini et al., 2022&#039;&#039;&#039; Torocó: A Subsumption Architecture Implementation, in: 2022 8th International Conference on Automation, Robotics and Applications (ICARA) IEEE, Prague, Czech Republic, pp. 27–32. . https://doi.org/10.1109/ICARA55094.2022.9738521&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Brooks, R.A. (1986)&#039;&#039;&#039; A Robust Layer Control System for a Mobile Robot, IEEE Journal of Robotics and Automation RA-2, 14-23&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;Rickenbacher (1975)&#039;&#039;&#039; Lernen und Motivation als relevanzgesteuerte Datenverarbeitung: Ein Computer-Simulationsmodell elementarer kognitiv-affektiver Prozesse. Birkhäuser Verag Basel.&lt;/div&gt;</summary>
		<author><name>Peterr</name></author>
	</entry>
</feed>