Thousands & Thousands of Tiny Robots.

Next Level Cubelets Part I: Non Monotonic Functions

By: Modular Robotics

What’s a robot?  Our working definition is that it’s a machine that Senses, Thinks, and Acts.  Cubelets and MOSS are pretty primitive robots; if you prefer Sense, Plan, Act, they probably won’t be offended.

Anyway, each Cubelet falls into one of the Sense, Think, or Act categories, and one of the main reasons that they seem primitive (compared to a mouse, say), is that they fundamentally work together based on simple, linear, one-to-one relationships.  Snap a Distance Sensor onto a Drive block, and the more the distance sensor detects, the faster the motor goes.  The less, the slower.  All of the Sense and Act Cubelets output basically linear values (or actions) based on their inputs:

linear

A linear, monotonic relationship like this makes simple, perfect, robotty sense, but doesn’t have a lot in common with the messy, biological irregularities and discontinuities that we find in systems that look alive.  What if we try something that’s not monotonic: a function that doubles back on itself.  How about an easy piecewise function that makes a triangle: y=x for x<0.5 and y=1-x for x>0.5.  At Wolfram Alpha, we can plot it like this:  Plot[Piecewise[{{x, x<0.5}, {1-x, x>0.5}}], {x, 0, 1}]

I used Cubelets Studio and a Bluetooth Cubelet to reprogram a Knob block to apply this transformation to any data that flows through it.  Then I added a Bar Graph so that I could see what was going on and got this:

Which is exactly right, but I want to use the full range of the bar graph, so I’ll make my triangle wave twice as tall by adding a simple 2x.  It works, and I know you can picture a full bar graph response so I’m not going to bother with a video.  Here’s the code: void loop() { int temp = get_knob(); if (temp <= 127) { block_value = 2 * temp; } else { block_value = 2 * (255 – temp); } }

OK.  Now I’m going to switch it up a bit and flash (almost) the same code into a Distance sensor (swapping get_distance() for get_knob()) and build a little mobile robot.  It’s a differential drive robot with the modified Distance sensor controlling one motor, and a stock Knob controlling the other for easy tuning.  The Passive block is just for balance.

Hm!  This little robot looks like it’s attracted to the box but also careful to keep its distance.  Is it “thinking”?  Is it “intelligent”?  Maybe not, but it seems like we’re getting a little closer to intelligence here than we can do with a robot made out of stock Cubelets….

Support.

Frequently asked questions.

Cubelets FAQs is your place to find answers to common questions about Cubelets robot blocks, orders, and Modular Robotics.

Contact us.

Need help, can't find an answer? Contact the Modular Robotics support team and we'll help you!

Shipping and tax policies.

Get the details on Modular Robotics shipping policies and sales tax collection for orders in the United States and around the world.

Warranty and returns.

Cubelets are backed by a one year warranty. Need to make a claim, get a replacement, or have questions? Click to get started.

Cubelets Resources.

Everything you need to teach with Cubelets robot blocks.

Explore a huge collection of K-12 lessons, activities, guides, training, and more.

New to Cubelets?

Learn everything you need to know to start creating more with Cubelets robot blocks in this handy Getting Started Guide.

Go further with Cubelets apps.

Go beyond the building blocks and play with the code inside. Cubelets apps make it easy to create even more with your Cubelets.

Looking for some inspiration?

There are millions of robots you can create with Cubelets. Check out these robots to help inspire your inventions.

Shop Cubelets.

Education.

Cubelets robot blocks are used by educators all around the world to help students explore computational thinking, coding, and STEM. 

Jump to...

At Home.

Bring home the educational teaching tool loved by teachers everywhere. Explore sets designed for learning through play.

Jump to...