Step-by-Step Guide to Dive into Robotics Programming with Python 🤖🐍

Step 1: Setup your Environment 🛠️

First and foremost, you need to set up a Python development environment. If you don't have Python installed, you can download it from here.

# check python version
python --version

Next, we recommend using virtual environments for your project to avoid any package conflicts.

# install virtualenv
pip install virtualenv

# create a virtual environment
virtualenv venv

# activate the virtual environment
source venv/bin/activate

Step 2: Install pypot and poppy-creature 📦

We'll be using Python's pypot library, which provides a powerful and flexible way to control robots with many degrees of freedom (DOF). Also, we need poppy-creature that designs the Poppy Humanoid, Poppy Torso, and Ergo Jr robots. We will demonstrate this using Poppy Humanoid, but it applies to any other.

# install pypot
pip install pypot

# install poppy-creature
pip install poppy-creature

Step 3: Connect and Control your Poppy Creature 🤖

To instantiate and control a Poppy Creature, we first import from pypot.creatures import PoppyHumanoid. Then, we instantiate it.

from pypot.creatures import PoppyHumanoid

poppy = PoppyHumanoid()

Now, you have a Python object that represents your robot. You can access its motors and sensors, making the robot move. For example, let's change the position of the head.

# move head_z motor to 90 degrees
poppy.head_z.goal_position = 90

To get the current position, just do:

print(poppy.head_z.present_position)

There you have it! Robotics programming can feel convoluted at first, but remember, the journey of a thousand lines of code begins with a single statement. So, just keep coding! 💪👩‍💻

You can explore more about pypot and poppy-creature through these links:

Just take note, due to the swift nature of technology evolution, these links might become outdated down the line. Enjoy coding!

Stay tuned for more exciting journeys into the world of programming.