This morning I was revisiting the idea of using an evolved (or even hand crafted) neural network as a robot brain which I spent some time simulating after reading the @thrandell post on the subject of evolving such a network. Using real robots wasn't practical in real time so I did a lot of simulations instead.
This post is about how amazing this AI stuff is, even if it doesn't necessarily give you an exact or even fully accurate reply I have found it a useful tool.
When someone types a question to the forum I wonder if they might have found it more useful to first post the question to ChatGPT? It can often help you through the whole project.
I asked it to help with code to evolve a two neuron control of a robot. It did and then asked if I wanted more help. I typed yes and it replied.
To help you effectively, I need to know which environment or platform you're working with. For example:
- Are you planning to run this code on a **physical robot** with sensors and motors?
- Are you using a **robot simulation environment** like FBTurtle, FBRobot, or a custom simulator?
- Do you want to connect it to **hardware via serial port or GPIO**?
Please specify:
1. The target hardware or simulation environment.
2. The sensors and actuators you have.
3. How you'd like the program to interface with the robot (e.g., via serial, direct GPIO, or simulation).
Once I have those details, I can guide you on how to adapt this genetic algorithm into your specific environment, including code snippets or integration steps.
---
**Please provide:**
- The robot type or simulation software you're using.
- The programming environment or platform (e.g., Windows, Linux, microcontroller).
- How sensor data is received and how motor commands are sent.
With this info, I can give you tailored guidance and example code for integration.
When someone types a question to the forum I wonder if they might have found it more useful to first post the question to ChatGPT?
I know I'm a cheap, skinflint but, I already have 2 free AI's available on my system, why would I get another that I have to pay for?
Google has its own AI that responds to every query I make. So, I copied the question into Google:
help with code to evolve a two-neuron control of a robot
[Response edited for length}
AI Overview
To evolve a two-neuron robot control, you will need to define a neural network structure, create a simulation or a real-world robot, and implement an evolutionary algorithm to optimize the network's weights. The network can be a simple feedforward or recurrent type, with two neurons controlling two actuators (like motors), and the evolutionary algorithm will adjust the weights based on the robot's performance on a specific task.
- Define the network structure
- Inputs: Start with a simple input layer ...
- Neurons: Create two neuron layers. ...
- Outputs: Define the output layer. ...
- Connections: Connect the layers with weighted connections....
- Set up the simulation or robot environment
- Simulation: Use a simulator like ... or a custom-built one in a Python environment. ...
- Real-world robot: If you are using a real-world robot, ...
- Implement an evolutionary algorithm
...
Example code structure
This is a conceptual example to get you started. You can adapt this framework to your specific robot and task using your preferred programming language (like Python).
# python import random import numpy as np ...
It's a subjective opinion which is better, but both are clearly beneficial to the person asking the question. How many forum questions can be answered with a simple Google query (with or without the AI)?
I think it's a matter of knowledge of what's available.
A chat with CoPilot
On my Windows system, I get Github CoPilot for free, and it's also embedded into Visual Studio IDE. I've been working on a post on how to use Visual Studio IDE to build Arduino sketches with the IDE settings I have been using for the last 8 months. To me, it's trivial but then I've invested 40 years into using the Microsoft tools and IDE Not everybody has done that or is inclined to. So, I thought I'd pass the knowledge along to make it trivial for others. Out of curiosity, I asked CoPilot
Can I use Visual Studio IDE to build Arduino sketches?
To my (pleasant) surprise, CoPilot's response contained my solution:
Take a deep breath.
Yes - you can build and upload Arduino sketches from the Visual Studio (IDE) desktop app. Two practical approaches:
- Use the Visual Micro extension (recommended) ...
- Use Arduino CLI + custom projects (manual/integrated) ...
The recommended solution costs $20 a year. But the AI will walk you through the install and a simple sketch. The Arduino-cli is free but you have to install the tool, and the AI ignores how to do that.
Hmm ... seems a biased to me. And I claim the "custom" project is "trivial." (BTW, the recommended solution is based upon a free cli but the AI didn't mention that.)
All of these AI's are competitive. Google and Microsoft/Github update their AIs automatically. I don't know about charGPT, but I assume it does.
I view the AIs very skeptically. Too often it feels like trying to get someone else to "do your homework." TANSTAAFL.
The one who has the most fun, wins!
I view the AIs very skeptically. Too often it feels like trying to get someone else to "do your homework." TANSTAAFL.
That part doesn't concern me as I am not a student. I have had a life long interest in AI (and the human brain) and am surprised at what neural networks can now do using high speed GPUs along with lots of memory and new architectures.
I still write my own simple programs but it is interesting to have a companion AI that can make suggestions on any project.
One thing of concern and illustrates a big gap between how the brain works and AI is the difference in energy consumption.
... am surprised at what neural networks can now do ...
The recent advances are both surprising and stimulating. I'm constantly struck by the amount of memory in my laptop and the speed the processor runs at. I wax and wane on being optimistic about it. So far, I find AIs make information available to me that I was previously unaware of. Just like Google, if I can think of the question to ask, I get something new. And I'm good at asking questions. 🙂
Read the article. Interesting. I'm now more inclined to think biological components are a promising pathway forward. Least, that's what my grey cells are telling me to think. 😀
The one who has the most fun, wins!