All Projects → mithi → hexy

mithi / hexy

Licence: MIT license
Code for a hexapod robot

Programming Languages

python
139335 projects - #7 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to hexy

HomeStatusDisplay
Show smart home status information sent via MQTT using RGB LEDs.
Stars: ✭ 21 (-69.57%)
Mutual labels:  adafruit
boombeastic
A Raspberry Pi based smart connected speaker with support for airplay, spotify, mpd and local playback
Stars: ✭ 206 (+198.55%)
Mutual labels:  adafruit
stewart-platform-esp32
https://ouilogique.com/plateforme-de-stewart-esp32/
Stars: ✭ 17 (-75.36%)
Mutual labels:  hexapod
WeatherPi TFT
a weather display for a raspberry pi and a TFT display written in python3 and pygame
Stars: ✭ 66 (-4.35%)
Mutual labels:  adafruit
Stick-Hexapod
廢材四足機器人
Stars: ✭ 17 (-75.36%)
Mutual labels:  hexapod
camera.zero
Combining Camera Zero with an Arducam 12MP camera, a Raspberry Pi Zero WH, a PiMoRoNi trackball breakout, and an Adafruit 16-LED NeoPixel ring will result in a neat little screenless camera that can be controlled with your thumb.
Stars: ✭ 26 (-62.32%)
Mutual labels:  adafruit
Pxt
Microsoft MakeCode (PXT - Programming eXperience Toolkit)
Stars: ✭ 1,649 (+2289.86%)
Mutual labels:  adafruit
HexapodHDA
University Project: Design of a six-legged Hexapod with 3 DoF at each leg. Communication and control implementation on an Arduino 2560.
Stars: ✭ 20 (-71.01%)
Mutual labels:  hexapod
micropython-adafruit-mqtt-esp8266
Using MQTT to Publish/Subscribe to adafruit io. MicroPython/CircuitPython implementation on ESP8266/ESP32
Stars: ✭ 53 (-23.19%)
Mutual labels:  adafruit
adafruit-i2c-pwm-driver
Node.js implementation for the Adafruit 16-Channel 12-bit PWM/Servo Driver
Stars: ✭ 25 (-63.77%)
Mutual labels:  adafruit
MusicVisualizer
A music visualizer based on the ATMEGA328P-AU
Stars: ✭ 30 (-56.52%)
Mutual labels:  adafruit
ZeroBug
DIY Hexapod Robot
Stars: ✭ 182 (+163.77%)
Mutual labels:  hexapod
Safe-Power-Monitor
Camble - SudoMod
Stars: ✭ 19 (-72.46%)
Mutual labels:  adafruit
awesome-adafruitio
A curated list of awesome Adafruit IO guides, videos, libraries, frameworks, software and resources.
Stars: ✭ 40 (-42.03%)
Mutual labels:  adafruit
ArduPod
Open Source Arduino Hexapod
Stars: ✭ 22 (-68.12%)
Mutual labels:  hexapod
multicontainer-demo-rpi3
A demo of balena multicontainer on Raspberry Pi3 with PiTFT LCDs
Stars: ✭ 18 (-73.91%)
Mutual labels:  adafruit
tinyfont
Text library for TinyGo displays
Stars: ✭ 37 (-46.38%)
Mutual labels:  adafruit
Penguino-STM32WL-LoRa-E5
This repo contains all the necessary design and fabrication files for the Seeed Studio LoRa-E5 based Penguino Feather breakout board.
Stars: ✭ 30 (-56.52%)
Mutual labels:  adafruit
boozer
Kegerator Monitoring Platform. RPi + Docker + Beer + Metrics + Slack. k3s kubernetes friendly.
Stars: ✭ 93 (+34.78%)
Mutual labels:  adafruit
hexapod
Golang program for my junky hexapod
Stars: ✭ 59 (-14.49%)
Mutual labels:  hexapod

🐳 ☕️ 🧧 Say Thanks!

33Mudy961bUk9zz35p68g9fE3uuHLRduRp

TABLE OF CONTENTS

  • Links
  • Stuff to Buy and Assemble
    • Electronic Hardware Stuff
    • Frame
    • Connect Stuff and Calibrate Servos
  • Forks by Others
  • Configuration and Calibration
  • Sample Usage

LINKS

STUFF TO BUY AND ASSEMBLE

Electronic Hardware stuff

I bought a bunch of stuff, here are the most important stuff:

Frame

The screws and nuts are the 3M ones you can buy from your local hardware store. You can lazer cut or 3D print Arcbotic's Hexapod frame as they have open-sources the files in DXF and STL format. I used a 5mm acrylic sheet.

Connect Stuff and Calibrate Servos

Adafruit has good tutorials for how to wire the drivers and all with the Arduino and Raspberry Pi.

  • Servo Driver with Arduino
  • Servo Driver Hat with Raspberry Pi
  • The large Raspberry Pi 2B and 3B has the same 40-pin configuration as the Raspberry Pi Zero, you just follow how to wire the I2C pins there.
  • These tutorials are also good starting point to calibrate the minimum and maximum pulses of each of your servo which you'd have to do.

CHECKOUT FORKS BY OTHERS

@robottwo has implemented a nice gui and config file which I haven't merged (or let alone tested), you might be interested cloning that instead:

You may have your servo controllers on different addresses, or your servos plugged into different ports. You will also have to calibrate the min and max range of each of your servos, since these settings vary from servo to servo. These settings are all stored in the hexy.cfg file. To help with this task, there is a GUI program scripts/detect_controllers.py. - ROBOTTWO

CONFIGURATION AND CALIBRATION

You should take a look at the base file here as it is implemented in a pretty straightforward manner:

You may need to edit lines 4 to 22 of this file (and a bunch of other lines) depending on the configuration of your Hexapod and if you are using a different frame or if you are using different I2C addresses.

""" joint_key convention:
    R - right, L - left
    F - front, M - middle, B - back
    H - hip, K - knee, A - Ankle
    key : (channel, minimum_pulse_length, maximum_pulse_length) """

joint_properties = {

    'LFH': (0, 248, 398), 'LFK': (1, 188, 476), 'LFA': (2, 131, 600),
    'RFH': (3, 275, 425), 'RFK': (4, 227, 507), 'RFA': (5, 160, 625),
    'LMH': (6, 312, 457), 'LMK': (7, 251, 531), 'LMA': (8, 138, 598),
    'RMH': (9, 240, 390), 'RMK': (10, 230, 514), 'RMA': (11, 150, 620),
    'LBH': (12, 315, 465), 'LBK': (13, 166, 466), 'LBA': (14, 140, 620),
    'RBH': (15, 320, 480), 'RBK': (16, 209, 499), 'RBA': (17, 150, 676),
    'N': (18, 150, 650)
}

driver1 = PWM(0x40)
driver2 = PWM(0x41)

Or you may need to edit many of the lines in this file. For example this is what @patrickpoirier51 submitted as an issue:

I do have a different type of hexapod and the servo configuration makes the left and right side asymmetric, so +10 deg on left side makes -10 deg on right side. - @patrickpoirier51

Basically to solve his issue, he added a direction or a symmetry parameter at joint_properties IE

joint_properties = {

    'LFH': (0, 330, 480, -1), 'LFK': (1, 200, 515, -1), 'LFA': (2, 130, 610, 1),
    'RFH': (3, 380, 530, 1), 'RFK': (4, 300, 615, 1), 'RFA': (5, 130, 610, -1),
    'LMH': (6, 320, 470, -1), 'LMK': (7, 251, 531, -1), 'LMA': (8, 130, 610, 1),
    'RMH': (9, 380, 530, 1), 'RMK': (10, 290, 605, 1), 'RMA': (11, 150, 630, -1),
    'LBH': (12, 350, 500, -1), 'LBK': (13, 200, 515, -1), 'LBA': (14, 180, 660, 1),
    'RBH': (15, 350, 500, 1), 'RBK': (16, 300, 615, 1), 'RBA': (17, 130, 610, -1),
    'N': (18, 150, 650, 1)
    

And consequently updated the initialization of Joint in line 132

    self.channel, self.min_pulse, self.max_pulse, self.direction = joint_properties[jkey]

As well as the pose() method in Joint in line 140

    pulse = remap((angle * self.direction), (-self.max, self.max), (self.min_pulse, self.max_pulse))

Also equally important is the range of motion of each Joint which I've defined in line 87 of the Leg class. The ankle has a range of motion from -90 to 90 while the hip and knee's range is -45, 45 and -50, 50 respectively. I have a knee leeway of 10 degrees. Change these as you see fit.

max_hip, max_knee, knee_leeway = 45, 50, 10

SAMPLE USAGE

HexapodCore > Hexapod > HexapodPro > DancingHexapod

The easiest way to get this up and running, on your raspberry pi zero is to do the following on the terminal via ssh.

Setup

$ ssh YOUR.RPI.IP.ADDR -l pi 
$ cd /home/pi
$ git clone https://github.com/mithi/hexy.git
$ sudo python setup.py install
$ python -m hexy.demo.demo1
$ python -m hexy.demo.demo2
$ python -m hexy.demo.demo3

High Level Usage

Sample usage when running python interpreter from anywhere in your system...

>>> from hexy.robot.hexapod import Hexapod
>>> hexy = Hexapod()
>>> hexy.boot_up()
>>> hexy.walk(swing = 25, repetitions = 10)
>>> hexy.walk(swing = -25, repetitions = 10)
>>> hexy.rotate(offset = 40, repetitions = 7)
>>> hexy.rotate(offset = -40, repetitions = 7)
>>> hexy.shut_down()

Also try this...

>>> from hexy.robot.pro import HexapodPro
>>> hexy = HexapodPro()
>>> hexy.lie_flat()
>>> hexy.get_up()
>>> hexy.shake_head()
>>> hexy.wave()
>>> hexy.point()
>>> hexy.type_stuff()
>>> hexy.lie_down()
>>> hexy.off()

And this :)

>>> from hexy.robot.dancing import DancingHexapod
>>> hexy = DancingHexapod()
>>> hexy.boot_up()
>>> hexy.night_fever()
>>> hexy.default()
>>> hexy.dance_tilt()
>>> hexy.squat(angle = 60)
>>> hexy.thriller()
>>> hexy.lie_down()
>>> hexy.curl_up(die = True)

Low Level Usage

If you want to control the angle of each Joint (hip, knee, ankle) for each Leg you'd want to instantiate a HexapodCore object:

>>> from hexy.robot.core import HexapodCore
>>> hexy = HexapodCore()

Each Leg can be access like this which is based in its position:

hexy.left_front
hexy.left_middle
hexy.left_back
 
hexy.right_front
hexy.right_middle
hexy.right_back
 

Whose three Joints you can individual pose using the pose command, for example:

hexy.right_front.pose(hip_angle = 0, knee_angle = 0, ankle_angle = 0)
hexy.right_front.off() # prevents servo overloading

There are also built-in lists of legs which you can iterate over:

hexy.legs # all six legs
hexy.right_legs 
hexy.left_legs
hexy.tripod1 # left front, right middle left back
hexy.tripod2 # right front, left middle, right back

For example:

for leg in hexy.right_legs:
  leg.hip.pose(angle = 0)
  leg.knee.pose(angle = 0)
  leg.ankle.pose(angle = 0)
  leg.off()

for leg in hexy.tripod1:
  leg.knee.pose(angle = 0)
  leg.knee.off()

You can also pose the neck:

hexy.neck.pose(angle = 90)
hexy.neck.off()

🐳 ☕️ 🧧 Say Thanks!

33Mudy961bUk9zz35p68g9fE3uuHLRduRp
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].