Buckets:

download
raw
39.9 kB
<meta charset="utf-8" /><meta name="hf:doc:metadata" content="{&quot;title&quot;:&quot;Python SDK Reference&quot;,&quot;local&quot;:&quot;python-sdk-reference&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;Movement&quot;,&quot;local&quot;:&quot;movement&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;Basic Control ( goto_target )&quot;,&quot;local&quot;:&quot;basic-control--gototarget-&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;Instant Control ( set_target )&quot;,&quot;local&quot;:&quot;instant-control--settarget-&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Sensors &amp; Media&quot;,&quot;local&quot;:&quot;sensors--media&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;Camera 📷&quot;,&quot;local&quot;:&quot;camera-&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;Head Tracking 👀&quot;,&quot;local&quot;:&quot;head-tracking-&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;IMU 🧭&quot;,&quot;local&quot;:&quot;imu-&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;Audio 🎙️ 🔊&quot;,&quot;local&quot;:&quot;audio--&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Media Backend Options&quot;,&quot;local&quot;:&quot;media-backend-options&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Recording Moves&quot;,&quot;local&quot;:&quot;recording-moves&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Next Steps&quot;,&quot;local&quot;:&quot;next-steps&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;❓ Troubleshooting&quot;,&quot;local&quot;:&quot;-troubleshooting&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2}],&quot;depth&quot;:1}"/>
<link href="/docs/reachy_mini/main/en/_app/immutable/entry/start.CaCMltcp.js" rel="modulepreload">
<link href="/docs/reachy_mini/main/en/_app/immutable/chunks/CioKYNPA.js" rel="modulepreload">
<link href="/docs/reachy_mini/main/en/_app/immutable/chunks/C8hBS0k6.js" rel="modulepreload">
<link href="/docs/reachy_mini/main/en/_app/immutable/entry/app.GHiBsmqr.js" rel="modulepreload">
<link href="/docs/reachy_mini/main/en/_app/immutable/chunks/E2PPb4Fw.js" rel="modulepreload">
<link href="/docs/reachy_mini/main/en/_app/immutable/chunks/oLGzWjMj.js" rel="modulepreload">
<link href="/docs/reachy_mini/main/en/_app/immutable/chunks/DsnmJJEf.js" rel="modulepreload">
<link href="/docs/reachy_mini/main/en/_app/immutable/chunks/BpBOpnoR.js" rel="modulepreload">
<link href="/docs/reachy_mini/main/en/_app/immutable/nodes/0.DWdoqfkp.js" rel="modulepreload">
<link href="/docs/reachy_mini/main/en/_app/immutable/chunks/Blm4h8_Y.js" rel="modulepreload">
<link href="/docs/reachy_mini/main/en/_app/immutable/nodes/17.Cg18rNM5.js" rel="modulepreload">
<link href="/docs/reachy_mini/main/en/_app/immutable/chunks/-d-7P7wx.js" rel="modulepreload">
<!--1csb423--><meta name="hf:doc:metadata" content="{&quot;title&quot;:&quot;Python SDK Reference&quot;,&quot;local&quot;:&quot;python-sdk-reference&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;Movement&quot;,&quot;local&quot;:&quot;movement&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;Basic Control ( goto_target )&quot;,&quot;local&quot;:&quot;basic-control--gototarget-&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;Instant Control ( set_target )&quot;,&quot;local&quot;:&quot;instant-control--settarget-&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Sensors &amp; Media&quot;,&quot;local&quot;:&quot;sensors--media&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;Camera 📷&quot;,&quot;local&quot;:&quot;camera-&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;Head Tracking 👀&quot;,&quot;local&quot;:&quot;head-tracking-&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;IMU 🧭&quot;,&quot;local&quot;:&quot;imu-&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;Audio 🎙️ 🔊&quot;,&quot;local&quot;:&quot;audio--&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Media Backend Options&quot;,&quot;local&quot;:&quot;media-backend-options&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Recording Moves&quot;,&quot;local&quot;:&quot;recording-moves&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Next Steps&quot;,&quot;local&quot;:&quot;next-steps&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;❓ Troubleshooting&quot;,&quot;local&quot;:&quot;-troubleshooting&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2}],&quot;depth&quot;:1}"/><!---->
<link href="/docs/reachy_mini/main/en/_app/immutable/assets/0.tn0RQdqM.css" rel="modulepreload"> <!--[--><!--[0--><!--[--><!--[0--><!--[--><p></p> <div class="items-center shrink-0 min-w-[100px] max-sm:min-w-[50px] justify-end ml-auto flex" style="float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"><div class="inline-flex rounded-md max-sm:rounded-sm"><button class="inline-flex items-center gap-1 h-7 max-sm:h-7 px-2 max-sm:px-1.5 text-sm font-medium text-gray-800 border border-r-0 rounded-l-md max-sm:rounded-l-sm border-gray-200 bg-white hover:shadow-inner dark:border-gray-850 dark:bg-gray-950 dark:text-gray-200 dark:hover:bg-gray-800" aria-live="polite"><span class="inline-flex items-center justify-center rounded-md p-0.5 max-sm:p-0 hover:text-gray-800 dark:hover:text-gray-200"><svg class="sm:size-3.5 size-3" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----></span> <span>Copy page</span></button> <button class="inline-flex items-center justify-center w-6 max-sm:w-5 h-7 max-sm:h-7 disabled:pointer-events-none text-sm text-gray-500 hover:text-gray-700 dark:hover:text-white rounded-r-md max-sm:rounded-r-sm border border-l transition border-gray-200 bg-white hover:shadow-inner dark:border-gray-850 dark:bg-gray-950 dark:text-gray-200 dark:hover:bg-gray-800" aria-haspopup="menu" aria-expanded="false" aria-label="Open copy menu"><svg class="transition-transform text-gray-400 overflow-visible sm:size-3.5 size-3 rotate-0" width="1em" height="1em" viewBox="0 0 12 7" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 1L6 6L11 1" stroke="currentColor"></path></svg><!----></button></div> <!--[-1--><!--]--></div><!----> <!--[0--><h1 class="relative group"><a id="python-sdk-reference" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#python-sdk-reference"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Python SDK Reference</span></h1><!--]--><!----> <blockquote><p><strong>Heads up:</strong> The Python and <strong><a href="javascript-sdk">JavaScript</a></strong> SDKs both give you full control of the robot — they simply target different audiences. If you want to build apps that are easy to share (zero-install, open a link in a browser), the JavaScript/Web path is usually the better fit. The Python SDK shines for scripting, control loops, and code running directly on the robot.</p></blockquote> <blockquote><p><strong>💡 Reminder:</strong> The SDK now auto-detects whether it should connect over USB/localhost or over the network, so <code>ReachyMini()</code> works out of the box. You can still force a mode with <code>ReachyMini(connection_mode="localhost_only" | "network")</code> if needed.</p></blockquote> <!--[1--><h2 class="relative group"><a id="movement" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#movement"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Movement</span></h2><!--]--><!----> <!--[2--><h3 class="relative group"><a id="basic-control--gototarget-" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#basic-control--gototarget-"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Basic Control ( goto_target )</span></h3><!--]--><!----> <p>Smooth interpolation between points. You can control <code>head</code>, <code>antennas</code>, and <code>body_yaw</code>.</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copied</div><!----></button><!----></div> <pre class="language-python "><!----><span class="hljs-keyword">from</span> reachy_mini <span class="hljs-keyword">import</span> ReachyMini
<span class="hljs-keyword">from</span> reachy_mini.utils <span class="hljs-keyword">import</span> create_head_pose
<span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np
<span class="hljs-keyword">with</span> ReachyMini() <span class="hljs-keyword">as</span> mini:
<span class="hljs-comment"># Move everything at once</span>
mini.goto_target(
head=create_head_pose(z=<span class="hljs-number">10</span>, mm=<span class="hljs-literal">True</span>), <span class="hljs-comment"># Up 10mm</span>
antennas=np.deg2rad([<span class="hljs-number">45</span>, <span class="hljs-number">45</span>]), <span class="hljs-comment"># Antennas out</span>
body_yaw=np.deg2rad(<span class="hljs-number">30</span>), <span class="hljs-comment"># Turn body</span>
duration=<span class="hljs-number">2.0</span>, <span class="hljs-comment"># Take 2 seconds</span>
method=<span class="hljs-string">&quot;minjerk&quot;</span> <span class="hljs-comment"># Smooth acceleration</span>
)<!----></pre></div><!----> <p><strong>Interpolation methods:</strong> <code>linear</code>, <code>minjerk</code> (default), <code>ease_in_out</code>, <code>cartoon</code>.</p> <!--[2--><h3 class="relative group"><a id="instant-control--settarget-" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#instant-control--settarget-"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Instant Control ( set_target )</span></h3><!--]--><!----> <p>Bypasses interpolation. Use this for high-frequency control (e.g., following a joystick or generated trajectory).</p> <!--[1--><h2 class="relative group"><a id="sensors--media" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#sensors--media"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Sensors &amp; Media</span></h2><!--]--><!----> <p>The media architecture is described in detail in the <a href="media-architecture">Media Architecture</a> section. Although accesssing audio and video from the SDK is similar across Reachy Mini versions, the underlying implementation differs.</p> <!--[2--><h3 class="relative group"><a id="camera-" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#camera-"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Camera 📷</span></h3><!--]--><!----> <p>The frames of the camera can be accessed as follows :</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copied</div><!----></button><!----></div> <pre class="language-python "><!----><span class="hljs-keyword">from</span> reachy_mini <span class="hljs-keyword">import</span> ReachyMini
<span class="hljs-keyword">with</span> ReachyMini(media_backend=<span class="hljs-string">&quot;default&quot;</span>) <span class="hljs-keyword">as</span> mini:
frame = mini.media.get_frame()<!----></pre></div><!----> <p>The returned frame is a numpy array with shape <code>(height, width, 3)</code> and data type <code>uint8</code>.</p> <!--[2--><h3 class="relative group"><a id="head-tracking-" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#head-tracking-"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Head Tracking 👀</span></h3><!--]--><!----> <p>The daemon can track the closest face and turn the head to follow it (aiming at the nose). Detection runs inside the daemon.</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copied</div><!----></button><!----></div> <pre class="language-python "><!----><span class="hljs-keyword">from</span> reachy_mini <span class="hljs-keyword">import</span> ReachyMini
<span class="hljs-keyword">with</span> ReachyMini() <span class="hljs-keyword">as</span> mini:
mini.start_head_tracking()
face = mini.get_tracked_face() <span class="hljs-comment"># detected, x, y in [-1, 1], roll</span>
mini.stop_head_tracking()<!----></pre></div><!----> <p><code>start_head_tracking(weight=...)</code> blends tracking with application motion: <code>1.0</code> lets tracking own the head, <code>0.0</code> pauses detection (freeing the head and CPU) without stopping the tracker, so applications can toggle it cheaply per turn. See the <a href="../examples/head_tracking">Head Tracking example</a>.</p> <!--[2--><h3 class="relative group"><a id="imu-" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#imu-"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>IMU 🧭</span></h3><!--]--><!----> <blockquote><p>⚠️ The IMU is only available with the wireless version of Reachy Mini</p></blockquote> <p>Take a look at <a href="https://github.com/pollen-robotics/reachy_mini/tree/main/examples/imu_example.py" rel="nofollow">this example</a></p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copied</div><!----></button><!----></div> <pre class="language-python "><!----><span class="hljs-keyword">with</span> ReachyMini() <span class="hljs-keyword">as</span> mini:
imu_data = mini.imu
accel_x, accel_y, accel_z = imu_data[<span class="hljs-string">&quot;accelerometer&quot;</span>] <span class="hljs-comment"># (m/s^2)</span>
gyro_x, gyro_y, gyro_z = imu_data[<span class="hljs-string">&quot;gyroscope&quot;</span>] <span class="hljs-comment"># (rad/s)</span>
quat_w, quat_x, quat_y, quat_z = imu_data[<span class="hljs-string">&quot;quaternion&quot;</span>] <span class="hljs-comment"># (w, x, y, z)</span>
temperature = imu_data[<span class="hljs-string">&quot;temperature&quot;</span>] <span class="hljs-comment"># (°C)</span>
<!----></pre></div><!----> <!--[2--><h3 class="relative group"><a id="audio--" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#audio--"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Audio 🎙️ 🔊</span></h3><!--]--><!----> <p>Audio inputs (microphones) and outputs (speaker) is handled as follows:</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copied</div><!----></button><!----></div> <pre class="language-python "><!----><span class="hljs-keyword">from</span> reachy_mini <span class="hljs-keyword">import</span> ReachyMini
<span class="hljs-keyword">from</span> scipy.signal <span class="hljs-keyword">import</span> resample
<span class="hljs-keyword">import</span> time
<span class="hljs-keyword">with</span> ReachyMini(media_backend=<span class="hljs-string">&quot;default&quot;</span>) <span class="hljs-keyword">as</span> mini:
<span class="hljs-comment"># Initialization - After this point, both audio devices (input/output) will be seen as busy by other applications!</span>
mini.media.start_recording()
mini.media.start_playing()
<span class="hljs-comment"># Record</span>
samples = mini.media.get_audio_sample()
<span class="hljs-comment"># Resample (if needed)</span>
samples = resample(samples, mini.media.get_output_audio_samplerate()*<span class="hljs-built_in">len</span>(samples)/mini.media.get_input_audio_samplerate())
<span class="hljs-comment"># Play</span>
mini.media.push_audio_sample(samples)
time.sleep(<span class="hljs-built_in">len</span>(samples) / mini.media.get_output_audio_samplerate())
<span class="hljs-comment"># Get Direction of Arrival</span>
<span class="hljs-comment"># 0 radians is left, π/2 radians is front/back, π radians is right.</span>
doa, is_speech_detected = mini.media.get_DoA()
<span class="hljs-built_in">print</span>(doa, is_speech_detected)
<span class="hljs-comment"># Release audio devices (input/output)</span>
mini.media.stop_recording()
mini.media.stop_playing()<!----></pre></div><!----> <p><strong>Audio data format:</strong></p> <ul><li><code>get_audio_sample()</code> returns a numpy array with shape <code>(samples, 2)</code> and data type <code>float32</code>, sampled at 16kHz.</li> <li><code>push_audio_sample()</code> expects a numpy array with shape <code>(samples, 1 or 2)</code> and data type <code>float32</code>, sampled at 16kHz.</li></ul> <p>In both cases, the channels and samplerate information can be reliably retrieved with <code>get_input/output_audio_samplerate()</code> and <code>get_input/output_channels()</code>.</p> <blockquote><p><strong>⚠️ Note:</strong> <code>push_audio_sample()</code> is non-blocking, meaning it returns immediately while audio plays in the background. If you need to wait for playback completion, calculate the duration based on sample length and sample rate.</p></blockquote> <!--[1--><h2 class="relative group"><a id="media-backend-options" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#media-backend-options"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Media Backend Options</span></h2><!--]--><!----> <p>Choose the appropriate media backend based on your Reachy Mini version and requirements:</p> <ul><li><code>media_backend="default"</code> - Auto-detects the best backend: LOCAL when running on the same machine as the daemon, WEBRTC when remote (recommended for most users).</li> <li><code>media_backend="local"</code> - Forces the LOCAL backend (GStreamer IPC camera + GStreamer audio). Use when running on the same machine as the daemon.</li> <li><code>media_backend="webrtc"</code> - Forces the WEBRTC backend. The daemon streams H.264 video and Opus audio over WebRTC to the client.</li> <li><code>media_backend="no_media"</code> - Deactivates the media manager and tells the daemon to release camera and audio hardware. Use this when you need direct access via OpenCV, sounddevice, or any other external library. The hardware is automatically re-acquired when the context manager exits. See <a href="media-architecture#disabling-media--direct-hardware-access">Media Architecture - Disabling Media</a> and the <a href="../examples/custom_media_manager">Custom Media Manager</a> example.</li></ul> <blockquote><p><strong>💡 Tip:</strong> For most setups, the backend is automatically selected based on whether you’re running locally or remotely. No need to specify the <code>media_backend</code> value!</p></blockquote> <blockquote><p><strong>💡 Tip:</strong> The WebRTC backend requires GStreamer to be installed on the client machine. See <a href="gstreamer-installation">GStreamer Installation</a>. For now only Linux is fully supported as a remote client. Other platforms (Windows, macOS) will be supported in <a href="https://github.com/pollen-robotics/reachy_mini/issues/572" rel="nofollow">future releases</a>.</p></blockquote> <!--[1--><h2 class="relative group"><a id="recording-moves" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#recording-moves"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Recording Moves</span></h2><!--]--><!----> <p>You can record a motion by moving the robot (compliant mode) or sending commands, and save it for later replay.</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copied</div><!----></button><!----></div> <pre class="language-python "><!----><span class="hljs-keyword">from</span> reachy_mini <span class="hljs-keyword">import</span> ReachyMini
<span class="hljs-keyword">with</span> ReachyMini() <span class="hljs-keyword">as</span> mini:
mini.start_recording()
<span class="hljs-comment"># ... robot moves ...</span>
recorded_data = mini.stop_recording()<!----></pre></div><!----> <!--[1--><h2 class="relative group"><a id="next-steps" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#next-steps"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Next Steps</span></h2><!--]--><!----> <ul><li><strong><a href="https://github.com/pollen-robotics/reachy_mini/tree/main/examples" rel="nofollow">Browse the Examples Folder</a></strong></li> <li><strong><a href="integration">AI Integrations</a></strong>: Connect LLMs, build Apps, and publish to Hugging Face.</li> <li><strong><a href="core-concept">Core Concepts</a></strong>: Architecture, coordinate systems, and safety limits.</li></ul> <!--[1--><h2 class="relative group"><a id="-troubleshooting" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#-troubleshooting"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>❓ Troubleshooting</span></h2><!--]--><!----> <p>Encountering an issue? 👉 <strong><a href="../troubleshooting">Check the Troubleshooting &amp; FAQ Guide</a></strong></p> <a class="!text-gray-400 !no-underline text-sm flex items-center not-prose mt-4" href="https://github.com/pollen-robotics/reachy_mini/blob/main/docs/source/SDK/python-sdk.md" target="_blank"><svg class="mr-1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M31,16l-7,7l-1.41-1.41L28.17,16l-5.58-5.59L24,9l7,7z"></path><path d="M1,16l7-7l1.41,1.41L3.83,16l5.58,5.59L8,23l-7-7z"></path><path d="M12.419,25.484L17.639,6.552l1.932,0.518L14.351,26.002z"></path></svg><!----> <span><span class="underline">Update</span> on GitHub</span></a><!----> <p></p><!--]--><!----><!--]--><!--]--><!--]--> <!--[-1--><!--]--><!--]-->
<script>
{
__sveltekit_2s1w0q = {
base: "/docs/reachy_mini/main/en",
assets: "/docs/reachy_mini/main/en"
};
const element = document.currentScript.parentElement;
Promise.all([
import("/docs/reachy_mini/main/en/_app/immutable/entry/start.CaCMltcp.js"),
import("/docs/reachy_mini/main/en/_app/immutable/entry/app.GHiBsmqr.js")
]).then(([kit, app]) => {
kit.start(app, element, {
node_ids: [0, 17],
data: [null,null],
form: null,
error: null
});
});
}
</script>

Xet Storage Details

Size:
39.9 kB
·
Xet hash:
8ac203ad6317ac43d8307d6d932ab84331cc92041741bc15c927ec6c4cf79aa6

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.