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

The Block makes a request to ChatGPT with the specified text and stores the response in PictoBlox, which can then be accessed with the Block ‘Get AI Response’. This Block also features three types of AI bots – Normal AI, Sarcastic AI, and Friend AI.
This block enables users to set the digital state of an Arduino digital pin to either a High (5V) or Low (0V) voltage output. It can be used on the Arduino Uno, Mega, and Nano boards.
The block allows the user to set the cursor position in an LCD module. It takes two parameters, the column and row numbers, and moves the cursor to that position. This allows the user to create more precise output for the display.
This block adds the offset on the end effector position along the specified length direction i.e. the direction in which the robotic arm is facing and the Z direction.
This block moves the robot forward and backward for a set time, collecting IR sensor data on both white and black lines.
Starts the script when the sprite is touched by another sprite.
Moves the sprite a specified number of grid squares up.
Makes the sprite disappear as if fully invisible.
Runs the script over and over forever, untill stop by Stop button (🛑).
Play’s a specified sound from the list.
This makes a image copy of the sprite on the stage.
After connection is established, rotates the quarky a specified number of step to the left.
Shows a specified emotion with animation on the quarky LED display.
Detects and counts the number of human faces present in a view captured from the camera.
Allows the sprite to follow the movement of a detected hand in real-time on specified finger.
Runs the blocks inside if a specfied state(active/inactive) of the sensors of the wizbot is detected.
After connection is established, moves the wizbot in a specified direction forever.
The block sets a text color (choose from the color selector), a particular background color (choose from the color selector) and the text size (value varying from 1 to 7) for the text.
evive has a 5-way navigation key, 4 of them are for up, down, right and left direction. This block checks if the navigation key is in one of the four particular directions. The direction for which you wish to check is your choice and can be chosen from the drop down on the block.
The block sends the written message on the terminal module of the Dabble app.
The block reports the digital state of the digital sensor, connected to the selected digital pin.
This block should be included every time you work with the humanoid robot for the first time as it calibrates the angles of all the four servo motors of the leg (2 servos of legs + 2 servos of feet) and saves the angles in the memory of evive.
The block points its sprite in the specified direction; this rotates the sprite.
The block gives its sprite a thought bubble with the specified text. The thought bubble stays until a speech or thought block with its text block empty is activated, or the stop sign is pressed.
The options for the Change () Effect by () block’s drop-down menu are pan left/right and pitch. The input is for selecting how much the sound will be changed. A positive number will make the sound effect have more effect, while a negative number will make it smaller.
The block will check its Boolean condition. If the condition is true, the blocks held inside it will run, and then the script involved will continue. If the condition is false, the code inside the block will be ignored and the script will move on (unlike in the If () Then, Else block). The condition is only checked once; if the condition turns to false while the script inside the block is running, it will keep running until it has finished.
Scripts that wear the block will activate once its sprite or clone of the sprite is clicked. Contrary to its definite name, the block will also execute the clone’s script when the clone is clicked on.
The block reports the Euclidean distance, in pixels, between it and the mouse-pointer or a specified sprite’s costume center.
The block will make an input box (with the specified text above it) show at the bottom of the screen. Scratchers can input text into it and submit it, and the input is stored then in the Answer block. The Answer block automatic updates to the most recent input.
All articles loaded
No more articles to load

Block Coding Examples

All articles loaded
No more articles to load

Python Functions

The function returns its sprite’s current costume number or name.
Syntax: costume(result_type = “number”)
The function reports the data stored from the last RFID scan.
Syntax: readscanneddata()
The function reports the selected field data from the last read request from ThingSpeak.
Syntax: ts.getdatafromfield(field = 1)
The function reports the time passed from the reset for the oscillator.
Syntax: oscillationtimer()
This function sets the angle of the Gripper Robot’s gripper servo motor to a particular value when it is in the open position.
Syntax: setopenangle(angle = 90)
This function takes a single parameter as input and returns the current position of the end effector along a specified axis.
Syntax: roboticArm.getcurrentposition(AXIS = “x”)
The function allows the user to add a particular face to the database from the stage. The user can specify the name of the face with the argument as well. This addition of the face in the database is also stored inside the PictoBlox file while saving.
Syntax: addclassfromstage(label_number = 1, label_name = “Jarvis”)
The function changes the Rotation Style of the sprite in-project. Regardless of the style, the variable direction will still change.
Syntax: setrotationstyle(rotation_style = “left-right”)
The function writes the message to the RFID tag. It will wait for the specified time to scan an RFID tag and write the value on it. The function also reports whether the operation is completed or not. If the write is complete the block returns 1, else it returns 0.
Syntax: writetorfid(data = “Hello!”, duration = 5)
The block makes the specified type of HTTP request (GET, POST, or DELETE) on the specified URL. The request can have a body or not.
Syntax: makeapirequest(request = “GET”, url = “url”, bodytype = “with”)
This function allows the Gripper Robot to close its gripper.
Syntax: closearm()
The function deletes all the stored databases of the images for face recognition. 
Syntax: deleteallclass()
The function returns the sprite’s X position.
Syntax: x()
The function returns the sprite’s Y position.
Syntax: y()
The function returns its sprite’s current backdrop number or name.
Syntax: backdrop(result_type = “number”)
The function sets the last scanned RFID tag to the master RFID tag. This can be used for authentication.
Syntax: setmaster()
The function defines the value of the body.
Syntax: setbody(body = “{“value”:”5″}”)
This function allows the Gripper Robot to open its gripper.
Syntax: openarm()
This function is used to match the input image from the camera with the stored classes previously stored in the database. 
Syntax: recognisefromcamera()
The function returns the sprite’s direction in angle.
Syntax: direction()
The function returns its sprite’s size.
Syntax: size()
The function reports if the last RFID tag scanned is a master tag or not. If it is the master RFID tag, then it returns 1, else 0.
Syntax: ismaster()
The function sets the body content type to the specified value.
Syntax: setcontenttype(type = “application/x-www-form-urlencoded”)
This function is used to match the input image from the stage with the stored classes previously stored in the database. 
Syntax: recognisefromstage()
The function reports the master RFID tag ID.
Syntax: getmastertag()
The function reports the request-response code received.
Syntax: requestapicode()
This function is used to check if the input image belongs to one of the classes previously defined. The class to be checked with can be set using the argument as label_number.
Syntax: isclassdetected(label_number = 1)
The function reports the last scanned RFID tag ID.
Syntax: gettag()
The function reports the body or error value from the HTTP request.
Syntax: getresponse(type = “body”)
This function is used to get the class of the input face detected from the analysis. The identifying number of the face being analyzed can be set using the argument.
Syntax: getclassname(face = 1)
All articles loaded
No more articles to load

Python Coding Examples

All articles loaded
No more articles to load
Table of Contents