# Set Up Genesis Locally: Power Your Robotics and AI Simulations ## Metadata - **Published:** 12/26/2024 - **Duration:** 17 minutes - **YouTube URL:** https://youtube.com/watch?v=eEZp7yuup0U - **Channel:** nerding.io ## Description Discover how to install Genesis, a cutting-edge physics engine designed for robotics and AI simulations, in this detailed guide. Genesis is an open-source platform offering advanced physics simulation, motion planning, and photo-realistic rendering, all optimized for cross-platform use on Linux, macOS, and Windows. This tutorial covers: - Prerequisites: Preparing your system with Python 3.9+ and PyTorch. - Core Installation: Easily install Genesis with a single pip command. - Examples: Enable motion planning, fluid simulation, drones, back flipping robots and soft robotics Whether you're developing robotics projects or exploring embodied AI, this video equips you to leverage Genesis for high-performance, realistic simulations on your hardware. Links to documentation and additional tools are included in the description! ๐Ÿ‘‰๐Ÿป Text Yourself: https://textyourself.app ๐Ÿ“ฐ Newsletter: https://sendfox.com/nerdingio ๐Ÿ“ž Book a Call: https://calendar.app.google/M1iU6X2x18metzDeA ๐ŸŽฅ Chapters 00:00 Introduction 01:18 Setup 02:55 Enironment 04:17 Render on Mac OS 06:57 Fluid Movement 09:11 Drone 10:40 Backflip 14:09 Bonus: Soft Robots ๐Ÿ”— Links https://github.com/Genesis-Embodied-AI/Genesis https://genesis-world.readthedocs.io/en/latest/user_guide/overview/installation.html https://pytorch.org/get-started/locally/ https://genesis-world.readthedocs.io/en/latest/api_reference/index.html โคต๏ธ Let's Connect https://nerding.io https://twitter.com/nerding_io https://www.linkedin.com/in/jdfiscus/ https://everefficient.ai https://www.linkedin.com/company/ever-efficient-ai/ ## Key Highlights ### 1. Genesis Project Overview Genesis is a physics engine for robotics and AI simulation, allowing testing of interactions in a physics-based environment. It supports robots, liquids, and soft bodies. ### 2. Local Mac Setup Hurdles Setting up Genesis locally on a Mac requires specific configurations, especially specifying CPU backend instead of GPU, and running the visualizer in a separate thread. ### 3. Key Configuration Steps Essential configurations include: setting 'backend' to 'GS CPU', utilizing the visualization parameter, and executing the simulation in a separate thread for Mac OS. ### 4. Soft Robotics Simulation Genesis allows simulation of Soft Robotics which are notoriously difficult. The 'worm' example demonstrates muscle expansion and movement in a physics environment. ### 5. Importance of Documentation Successfully running Genesis requires consulting the documentation, understanding the examples provided, and adapting them for your specific needs, particularly on different platforms. ## Summary ## Genesis Physics Engine Setup: Video Summary **1. Executive Summary:** This video provides a tutorial on installing and using Genesis, an open-source physics engine for robotics and AI simulations, focusing on setting it up locally on macOS. The guide covers necessary configurations, showcases various examples including fluid simulation, drones, backflipping robots, and soft robotics, and emphasizes the importance of documentation. **2. Main Topics Covered:** * **Introduction to Genesis:** Overview of the Genesis physics engine and its capabilities for simulating robotics, AI applications, and other physics-based environments. * **Prerequisites and Installation:** Step-by-step guide to installing Genesis, including Python 3.9+ and PyTorch setup, and using `pip install`. * **macOS Configuration:** Specific configurations needed for running Genesis locally on macOS, especially using the CPU backend and running the visualizer in a separate thread. * **Example Demonstrations:** Showcasing various examples provided by Genesis, including fluid simulation, drone flight trajectory simulation, backflipping robot simulation, and soft robotics (worm) simulation. * **Documentation and API Reference:** Highlighting the importance of consulting the Genesis documentation and API reference for successful implementation and customization. **3. Key Takeaways:** * Genesis is a powerful, cross-platform physics engine useful for robotics and AI simulations. * Local macOS setup requires specific configurations: `backend` to `GS CPU`, `visualization` parameter enabled, and simulation run in a separate thread. * Genesis offers a wide range of example simulations, including robots, liquids, and soft bodies, providing a good starting point for experimentation. * Understanding the documentation and API reference is crucial for customizing and troubleshooting Genesis. * Soft robotics simulation, exemplified by the 'worm' example, demonstrates the advanced capabilities of Genesis. **4. Notable Quotes or Examples:** * "Genesis is a physics engine that you can actually test different things like Robotics and even AI applications." * "Setting up Genesis locally on a Mac requires specific configurations, especially specifying CPU backend instead of GPU, and running the visualizer in a separate thread." * Key configurations include: setting 'backend' to 'GS CPU', utilizing the visualization parameter, and executing the simulation in a separate thread for Mac OS. * "Genesis allows simulation of Soft Robotics which are notoriously difficult. The 'worm' example demonstrates muscle expansion and movement in a physics environment." * "Successfully running Genesis requires consulting the documentation, understanding the examples provided, and adapting them for your specific needs, particularly on different platforms." * Examples include simulating a drone following a flight trajectory, a robot performing a single or double backflip, and a soft robot worm moving within a bounded space. **5. Target Audience:** * Robotics researchers and developers * AI researchers and developers, particularly those interested in embodied AI * Students learning about physics simulation and robotics * Anyone interested in using a physics engine for simulating robots, liquids, and soft bodies. ## Full Transcript hey everyone welcome to nerding IO I'm JD and today we're going to be taking a look at Genesis a physics engine that you can actually use on Robotics and different AI applications with that let's go ahead and get started so if you haven't seen The Genesis Project yet it's a physics engine that you can actually test different things like Robotics and even AI applications or different video uh so you you can see here like liquid or here like threedimensional objects and so what's really cool about this is that you can basically test things in a physics environment right so like we'll see an example of how these particles are going to be affected by the world and the physics around them and what we're going to do is we're going to take some of the examples that they have and we'll actually run them locally on a Mac and so that's a little bit more complicated than uh just running them straight out of the box because there's a a couple different configurations that we have to get set up but you can see even on this how things are getting like pressed together and with that let's jump over to their repo and we'll uh start getting things up so we're going to take a look at their docks and their repository but there's some important things to know so what they're trying to do is lower the barrier of Entry to actually running physics and simulations for robotic research and uh ai ai applications it's incredibly fast and it works across platform we're actually going to look at what this means because even though it can run on Apple's uh bare metal there's some some different tweaks that you have to do to actually get this run locally it can also load in a wide range of robots so the things that I found super interesting was the robot arm a leged robot we're going to look at a drone and then soft robots soft robots are incredibly difficult so the fact that we can actually load those types of files in whether they be UDF or even a STL file is super impressive so the first thing that we're going to do is we're actually going to go look at the installation and we're going to see here that two things uh are important one it doesn't have a visualizer on Windows it does work on Linux and Mac but to get this visualizer to actually work it's a little interesting uh the other piece is that you have to have P torch installed and then really all you need to do is PIP install so uh I wanted to get this in an environment so I'm actually going to use cond but if you use pytorch you can actually go they have tons of different installations that you can leverage but let's let go ahead and get started so you have to clone the repo down it comes with a full folder of examples and we're going to actually look at what that means to get our environment started though we need to run AA and then we're creating the Genesis environment we want it to be on Pi uh python 11 or 311 uh has to be 3.9 or higher we're going to activate then we're going to install the uh P torch and every it's requirements and then we're going to do a pip install so I already have this installed and I wanted to show you what actually happens if you try and run this without um understanding how it works real quick everyone if you haven't already please remember to like And subscribe helps more than you know also take a look at text yourself today's sponsor which is a simple application that allows you to text yourself reminders even set up recurring reminders and you can even then set up a randomize feature which will randomly send you Spurs of inspiration with that let's get back to it so you can see right here I'm in my Genesis environment and I'm going to go ahead and I will do one that I know I haven't tried which is python tutorials SP liquid I'll just go ahead and hit enter and it's trying to run but it immediately hits this get GPU device error and what that means is that we are not on a GPU that's accurate even though we're on a silicon Mac we're definitely not on a GPU however they have this example of a render on Mac so we're going to take a look at what is actually different between something like this and render and right away we can see our in it is different it's also inside of a a main function and we're going to figure out why that is so first this is this back end is letting us know what this actually needs to run on so in order to run this locally when you're not on a GPU you have to actually tell the back end explicitly that it is not a GPU because it defaults to a GPU here so we're going to say backend equals GS CPU the another important thing to note is this visualization parameter so what this is stating is that if this- V then we have this viig viz argument that is going to be equal True by default it's false if you scroll down you can actually see this visualization has to be run in a different thread so that's incredibly important so what we can say is we can use the this tool to run in a different thread and then what do we want to run we actually want to run this simulation which means that we're going to make it run for x amount of time and if it is enabled uh then stop right and so those three pieces are incredibly important to get things to run so we'll try and see if we can just run the python renderer on Mac and then we need our Dash V and we'll go ahead and launch this cool and all it's doing is it has a robot arm that falls uh but you could actually see the collision and you could see how the robot was B bounced that pretty interesting so now what we're going to do is we're actually going to see a couple different uh a couple different examples so we'll look at this liquid one I've went ahead and changed this so again we need our run simulation right so we can tell it that we're going to run this function of our scene and then if enabled we will run and stop we're going to change our GPU here we're going to add our viz parameter and now we can see how the scene is built so you can see the different simulations that are going on here the amount of entities that is going to build and then again we're actually running this simulation in a different thread so let's go ahead and run this one now if we do python PB and we keep our Dash V it's building our components and now cool and now it's starting to load and you can actually see the components being built they're inside the bounding box and they're acting like a liquid all these different particles are acting like a liquid inside the bounding box of the world and you can actually look at different instructions keyboard instructions that you can use so if we wanted to reset the camera we could do that if we wanted to record a video or take a screenshot we can do that uh f11 is not really working too well on a Mac unless you're using option uh or function and then we can also look at the face and the vertex uh so if we turn on face you can actually see all of the different particles and same with the vertex right it's very similar so now what we're going to do is we've seen how this is actually how liquid is behaving in a physics environment so we're actually going to go and look at a couple different other ones so so same kind of thing I've actually gone ahead and applied different uh the the three pieces that we need to so there's a bunch of different examples that you can go in and try this on I wanted to show this drone one specifically because it has a pickle file and so we're going to apply the same things right we need to have our CPU we want to have our visualization parameter we're making sure we're inside a function so that we can run this in another thread we have our trajectory which is actually loading the flight trajectory of the pickle file and then we have for Mac OS right we are actually running this in another thread again having the Run Sim so let's go ahead and CD into drone and now we will do a python uh fly DV all right and now we have the flo that or the Drone that's actually lifting off and flying to the right again staying within the bounding box and we saw with the physics of the liquid before we could actually add different uh objects or different parameters that maybe would push the Drone or have wind apply against it depending on what it's trying to do with its trajectory so this would this is a really great way to to test different robotics now we're going to do uh another one and we're going to do this go back flip and so this actually requires a little bit more setup again we need to make sure we have two functions we have our main we're going to have our visualization like we did before we have to make sure that we use the CPU for the back end because that's what we are on and then down here again we need to have our running another thread as well are running simulator function but there's something else so in the instructions it actually tells you to go to this Google Drive and download the two PT uh files so there's two of them there's a double and there's a single and we're going to see what both of those do so if we go into our backflip if we've noticed there's also this parameter that says uh I don't know if this means experience or experiment but the XP name is single uh but we know that our file name is double so if we look down here all it's saying is that we were looking for that file name so if we go to our backflip and now what we're going to do is we're going to do python go and we can either do the XP or the the single um oops too far and we'll go ahead and see what this does so again loading everything up cool and now we have a robot doing a back flip again I find it interesting it's starting you can kind of see it's it's going to the to the right a little bit so depending on how the joints and the the physics around the robot in this world and how it lands is uh supposed is surprisingly realistic right so now let's go and do a e double so we can see the checkpoints for this file all right and now oh we've got it doing a double back flip again it starts off and you can kind of see it coming to the right and how it twists based on the physics that are being applied to the robot like watch its back legs kind of crazy so I just thought this was really interesting and this is a way to get everything set up and working on the Mac again it's it's a little little tricky but um you just have to to read the docs and use the render Mac as kind of like your Baseline make sure you have the CPU on and make sure that you're running your simulation in a different thread uh love to see what you do and build and they have their API reference of how you can go through and build the scenes the simulators again you should dive into all the different tutorials that they have here from different renderings to coupling of uh even like cloth or cubes and how those things mesh in morph so I also wanted to show the uh worm so it's uh this is an example of like Soft Robotics or or it could be applied to Soft Robotics which uh is incredibly difficult um and so again we're going to be doing the same thing we're we're going to be looking at running the Sim we're going to be adding our visualization we've changed our init to the CPU and then uh again we have to run the simulation in another thread so uh this one if you're in tutorials you can go ahead and do python Advanced worm DV and I've noticed this one's a little slower to to load so uh just be patient with this all right and it's it's kind of hard to even see but it's actually moving a little bit you can kind of see it even like the textures in the skin and like the the muscles expanding all of that is being done with the the physics engine so you can imagine if this was a soft robot and it was trying to grip something for instance or maneuver around in a way that is par difficult for um for a hand or something to grab on you can kind of expand the elasticity elasticity of the the robot and operate more like a soft robotic or worm uh that can kind of morph its uh structure you can even see it's running into the the bounding box uh here so again incredibly difficult to do I thought this was really cool um uh and yeah all right everyone that's it for us today what we went through was The Genesis Project getting it set up locally on the Mac and then running through some of the examples happy nering --- *Generated for LLM consumption from nerding.io video library*