Deprecated: Required parameter $query follows optional parameter $post in /var/www/html/wp-content/plugins/elementor-extras/modules/breadcrumbs/widgets/breadcrumbs.php on line 1215
Mars Rover - Blocks, Python Functions, Projects | PictoBlox Extension
[PictoBloxExtension]

Mars Rover

Mars rover extension graphics
Extension Description
Control the Mars Rover Robot with Quarky.

Introduction

Mars is a fascinating planet. It’s icy cold and covered in reddish dust and dirt. Like Earth, it has volcanoes, gullies, and flat plains. Scientists can also see channels that look like they were carved by rivers and streams a long, long time ago. Over the years, NASA has sent five robotic vehicles, called rovers, to Mars. The names of the five rovers are Sojourner, Spirit and Opportunity, Curiosity, and Perseverance.

STEMpedia has created a miniature version of the Mars Rover to educate students about the different aspects of the Mars Rover in a more practical way.

The Mars Rover is programmable with PictoBlox in both modes – Block Coding and Python Coding.

Motor and Servo Motor

In our Mars rover, there are a total of 6 motors and 5 servo motors. 

The motors provide rotation to the wheels which helps the rover to attain motion in both forward and backward directions.  All the left side motors (3 motors) are connected to the left motor port of Quarky and all the right side motors (3 motors) are connected to the right motor port of Quarky using a 3 port wire. This means that to control the Mars rover we have to control only 2 motors – Left and Right. Also, there are 2 parameters to control – Direction (Forward or Backward) and Speed. With this control, the Mars rover can do all the desired motions.

The servo motors help in providing rotation to the complete wheel assembly so that the rover can change its wheel alignments and so its path. These play a major role in turning cases of the mars rover. The front two and the back two-wheel assemblies are connected with one servo motor each. Some important turns:

  1. Turning left on the same point:
  2. Turning right on the same point:
  3. Turning left on a circle:
  4. Turning right on a circle:
Note:  The middle wheel assemblies on either side are not connected to servo motors.

The fifth servo motor is connected to the head portion of the Mars rover so that the rover can rotate its head to detect obstacles. 

Connecting Mars Rover with PictoBlox

Let’s begin by first connecting Quarky to PictoBlox. Select your preferred type of device i.e. either the desktop/laptop or your smartphone and follow the instructions.

Desktop

Follow the steps below for connecting Quarky to PictoBlox:

  1. First, connect Quarky to your laptop using a USB cable.
    Power Quarky
  2. Next, open PictoBlox on your desktop.
  3. After that, select Block or Python Coding as your coding environment.
  4. Then, click the Board button in the toolbar and select board as Quarky.
  5. Next, select the appropriate Serial port if the Quarky is connected via USB or the Bluetooth Port if you want to connect Quarky via Bluetooth and press Connect.
    COM Port

And voila! Quarky is now connected to PictoBlox.

Mobile

Follow the steps below for connecting Quarky to PictoBlox:

  1. First, power ON Quarky.
  2. Open PictoBlox on your smartphone. Go to My Space and make a new project by clicking the ‘+(plus)’ button in the bottom-right corner.
    PictoBlox in Mobile Phone
  3. Then, tap the Board button in the top-right corner of the toolbar.
    PictoBlox BoardSelect board as Quarky.
  4. Next, tap the Connect button:
    PictoBlox ConnectSelect your device from the list.

And voila! Quarky is now connected to PictoBlox.

Mars Rover Extension in Block Coding

Click on the Add Extension button and add the Mars Rover extension.

Once loaded, you will find the fresh blocks of Mars Rover in the block palette.

 

Mars Rover Extension in Python Coding

Click on the Add Modules/Libraries button and add the Mars Rover extension.

To access the library functions, you have to add the object declaration.

quarky = Quarky()
rover = MarsRover(4, 1, 7, 2, 6)
Read More

PictoBlox Blocks

It changes Sound Effects.
The block will check its Boolean condition: if the condition is true, the code held inside the first C (space) will activate, and then the script will continue; if the condition is false, the code inside the second C will activate (unlike the If () Then block).
Scripts that begin with this block will be invoked once the specified broadcast has been sent by a calling script. If a Forever block is sending the broadcast faster than the attached script can finish running, the script will restart without reaching the blocks at the end. This can be avoided by using Broadcast () and Wait.
The block holds the most recent text imputed with the Ask () and Wait block. When nothing has been inputted yet, the value will hold nothing.
Once you have analyzed the images, you can use the get # of objects block to get the number of objects recognized in the image.
The block joins two Boolean blocks so any one of them can be true to return true — if at least one of them is true, the block returns true; if neither of them are true, it returns false.
The block simply holds its variable value.
Once you have analyzed the images, you can use the get # of people block to get the number of people recognized in the image.
This block returns the x position of the pose landmark detected. The position is mapped with the stage coordinates.
The recognized () count block reports the number of selected things to count in the image. Multiple celebrities, brands, objects, and image tags in a single image can be seen.
Once you have analyzed the images, you can use the get # faces block to get the number of faces recognized in the image.
Once you have analyzed the image for printed text, you can use a printed text result block to get the recognized text from the image in a string format.
The block checks if the currently recognized class from the selected image feed (camera, stage, costume or backdrop) is the selected class or not.
The block analyses the specified text and provides the sentiment associated with the text – Positive, Negative or Neutral.
Once you have analyzed the images, you can use the get # of objects detected block to get the number of objects recognized in the image.
The block returns the QR Code data value detected.
The block changes the instrument that the Play Note () for () Beats block will play. A sprite can play only one instrument at a time. In order to play multiple instruments at once, it is necessary to have multiple sprites or clones of a single sprite
The block sets the pen’s color to the given color, which can be selected by clicking on the input.
This block sets the pen’s color, saturation, brightness (also known as shade), and transparency. The first value can be selected from “color” (default), “saturation”, “brightness”, and “transparency”.
The block sets the analog state of the specified pin to the specified value between 0 to 255.
The block displays the specified character on the Quarky RGB LED.
The block sets the threshold value of the specified IR sensor to the specified value. The value can be from 0 to 4095.
The block checks if the currently recognized class from the analyze image from () block is the selected class or not.
The block analyses the image and saves the face information locally, which can be accessed using other blocks.
The block checks if the currently recognized class from the analyze image from () block is the selected class or not.
The block sets the head servo motor angle to the specified angle.
The block checks if the currently recognized class from the analyze image from () block is the selected class or not.
The block reports the specified class confidence value of the selected class. 0 is low confidence and 1 is high confidence.
Scripts that wear this block will activate once the selected class is predicted either on the recognition window.
The block sets the selected property of the sprite (density, roughness, and bounce) to the specified value.
All articles loaded
No more articles to load

Block Coding Examples

All articles loaded
No more articles to load

Python Functions

The function returns whether the specified number card (0-9) is detected in the analysis or not.
Syntax: isnumberdetected(card_number = 1)
The function returns the specified parameter for the specified number card detected.
Syntax: getnumberdetail(card_number = 1, parameter_value = 1)
The function returns whether the specified object card is detected in the analysis or not.
Syntax: isobjectdetected(object_name = “Pizza”)
The function returns the specified parameter for the specified object detected.
Syntax: getobjectdetail(object_name = “Pizza”, parameter_value = 1)
The function is used to control the state of the camera.
Syntax: video(video_state = “on”, transparency = 1)
The function enables the automatic display of the box on QR Code detection on the stage.
Syntax: enablebox()
The function disables the automatic display of the box on QR Code detection on the stage.
Syntax: disablebox()
This function is used to analyze the image received as input from the camera, for QR Code.
Syntax: analysecamera()
This function is used to analyze the image received as input from the stage, for QR Code.
Syntax: analysestage()
The function returns whether the QR Code is detected in the analysis or not.
Syntax: isdetected()
The function returns the X position of the specified landmark points of the QR code.
Syntax: xpos(landmark_name = “center”)
The function returns the Y position of the specified landmark points of the QR code.
Syntax: ypos(landmark_name = “center”)
The function returns the QR Code data value detected.
Syntax: codedata()
The function returns the QR Code angle detected.
Syntax: angle()
The function initialize and sets the event name and API key for the IFTTT webhooks.
Syntax: setifttt(event_name = “event name”, key = “key”)
The function sets the specified parameter (1, 2, or 3) to the specified value. 
Syntax: setvalues(value = “your value”, parameter = 1)
The function triggers the IFTTT webhook event.
Syntax: triggerevent()
The function clear the parameter values of the IFTTT webhook.
Syntax: clearvalues()
The function returns the parameter 1 value set during the program.
Syntax: value1()
The function returns the parameter 2 value set during the program.
Syntax: value2()
The function returns the parameter 3 value set during the program.
Syntax: value3()
All articles loaded
No more articles to load

Python Coding Examples

All articles loaded
No more articles to load
Table of Contents