Basics of Robotics

Wait until ChatGPT 5 to Build on OpenAI

What if the days of making money on a startups API by building a layer over it are over?

Sam Altman clearly warned developers that while the innovation is frothing around ChatGPT4, that ChatGPT5 would essentially make whatever you build obsolete.

Instead, be thinking about what role a human might play in future technology design, development and implementation, and then build that.

Sample Code: How ChatGPT Trains Itself

import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import DataLoader, Dataset
from transformers import GPT2Tokenizer, GPT2LMHeadModel

# Define a simple dataset for training
class ConversationDataset(Dataset):
    def __init__(self, conversations, tokenizer, max_length=512):
        self.conversations = conversations
        self.tokenizer = tokenizer
        self.max_length = max_length

    def __len__(self):
        return len(self.conversations)

    def __getitem__(self, idx):
        input_text, target_text = self.conversations[idx]
        encoding = self.tokenizer.encode_plus(
            input_text,
            add_special_tokens=True,
            max_length=self.max_length,
            padding='max_length',
            truncation=True,
            return_tensors='pt'
        )
        target_encoding = self.tokenizer.encode_plus(
            target_text,
            add_special_tokens=True,
            max_length=self.max_length,
            padding='max_length',
            truncation=True,
            return_tensors='pt'
        )

        return encoding['input_ids'].flatten(), target_encoding['input_ids'].flatten()

# Sample data (normally you would have a much larger dataset)
conversations = [
    ("What are the benefits of regular exercise?", "Regular exercise improves health, boosts mood, and enhances physical fitness."),
    ("How do I cook pasta?", "To cook pasta, boil water, add pasta, cook for 8-10 minutes, then drain."),
    # Add more conversation pairs here...
]

# Initialize tokenizer and dataset
tokenizer = GPT2Tokenizer.from_pretrained('gpt2')
dataset = ConversationDataset(conversations, tokenizer)
data_loader = DataLoader(dataset, batch_size=2, shuffle=True)

# Initialize the GPT-2 model
model = GPT2LMHeadModel.from_pretrained('gpt2')
model.train()

# Define the optimizer and loss function
optimizer = optim.AdamW(model.parameters(), lr=1e-5)
criterion = nn.CrossEntropyLoss()

# Training loop
epochs = 3
for epoch in range(epochs):
    for batch_idx, (input_ids, target_ids) in enumerate(data_loader):
        optimizer.zero_grad()

        # Forward pass
        outputs = model(input_ids, labels=target_ids)
        loss = outputs.loss

        # Backward pass and optimization
        loss.backward()
        optimizer.step()

        # Print loss for monitoring
        if batch_idx % 10 == 0:
            print(f'Epoch {epoch + 1}/{epochs}, Batch {batch_idx}, Loss: {loss.item()}')

# Save the trained model
model.save_pretrained('./trained_conversational_model')
tokenizer.save_pretrained('./trained_conversational_model')

print("Model training complete!")

OpenAI’s AGI Robot

A video that recently appeared online shows an amazing demo of OpenaAI’s ChatGPT running on a Humanoid robot. The robot was built by Figure and more information can be found on thier website. Their CEO explains the vision as follows:

Thankfully, we are in the early stages of an AI and Robotics revolution. This presents the unique opportunity to substantially increase our production and standard of living.

As automation continues to integrate with human life at scale, we can predict that the labor-based economy as we know it will transform. Robots that can think, learn, reason, and interact with their environments will eventually be capable of performing tasks better than humans. Today, manual labor compensation is the primary driver of goods and services prices, accounting for ~50% of global GDP (~$42 trillion/yr), but as these robots “join the workforce,” everywhere from factories to farmland, the cost of labor will decrease until it becomes equivalent to the price of renting a robot, facilitating a long-term, holistic reduction in costs. Over time, humans could leave the loop altogether as robots become capable of building other robots — driving prices down even more. This will change our productivity in exciting ways. Manual labor could become optional and higher production could bring an abundance of affordable goods and services, creating the potential for more wealth for everyone.

We will have the chance to create a future with a significantly higher standard of living, where people can pursue the lives they want.

We believe humanoids will revolutionize a variety of industries, from corporate labor roles (3+ billion humans), to assisting individuals in the home (2+ billion), to caring for the elderly (~1 billion), and to building new worlds on other planets. However, our first applications will be in industries such as manufacturing, shipping and logistics, warehousing, and retail, where labor shortages are the most severe. In early development, the tasks humanoids complete will be structured and repetitive, but over time, and with advancements in robot learning and software, humanoids will expand in capability and be able to tackle more complex job functions. We will not place humanoids in military or defense applications, nor any roles that require inflicting harm on humans. Our focus is on providing resources for jobs that humans don’t want to perform.

Take a Breath and Organize Your Signals

The pace that A.I. is evolving is one thing. The pace of the hype is another. Each day it seems like there are announcements about one organization outpacing the other. If you feel behind, take a breath. Yes, there is a massive land grab going on. Amazon, Apple, Google, Microsoft and others are all trying to get to full intelligence first. It’s an exciting time.

But actually, what most of us need to do, as business owners, marketers, researchers, engineers and students, is to get organized. We are used to A.I. sort of helping us with things, and dependent on algorithms to work for us.

Now, the landscape is changing. Today, most of us should first get our data and signals organized.

What does this mean?

1. Look at the basics of any advertising campaigns you are running. If you are spending money on ads but don’t have your analytics, goals, events and funnels clearly defined, it’s not going to work for long. The machines need this data.

2. Look at your processes. Roles that involve humans staring at a screen, formatting data, inputting records, creating content and tracking stats will be over soon. In 2 years or less any intern with ChatGPT will be able to do many of these jobs.

3. What type of data advantages do you have? Do you have more data? More people? More users? Better data? You’ll need at least one data advantage.

4. Make a list of all of the algorithms you and your teams interact with daily. Which could impact your organization? These interactions, and the net impact of them are valuable.

This all may sound a little vague, but actually rather than generating A.I. images or asking ChatGPT questions, your organization needs to be thinking about the data and signals that inform the machines in your ecosystem.

What is a robot motor controller

A robotic motor controller is an electronic device used to regulate the operation of motors in robotic systems. It manages the power delivery to the motors, allowing precise control over their speed, direction, torque, and position. Here are the key functions and components of a robotic motor controller. Motor controllers take the signal from the micro-controller and convert the power source to signals that power the motors. Most robots have multiple motor controllers.

Functions of a Robotic Motor Controller:

  1. Speed Control: Adjusts the speed of the motor based on the desired setpoints, often through feedback mechanisms such as encoders or tachometers.
  2. Direction Control: Changes the direction of the motor’s rotation.
  3. Torque Control: Regulates the amount of torque produced by the motor.
  4. Position Control: Moves the motor to a specific position, usually in coordination with sensors and feedback systems.
  5. Current Limiting: Protects the motor and controller from overcurrent conditions by limiting the amount of current supplied to the motor.
  6. Feedback Processing: Uses input from sensors to adjust motor performance and ensure accuracy and stability.

Components of a Robotic Motor Controller:

  1. Microcontroller/Processor: The brain of the motor controller, it processes input signals and determines the necessary output to achieve the desired motor behavior.
  2. Power Stage: Comprises transistors or other switching elements that modulate the power delivered to the motor. Common types include H-bridges for DC motors.
  3. Feedback Sensors: Devices such as encoders, Hall effect sensors, or potentiometers that provide data on the motor’s speed, position, and other parameters.
  4. Communication Interface: Allows the motor controller to communicate with the main robot controller or other components. Interfaces can include UART, SPI, I2C, CAN, or Ethernet.
  5. Control Algorithms: Software routines that implement control strategies like PID (Proportional-Integral-Derivative) control, which help achieve desired performance and stability.

Types of Motors and Corresponding Controllers:

  1. DC Motor Controllers: Used for brushed and brushless DC motors, they provide variable voltage and direction control.
  2. Stepper Motor Controllers: Manage stepper motors, which move in discrete steps, allowing precise positioning.
  3. Servo Motor Controllers: Typically used with servos, which combine a DC motor, feedback sensor, and control circuitry in one unit for precise position control.

Applications:

  • Industrial Automation: For controlling conveyor belts, robotic arms, and automated guided vehicles.
  • Consumer Electronics: In devices like drones, robotic vacuums, and 3D printers.
  • Medical Devices: In robotic surgery systems and automated medication dispensers.
  • Automotive Systems: For electric vehicles, adaptive cruise control, and autonomous driving systems.

Example of a Motor Control Process:

  1. Input Signal: A desired speed or position is input into the system.
  2. Processing: The microcontroller processes this input and compares it with the feedback from sensors.
  3. Control Signal: Based on the difference (error) between the desired and actual values, the controller adjusts the power stage to change the motor’s performance.
  4. Feedback Loop: Continuously monitors the motor’s performance and adjusts as necessary to maintain the desired operation.

In summary, a robotic motor controller is a crucial component in robotic systems, enabling precise and efficient control of motor functions to achieve complex and coordinated tasks.

Google I/0 2024 Recap

Machine Learning has driven SEO for years. Above: Google's Page Rank Algorithm

The theme was A.I. of course as the race is on. But there are some gems in here.

-Fully functional A.I. that can read code
-Generative Images and Videos will help scale the ads business
-Integration of A.I. across all Google products

A.I., specifically Google’s Gemini 1.5 Pro was the feature of the 2024 Google I/O Conference.

Joe Rogan, Gladstone.Ai and the fact that you are probably too late for A.I.

It’s May, 2024.

We’ve all seen it. A.I. generated images are popping up all over. Campaign videos are surfacing, fake, made entirely in A.I.

Suddenly our friends and co-workers are A.I. experts or throwing out CHATGPT memes. Elon Musk’s 2nd A.I. company is surging to 45B+ with no revenue.

Amazon was reporting buying a data center next to a nuclear power plant and rumors circulate that Google is doing the same. A.I. will come down to computing power and money. The models are in place they just need computing power to learn.

Already CHATGPT has known bugs. One is called “Rent Mode” where when asked to do repetitive tasks it starts to complain. Or known biases already being baked into Google’s new tools.

General Intelligence is here. If you are business owner, creator, politician, educator and executive, the Artificial Intelligence may have just passed you by.

Start this morning, learning as much as you can and embracing this new breakthrough.

Lesson 1: Becoming an IoT Engineer

This is a basic course that is designed to teach someone with beginning to intermediate development skills such as web or application development, how to build, deploy and optimize mobile internet of things devices over Wi-Fi and cellular. The lessons include best practices in code design, development environments, hardware and software. There are a variety of ways to setup an IoT (Internet of Things) environment. IoT networks can run over wi-fi, cellular or local networks and are used generally for monitoring and remote relay of different types of camera or sensor data.

To learn the basics, we’re going to start with Arduino Cloud and an ESP32. The first lesson is really easy, it involves getting your development environment set-up and well organized. You’ll need a PC or MAC computer and the following.

  1. Create an Arduino Cloud account.
  2. Order an ESP32.

You’ll need the proper USB data cable to connect the ESP32 to your computer.

After you’ve created your Arduino account and have the ESP32 board in hand, we’ll be connecting the board to your Arduino account. Stay tuned for the next lesson.

The St. Vrain Valley Innovation Center

The St. Vrain Valley School District is located in Longmont, Colorado. It has developed an amazingly good STEM program under the leadership of a talented group of educators.

They’ve built an impressive facility called the Innovation Center in Longmont which provides regular classes for high school students in the district. Topics include Artificial Intelligence, robotics, cyber security, video and audio production, 3D printing and more.

The program also employs students in the actual management and running of various aspects of the Center as well as real community projects.

They have some great information, including how to book a tour and a video overview here.