Skip to content

merklebot/wehead-controller

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wehead SDK Readme

Welcome to the Wehead SDK! This SDK provides a straightforward and powerful way to control and interact with your Wehead device through WebSockets. With this toolkit, you can command the Wehead to move, speak, process video, and recognize spoken phrases, all programmatically.

Features

  • Move: Command the Wehead to adjust its camera angle with precision.
  • Speak: Make the Wehead articulate text in a variety of voices.
  • Video Processing: Receive and process video frames from the Wehead in real-time.
  • Speech Recognition Callbacks: Respond to specific phrases that the Wehead detects.

Installation

First, you'll need a valid token. As part of a hackathon, you can use any string as a token.

Before diving into the code, install wehead_hack_sdk:

pip install git+https://github.com/zerodistanceinc/wehead_hack_sdk.git

Debugging with the 3D Simulation

While developing with the Wehead SDK, you might not always have physical access to a Wehead device. Don't worry; we've got you covered with a lifelike 3D simulation environment. This simulation allows you to test and debug your code as if you were interacting with a real Wehead, providing a seamless development experience.

Accessing the 3D Simulation The 3D simulation can be accessed via any modern web browser. Simply navigate to the following URL, replacing YOUR_TOKEN_HERE with your actual authentication token:

https://wehead-landing--yuy2-wp1w4g77.web.app/wehead_call/?dev=1&loc=full&main=1&token=YOUR_TOKEN_HERE

Make sure to use the correct token for authentication. Don't forget to grant access to the camera and microphone!

Getting Started

Initialization

from wehead_hack_sdk import Wehead

token = "YOUR_TOKEN_HERE"
wehead = Wehead(token)

Moving the Wehead

To move the Wehead to a specific pitch and yaw, simply call:

wehead.move(pitch=0.3, yaw=0.3)

Speaking

To make the Wehead speak, use:

wehead.say(text="Hello, world!", voice="shimmer")

Processing Video

Define a callback function that processes video frames. Here's an example that simply displays the video frames using OpenCV:

@wehead.on_video
def process_frame(img):
    cv2.imshow('Wehead Video', img)
    cv2.waitKey(1)

Responding to Spoken Phrases

Similarly, define a callback to handle spoken phrases recognized by the Wehead:

@wehead.on_phrase
def handle_phrase(text):
    print(f"Wehead heard: {text}")

Example

Below is a simple example that integrates everything mentioned above:

import cv2
import time

from wehead_hack_sdk import Wehead

token = "YOUR_TOKEN_HERE"
wehead = Wehead(token)

wehead.move(pitch=0, yaw=0)
wehead.say("Initializing Wehead SDK Example")

@wehead.on_video
def process_frame(img):
    cv2.waitKey(30)
    cv2.imshow('Wehead Video', img)
    cv2.waitKey(30)

@wehead.on_phrase
def handle_phrase(text):
    if text == "Exit.":
        wehead.say("Goodbye")
        time.sleep(1)
        exit()

while True:
    pass  # Keep the script running

Conclusion

This SDK offers a flexible and easy way to interact with your Wehead. Whether you're creating interactive installations, developing a surveillance system, or simply having fun, the Wehead SDK empowers you to bring your creative vision to life. Enjoy exploring the capabilities of your Wehead!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages