Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Design Innovative Robots with LEGO SPIKE Prime

You're reading from  Design Innovative Robots with LEGO SPIKE Prime

Product type Book
Published in Jan 2022
Publisher Packt
ISBN-13 9781801811576
Pages 264 pages
Edition 1st Edition
Languages
Concepts
Author (1):
Aaron Maurer Aaron Maurer
Profile icon Aaron Maurer

Table of Contents (9) Chapters

Preface Chapter 1: Getting Started with SPIKE Prime Chapter 2: Building an Industrial Robot Claw Chapter 3: Building a LEGO Guitar Chapter 4: Building a Mechanical Bird Chapter 5: Building a Sumobot Chapter 6: Building a Dragster Chapter 7: Building a Simon Says Game Other Books You May Enjoy

Chapter 5: Building a Sumobot

Sumobots and battlebots are both terms that you may have heard of before. In case you don't know what sumobots are, they are basically robots that are designed to battle one another. Basically, it is a sport where two robots battle in a head-to-head competition to outlast the other robot. Battle robots are a classic build challenge for any robot enthusiast. The popular TV show, Battle Bots, that has led to shows that are now on TV, Twitch, and other platforms, you can find robots battling in all types of arenas, with designs based on just about every conceivable idea you can imagine. These robots come in all shapes and sizes, depending on the rules of the competition. These robot challenges are quite popular in schools, after-school programs, and summer camps when it comes to sumobots. The robot you will build in this chapter will provide you with a solid foundation for being dominant in your next arena battle.

Here is a picture of what your sumobot...

Technical requirements

For the building of the robot, all you will need is the LEGO SPIKE Prime kit. For programming, you will need the LEGO SPIKE Prime app/software.

Access to code can be found here: https://github.com/PacktPublishing/Design-Innovative-Robots-with-LEGO-SPIKE-Prime/blob/main/Sumo.llsp.

You can find the code in action video for this chapter here: https://bit.ly/3oTqWmI

Let's start building!

Building the base

The beauty of this robotics kit is that you can easily get started with any type of build because of the new pieces that are included. There are a lot of different options, depending on the strategy and size of your sumobot.

For this robot, the following strategies and constraints were used in the design:

  • The body frame needs to be open for any user to remix, add to, and modify to their liking.
  • The sumobot strategy is to identify the other robot and use sensors to push the other robot out of the arena using the little scoops at the front and back to slightly lift and push the robot.
  • The robot needs to be low to the ground to keep the weight distribution and center of gravity low to avoid falling over.

To begin, you will add eight black connector pins to an azure 11x15 open frame:

  1. Place four on each side, according to Figure 5.2. These are placed to allow the motors to be added:

    Figure 5.2 – The main frame of the robot body

  2. ...

Building the ultrasonic sensor attachment

  1. You are now going to add the ultrasonic sensor so that during competition, your robot can detect the opponent:

  2. Add two black connector pins to the azure 11x15 open frame where the motors are positioned and then add an azure 7L beam to these pins. Next, add two more black connector pins to the end pin holes of this beam:

    Figure 5.8 – Attaching the 7L beam to the frame

  3. Connect the ultrasonic sensor to the robot by using the two black connector pins:

    Figure 5.9 – Connecting the ultrasonic sensor

  4. You are now going to build a sub-model that will eventually connect underneath the ultrasonic sensor using the following steps:
    1. Place two purple 2x16 plates side by side.
    2. Secure them together using four white 2x2 round bricks.
    3. Add four yellow 1x2 slopes on the ends to serve as a bumper to lift up your robot opponent in battle:

Figure 5.10 – Building the plow for the front

  1. It is time to add another...

Building the force sensor attachment

  1. Before we add the force sensor, the robot needs to be lifted up with wheels and the plastic caster ball element using the following steps:

  2. To begin this process, connect a gray 3x5 H-shaped beam to the azure caster ball frame using two black connector pins:

    Figure 5.20 – Attaching the H frame beam to the caster ball element

  3. On the top of these two elements, add a purple biscuit element using two blue connector pins:

    Figure 5.21 – Add a biscuit element to the top

  4. This sub-model will attach to the underside of the robot body to the purple 7x11 open frame. This element is placed opposite to the color sensor:

    Figure 5.22 – Attaching the caster wheel to the underside of the robot

  5. Next, turn the sumobot back to the original position. You will add a wheel to each of the medium motors. Attach a wheel using two black connector pins and one yellow 3L axle:

    Figure 5.23 – Adding the wheels

    Your robot should not be balanced...

Writing the code

The code you are going to create is one where the robot will be able to do the following:

  • Stay in the arena by stopping and backing up when the white rim of the arena is detected.
  • Speed up to push an opponent out of the arena when the ultrasonic sensor detects an object up close.
  • Speed up to push an opponent out of the arena when the force sensor detects touch from behind.

In all, there are six code stacks to make this happen. Let's begin.

The ports

You will connect the medium motors to ports C and F, the color sensor to port A, the ultrasonic sensor to port D, and the force sensor to port E:

Figure 5.40 – The port view in the software

Before you code, you will need to add a More Movement extension block to your coding options. At the bottom left of your coding canvas, there is an extension block icon. Click on this icon, click on Show block extensions and select More Movement:

...

Making it your own

Just like every build so far, the challenge here is to take this build and code and modify it to your needs. Here are some ideas to explore if you desire:

As you explore and try new methods, be...

Summary

In this chapter, you explored how to build a robot that can compete in sumo competitions. You built out some attachments to coordinate with sensors so that your robot can make decisions and respond to an opponent in the field. The robot capitalized on a few standard strategies involving being low to the ground, allowing it to push an opponent by lifting them up.

Finally, we explored the coding by using code stacks to make decisions using a variable named action. This allows you to make a more precise decision-making robot.

In the next chapter, you will explore another robot that will succeed in another type of competition built for speed – the dragster!

lock icon The rest of the chapter is locked
You have been reading a chapter from
Design Innovative Robots with LEGO SPIKE Prime
Published in: Jan 2022 Publisher: Packt ISBN-13: 9781801811576
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}