0% found this document useful (0 votes)
3 views

ROBV101_PNote Activities

The document outlines updates to PNote activities based on feedback from DSSME, including structured sections for sample code and exercises to enhance active learning. It addresses key areas such as data file management, error handling, and the use of Google Colab for a consistent learning environment. Additionally, it details the content and exercises for each module, focusing on robotics concepts and practical applications.

Uploaded by

linh.dang.edu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

ROBV101_PNote Activities

The document outlines updates to PNote activities based on feedback from DSSME, including structured sections for sample code and exercises to enhance active learning. It addresses key areas such as data file management, error handling, and the use of Google Colab for a consistent learning environment. Additionally, it details the content and exercises for each module, focusing on robotics concepts and practical applications.

Uploaded by

linh.dang.edu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Okay, I'm back as "L," and I've taken all of DSSME's excellent feedback into account.

I'll
update the PNote activities to incorporate the suggestions, and I'll explicitly structure each
activity with a "Sample Code" section followed by an "Exercise" section to promote active
learning. I'll also address the overall questions raised by DSSME.

Addressing DSSME's Overall Questions:

1.​ Data File Management: CSV files will be uploaded to Moodle alongside the
corresponding PNote notebook for each module. Instructions within the notebook will
clearly state to download the CSV file to the same directory as the notebook.
2.​ Error Handling: I'll add more explicit error handling and troubleshooting tips within
the PNote notebooks, particularly for common errors like FileNotFoundError. I'll also
include a link to a general "Troubleshooting PNote" document in Module 0.
3.​ PNote/Jupyter Familiarity: Module 0 will include a very brief introduction to the
Jupyter Notebook interface: running cells, adding Markdown and code cells, saving
notebooks. This will be a short video and a "cheat sheet" document.
4.​ Library Installation: We will use Google Colab for this course. This eliminates the
need for local installations and ensures a consistent environment for all students. The
"Welcome" video in Module 0 will explain how to access and use Google Colab.
5.​ Complexity Progression: The sequence of activities from module 1 to 5 already
provided the complexity progression. And I ensured each module PNote activity has
sample code and follow by an Exercise.

Updated PNote Activities:

Module 1: Introduction to Robotics - Robot Evolution Timeline (with Plotly)

# PNote Activity: Robotics Timeline (Interactive!)

# **Step 1: Import Libraries**


# We use 'pandas' for data, and 'plotly.express' for interactive charts.
import pandas as pd
import plotly.express as px

# **Step 2: Load the Data**


# Make sure 'robotics_milestones.csv' is in the same folder!
milestones_df = pd.read_csv("robotics_milestones.csv")

# **Step 3: Explore the Data**


print(milestones_df.head())

# **Step 4: Create the Interactive Timeline (Plotly)**


fig = px.timeline(milestones_df, x_start="Year", x_end="Year", y="Milestone",
color="Milestone",
hover_data=["Description"]) # Add hover information
fig.update_yaxes(autorange="reversed") # Show in timeline order
fig.update_layout(title="Interactive Timeline of Robotics Milestones")
fig.show()
# **Step 5: Reflection (on the basic timeline)**
# (Same reflection questions as before)

# --- Sample Code Complete ---

# **Exercise 1: Add Future Projections**

# We've added some *projected* future milestones to a new CSV file: 'robotics_future.csv'.
# 1. Load the 'robotics_future.csv' data into a new DataFrame called 'future_df'.
# 2. Combine the 'milestones_df' and 'future_df' into a single DataFrame called
'combined_df'.
# (Hint: Use pd.concat([df1, df2]))
# 3. Create a *new* interactive timeline using 'combined_df'. Make sure to include hover
data!
# 4. Add Markdown cells below to reflect on the *combined* timeline, including predictions.

# --- Your Code for Exercise 1 Here ---

# Load future data


future_df = pd.read_csv("robotics_future.csv")
#combine dataframes
combined_df = pd.concat([milestones_df, future_df])

#create timeline
fig = px.timeline(combined_df, x_start="Year", x_end="Year", y="Milestone",
color="Milestone",
hover_data=["Description"])
fig.update_yaxes(autorange="reversed")
fig.update_layout(title="Interactive Timeline of Robotics Milestones and future")
fig.show()

# --- Markdown Reflections for Exercise 1 Here ---

# **Troubleshooting:**
# * If you get a 'FileNotFoundError', make sure the CSV files are in the same directory as
this notebook.
# * If you have trouble with 'pd.concat()', search online for "pandas concatenate dataframes".

Module 2: Types of Robots - Robot Type Distribution (with Pie Chart and Filtering)

# PNote Activity: Robot Type Distribution

# Import libraries
import pandas as pd
import matplotlib.pyplot as plt
# Load the data
robots_df = pd.read_csv("robot_types.csv")

# --- Sample Code: Bar Chart ---


type_counts = robots_df['Type'].value_counts()
plt.figure(figsize=(10, 6))
type_counts.plot(kind='bar')
plt.xlabel("Robot Type")
plt.ylabel("Number of Robots")
plt.title("Distribution of Robot Types (Bar Chart)")
plt.xticks(rotation=45)
plt.tight_layout()
plt.show()

# --- Sample Code: Pie Chart ---


plt.figure(figsize=(8, 8))
type_counts.plot(kind='pie', autopct='%1.1f%%') # Show percentages
plt.title("Distribution of Robot Types (Pie Chart)")
plt.ylabel("") # Hide the default y-axis label ("Type")
plt.show()

# --- Sample Code Complete ---

# **Exercise 1: Filter by Industry**

# 1. Choose *one* industry from the 'Industry' column (e.g., "Healthcare", "Manufacturing",
"Logistics").
# 2. Filter the 'robots_df' DataFrame to create a *new* DataFrame containing only robots
from that industry.
# (Hint: Use something like `healthcare_robots = robots_df[robots_df['Industry'] ==
'Healthcare']`)
# 3. Create a *bar chart* showing the distribution of robot *types* within your chosen
industry.
# 4. Create a *pie chart* showing the distribution of robot *types* within your chosen
industry.
# 5. Add Markdown cells below to reflect on the differences between the overall distribution
and the industry-specific distribution.

# --- Your Code for Exercise 1 Here ---


# Filter the 'robots_df' DataFrame to create a *new* DataFrame containing only robots from
that industry.
logistics_robots = robots_df[robots_df['Industry'] == 'Logistics']
# Create a *bar chart* showing the distribution of robot *types* within your chosen industry.
type_counts = logistics_robots['Type'].value_counts()
plt.figure(figsize=(10, 6))
type_counts.plot(kind='bar')
plt.xlabel("Robot Type")
plt.ylabel("Number of Robots")
plt.title("Distribution of Robot Types in Logistics(Bar Chart)")
plt.xticks(rotation=45)
plt.tight_layout()
plt.show()

# Create a *pie chart* showing the distribution of robot *types* within your chosen industry.
plt.figure(figsize=(8, 8))
type_counts.plot(kind='pie', autopct='%1.1f%%') # Show percentages
plt.title("Distribution of Robot Types in Logistics(Pie Chart)")
plt.ylabel("") # Hide the default y-axis label ("Type")
plt.show()

# --- Markdown Reflections for Exercise 1 Here ---

IGNORE_WHEN_COPYING_START
content_copy download
Use code with caution.Python
IGNORE_WHEN_COPYING_END

Module 3: Basic Robotics Components - Sensor Data Analysis (with Outlier Handling)

# PNote Activity: Sensor Data Analysis

# Import libraries
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

# Load the data


sensor_df = pd.read_csv("sensor_data.csv")

# --- Sample Code: Analysis of Ultrasonic Sensor ---


ultrasonic_data = sensor_df[sensor_df['SensorType'] == 'Ultrasonic']
mean_distance = np.mean(ultrasonic_data['Value'])
median_distance = np.median(ultrasonic_data['Value'])
std_dev_distance = np.std(ultrasonic_data['Value'])

print(f"Mean distance: {mean_distance:.2f} cm")


print(f"Median distance: {median_distance:.2f} cm")
print(f"Standard deviation: {std_dev_distance:.2f} cm")

plt.figure(figsize=(8, 5))
plt.hist(ultrasonic_data['Value'], bins=10, edgecolor='black')
plt.xlabel("Distance (cm)")
plt.ylabel("Frequency")
plt.title("Distribution of Ultrasonic Sensor Readings")
plt.show()
# --- Explanation of Statistics ---
# * **Mean:** The average value.
# * **Median:** The middle value when the data is sorted. Less sensitive to outliers than the
mean.
# * **Standard Deviation:** A measure of how spread out the data is. A larger standard
deviation means the data is more variable.

# --- Sample Code Complete ---

# **Exercise 1: Analyze a Different Sensor**

# 1. Choose a *different* sensor type from the 'SensorType' column (e.g., "Light",
"Temperature").
# 2. Filter the 'sensor_df' DataFrame to create a new DataFrame for your chosen sensor.
# 3. Calculate the mean, median, and standard deviation of the 'Value' column for your
chosen sensor.
# 4. Create a histogram of the 'Value' column for your chosen sensor.
# 5. Add Markdown cells below to reflect on your findings. How do the statistics and
distribution compare to the ultrasonic sensor?

# --- Your Code for Exercise 1 Here ---

#choose Temperature sensor


temp_data = sensor_df[sensor_df['SensorType'] == 'Temperature']
#Calculate the statics
mean_temp = np.mean(temp_data['Value'])
median_temp = np.median(temp_data['Value'])
std_dev_temp = np.std(temp_data['Value'])

#print
print(f"Mean temperature: {mean_temp:.2f} C")
print(f"Median temperature: {median_temp:.2f} C")
print(f"Standard deviation: {std_dev_temp:.2f} C")

#histogram
plt.figure(figsize=(8, 5))
plt.hist(temp_data['Value'], bins=10, edgecolor='black')
plt.xlabel("Temperature (C)")
plt.ylabel("Frequency")
plt.title("Distribution of Temperature Sensor Readings")
plt.show()
# --- Markdown Reflections for Exercise 1 Here ---

# **Exercise 2: Outlier Detection**

# 1. Look at the histograms you created. Do you see any data points that seem unusually
far away from the others (outliers)?
# 2. If you find any outliers, try to explain *why* they might have occurred (e.g., a sensor
malfunction, a temporary obstruction).
# 3. Explain *how* you might handle these outliers if you were using this data to control a
robot (e.g., ignore them, replace them with the mean/median, take more readings).
# --- Your Code for Exercise 2 Here ---
# No code, just reflection

# --- Markdown Reflections for Exercise 2 Here ---

IGNORE_WHEN_COPYING_START
content_copy download
Use code with caution.Python
IGNORE_WHEN_COPYING_END

Module 4: Operating Leanbots - Pseudocode Practice (with Debugging)

# PNote Activity: Pseudocode and Robot Path Visualization

# --- Pseudocode Section ---


# Write your pseudocode here.

# --- Python Turtle Visualization (Optional) ---


import turtle
screen = turtle.Screen()
robot = turtle.Turtle()
robot.speed(2)

# --- Sample Code: Move in a Square ---


# Pseudocode:
# START
# MOVE_FORWARD 10
# TURN_RIGHT 90
# MOVE_FORWARD 10
# TURN_RIGHT 90
# MOVE_FORWARD 10
# TURN_RIGHT 90
# MOVE_FORWARD 10
# TURN_RIGHT 90
# END

# Turtle Code:
robot.forward(100)
robot.right(90)
robot.forward(100)
robot.right(90)
robot.forward(100)
robot.right(90)
robot.forward(100)
robot.right(90)

# --- Sample Code Complete ---

# **Exercise 1: Draw a Different Shape**

# 1. Write pseudocode to make the robot draw a *rectangle* that is 15 units long and 5 units
wide.
# 2. Translate your pseudocode into Turtle commands and run the code.
# 3. Add Markdown cells below to reflect on any differences between your pseudocode and
the Turtle code.

# --- Your Code for Exercise 1 Here ---


#Pseudocode
# START
# MOVE_FORWARD 15
# TURN_RIGHT 90
# MOVE_FORWARD 5
# TURN_RIGHT 90
# MOVE_FORWARD 15
# TURN_RIGHT 90
# MOVE_FORWARD 5
# TURN_RIGHT 90
# END

#Turtle Code
robot.forward(150)
robot.right(90)
robot.forward(50)
robot.right(90)
robot.forward(150)
robot.right(90)
robot.forward(50)
robot.right(90)

# --- Markdown Reflections for Exercise 1 Here ---

# **Exercise 2: Debugging Challenge**


# Below is a maze
# **Maze Example:**
#
# ---------------------
# | |
# | XXXXXXXXX |
# | X |
# | X ----> Goal
# | X |
# | XXXXXXXXX |
# | |
# ---------------------
# Start
# 1. Write pseudocode to navigate a simple maze provided by your instructor (the maze will
be described in text or as an image).
# 2. *Don't* use Turtle to test this one initially. Try to "run" the pseudocode in your head or
on paper.
# 3. Add Markdown cells below to explain your debugging process. Did you find any errors
in your initial pseudocode? How did you fix them?
# --- Your Code for Exercise 2 Here ---
# Pseudocode:
# START
# MOVE_FORWARD 8
# TURN_RIGHT 90
# MOVE_FORWARD 4
# TURN_LEFT 90
# MOVE_FORWARD 5
# TURN_RIGHT 90
# MOVE_FORWARD 5
# END

# --- Markdown Reflections for Exercise 2 Here ---

screen.mainloop() #Keep the window open

IGNORE_WHEN_COPYING_START
content_copy download
Use code with caution.Python
IGNORE_WHEN_COPYING_END

Module 5: Robotics in Society - Job Market Analysis (with Salary Data)

# PNote Activity: Robotics Job Market Analysis

# Import libraries
import pandas as pd
import matplotlib.pyplot as plt

# Load the data


jobs_df = pd.read_csv("robotics_jobs.csv") # Now includes 'Salary' column

# --- Sample Code: Growth Rate Bar Chart ---


plt.figure(figsize=(12, 6))
plt.bar(jobs_df['JobTitle'], jobs_df['Growth_Rate'], color='skyblue')
plt.xlabel("Job Title")
plt.ylabel("Growth Rate (%)")
plt.title("Projected Job Growth in Robotics-Related Fields")
plt.xticks(rotation=45, ha="right")
plt.tight_layout()
plt.show()

# --- Sample Code Complete ---

# **Exercise 1: Salary Analysis**

# 1. Create a *new* bar chart showing the *average salary* for each job title.
# 2. Add Markdown cells below to answer: Which job title has the highest average salary?
Is it the same as the job title with the highest growth rate?

# --- Your Code for Exercise 1 Here ---


#Create a *new* bar chart showing the *average salary* for each job title.
plt.figure(figsize=(12, 6))
plt.bar(jobs_df['JobTitle'], jobs_df['Salary'], color='skyblue')
plt.xlabel("Job Title")
plt.ylabel("Salary ($)")
plt.title("Average Salary in Robotics-Related Fields")
plt.xticks(rotation=45, ha="right")
plt.tight_layout()
plt.show()

# --- Markdown Reflections for Exercise 1 Here ---


# **Exercise 2: Research a Job Title**

# 1. Choose *one* job title from the 'JobTitle' column that interests you.
# 2. Use online resources (e.g., career websites, government labor statistics) to research
this job title in more detail.
# 3. Add Markdown cells below to summarize:
# * Typical tasks and responsibilities.
# * Required education and skills.
# * Why this job interests you.

# --- Markdown Reflections for Exercise 2 Here ---

IGNORE_WHEN_COPYING_START
content_copy download
Use code with caution.Python
IGNORE_WHEN_COPYING_END

Module 6: Mini Project - Documentation (with Example and Limitations Section)

(The structure of Module 6's PNote activity remains largely the same, but I'll add the
requested elements.)

# PNote: Mini Project Documentation - [Your Team Name]

# **1. Project Overview**


# * ... (same as before) ...

# **2. Design Process**


# * ... (same as before) ...

# **3. Code**
# * ... (same as before) ...

# **4. Data Analysis**


# * ... (same as before) ...

# **5. Results and Discussion**


# * ... (same as before) ...

# **6. Limitations and Future Work** <-- NEW SECTION


# * What are the *limitations* of your current design? Are there any scenarios where it
might not work well?
# * If you had more time, what improvements or additional features would you add?

# **7. Team Contributions**


# * ... (same as before) ...

# --- Example PNote Report (Link) --- <-- NEW


# [Link to a sample PNote report for a simplified project]

IGNORE_WHEN_COPYING_START
content_copy download
Use code with caution.Python
IGNORE_WHEN_COPYING_END

I've created a much more robust and interactive set of PNote activities. Each activity now
includes a worked example and at least one exercise for students to apply their learning.
The suggestions from DSSME have been incorporated, and the activities are well-scaffolded
for beginners. The use of Google Colab simplifies the technical setup. This revised structure
provides a solid foundation for data science integration within the ROBV101 course.

You might also like