This is the code for the Voice and grasping of the can. We are running the policy running a bash file that we put in our Lerobot folder because we couldn't make it work in code in time.
For the movement script, it should still work with the oirignal repo, but some changes were made to the lreobot repository that still need to be tracked. We'll link a fork of the repo with our changes soon.
The robot is also scanning for vulnerabilities in the network as we where thinking that on the beach there are a lot of vulnerabilities, but we didn't put in on the demo.
I don't think the project is runnable easily in it's entirety, please reach out if you need help or want to try. We will at least push all the used code to the folder today or tomorow. And then try to make it runnable all together one day maybe (we don't have the robot at home so hard to test)
SANDEE (Smart Autonomous Navigation and Debris Extraction Entity) is a beach-cleaning robot built for a hackathon. It combines speech recognition, natural language processing, and text-to-speech capabilities to create an interactive experience while cleaning beaches.
- Voice interaction using OpenAI's Whisper for speech recognition and ElevenLabs for text-to-speech
- Natural conversation using Mistral AI's language models
- Automatic switching between conversation mode and cleaning mode
- Object detection to identify and collect trash on beaches
-
Clone this repository
-
Install the required dependencies:
pip install -r requirements.txt -
Set up API keys as environment variables:
export OPENAI_API_KEY=your_openai_api_key export ELEVEN_LABS_API_KEY=your_elevenlabs_api_key export MISTRAL_API_KEY=your_mistral_api_keyAlternatively, you can pass the API keys directly when creating the agent.
Run the beach robot agent:
python beach_robot_agent.py
The robot will:
- Greet you and engage in conversation
- Listen for your voice input
- Process your input using Mistral AI
- Respond through ElevenLabs text-to-speech
- Eventually transition to cleaning mode when appropriate
- Detect and collect trash on the beach
Pleasse note for the object scanning to work, you need to insert a mistral API key. For just the movement, you can remove any references to the function analyze_image_in_context().
You must first install lerobot and place the sandy_navigator.py script inside the scripts folder.
python lerobot/scripts/sandy_navigator.py --duration 0.25 --camera "/dev/device2/"
You can find the code & algorithm for the movement inside the sandy_navigator.py file in the analyze_image_for_sand(frame) function.
speech_to_text.py: Client for OpenAI's Whisper API for speech recognitioneleven_labs_client.py: Client for ElevenLabs text-to-speech APImistral_client.py: Client for Mistral AI's language modelsbeach_robot_agent.py: Main agent integrating all componentssandy_navigator.py: Handles the movement and object detection.
Here is a brief overview of the movement algorithm:
- First identifies the predominant shade of yellow in the bottom 20% of the image (floor), then detects similar colors throughout the image.
- The image is split horizontally into left and right halves.
- Calculate the ratio of these pixels in each half.
- Compare ratios and make decision
Ratio Decision Making:
- If right side has almost no yellow (below minimum threshold) AND left has some, rotato left
- If left side has significantly more yellow than right side, rotate left
- If both sides have minimal sand content, rotate left
- Otherwise, go right
To extend the project with object detection and robot control:
- Implement the object detection module using a segmentation model
- Integrate with the robot's movement controls
- Implement the trash pickup policy and arm movement
- Connect everything through the
start_cleaning()method in theBeachRobotAgentclass
This project is open source and available under the MIT License.