<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Get started on LinuxCNC gRPC</title><link>https://doug.sh/docs/linuxcnc-grpc/get-started/</link><description>Recent content in Get started on LinuxCNC gRPC</description><generator>Hugo</generator><language>en</language><atom:link href="https://doug.sh/docs/linuxcnc-grpc/get-started/index.xml" rel="self" type="application/rss+xml"/><item><title>Server setup</title><link>https://doug.sh/docs/linuxcnc-grpc/get-started/server-setup/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://doug.sh/docs/linuxcnc-grpc/get-started/server-setup/</guid><description>&lt;p&gt;Install the server on the LinuxCNC machine, start it and check that it answers.&#10;&lt;a href="https://doug.sh/docs/linuxcnc-grpc/server/"&gt;Server configuration&lt;/a&gt; describes its options.&lt;/p&gt;&#10;&lt;h2 id="requirements"&gt;Requirements&lt;a class="anchor" href="#requirements" aria-label="Link"&gt;&lt;/a&gt;&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;LinuxCNC 2.9 or newer, on a real machine or a simulator configuration (see&#10;&lt;a href="https://doug.sh/docs/linuxcnc-grpc/server/#requirements"&gt;Requirements&lt;/a&gt;).&lt;/li&gt;&#10;&lt;li&gt;Python 3.10 or newer.&lt;/li&gt;&#10;&lt;li&gt;SSH access to the machine, if clients run on another computer.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="install"&gt;Install&lt;a class="anchor" href="#install" aria-label="Link"&gt;&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;On the LinuxCNC machine, install the server into a virtual environment (venv) that can see&#10;LinuxCNC&amp;rsquo;s Python modules:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo apt install python3-venv&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;python3 -m venv --system-site-packages ~/linuxcnc-grpc-venv&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;~/linuxcnc-grpc-venv/bin/pip install linuxcnc-grpc&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;--system-site-packages&lt;/code&gt; is required. It lets the venv import the &lt;code&gt;linuxcnc&lt;/code&gt; and &lt;code&gt;hal&lt;/code&gt; modules&#10;that LinuxCNC installs for the system Python; without it the server fails with&#10;&lt;code&gt;ModuleNotFoundError: No module named 'linuxcnc'&lt;/code&gt;. The package holds both the server and the&#10;Python client library.&lt;/p&gt;</description></item><item><title>Client quickstart</title><link>https://doug.sh/docs/linuxcnc-grpc/get-started/client-quickstart/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://doug.sh/docs/linuxcnc-grpc/get-started/client-quickstart/</guid><description>&lt;p&gt;Install a client library and make the first calls. You need a&#10;&lt;a href="https://doug.sh/docs/linuxcnc-grpc/get-started/server-setup/"&gt;running server&lt;/a&gt;; the programs below reach it at &lt;code&gt;localhost:50051&lt;/code&gt;, on the&#10;LinuxCNC machine itself or through an&#10;&lt;a href="https://doug.sh/docs/linuxcnc-grpc/get-started/server-setup/#connect-from-another-computer"&gt;SSH tunnel&lt;/a&gt;.&lt;/p&gt;&#10;&lt;h2 id="client-installation"&gt;Install a client&lt;a class="anchor" href="#client-installation" aria-label="Link"&gt;&lt;/a&gt;&lt;/h2&gt;&#10;&lt;fieldset class="book-tabs" &gt;&#10;&lt;input type="radio" class="toggle" name="tabs-1" id="tabs-1-0" checked="checked" /&gt;&lt;label for="tabs-1-0"&gt;Python&lt;/label&gt;&lt;div class="book-tabs-content markdown-inner"&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;python3 -m venv venv &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; . venv/bin/activate &lt;span class="c1"&gt;# Debian refuses a plain pip install&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;pip install linuxcnc-grpc&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;input type="radio" class="toggle" name="tabs-1" id="tabs-1-1" /&gt;&lt;label for="tabs-1-1"&gt;Go&lt;/label&gt;&lt;div class="book-tabs-content markdown-inner"&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;go get github.com/dougcalobrisi/linuxcnc-grpc&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Requires Go 1.25 or later.&lt;/p&gt;&#10;&lt;/div&gt;&#10;&lt;input type="radio" class="toggle" name="tabs-1" id="tabs-1-2" /&gt;&lt;label for="tabs-1-2"&gt;Node.js / TypeScript&lt;/label&gt;&lt;div class="book-tabs-content markdown-inner"&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;npm install linuxcnc-grpc&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;input type="radio" class="toggle" name="tabs-1" id="tabs-1-3" /&gt;&lt;label for="tabs-1-3"&gt;Rust&lt;/label&gt;&lt;div class="book-tabs-content markdown-inner"&gt;&#10;&lt;p&gt;Add to &lt;code&gt;Cargo.toml&lt;/code&gt;:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-toml" data-lang="toml"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;dependencies&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;linuxcnc-grpc&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;1.1&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;tokio&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;version&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;1&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;features&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;full&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;tonic&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;0.12&amp;#34;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The crate generates its code at build time, so &lt;code&gt;protoc&lt;/code&gt; must be on the &lt;code&gt;PATH&lt;/code&gt;:&#10;&lt;code&gt;sudo apt install protobuf-compiler&lt;/code&gt; on Debian or Ubuntu, &lt;code&gt;brew install protobuf&lt;/code&gt; on macOS.&lt;/p&gt;&#10;&lt;/div&gt;&#10;&lt;/fieldset&gt;</description></item><item><title>Tutorial: a client on another computer</title><link>https://doug.sh/docs/linuxcnc-grpc/get-started/tutorial/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://doug.sh/docs/linuxcnc-grpc/get-started/tutorial/</guid><description>&lt;p&gt;Connect to a LinuxCNC machine from your development computer, read and stream its status, and&#10;send one MDI command. Each step has the code in Python, Go, Node.js/TypeScript and Rust.&lt;/p&gt;&#10;&lt;h2 id="prerequisites"&gt;Before you start&lt;a class="anchor" href="#prerequisites" aria-label="Link"&gt;&lt;/a&gt;&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;A LinuxCNC machine or simulator with the server installed (see&#10;&lt;a href="https://doug.sh/docs/linuxcnc-grpc/get-started/server-setup/"&gt;Server setup&lt;/a&gt;).&lt;/li&gt;&#10;&lt;li&gt;SSH access from your development computer to that machine. &lt;code&gt;LINUXCNC_IP&lt;/code&gt; below is its&#10;address.&lt;/li&gt;&#10;&lt;li&gt;For step 5 only: a machine that is out of E-stop, on and homed.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h3 id="mdi-preconditions"&gt;What the MDI step needs&lt;a class="anchor" href="#mdi-preconditions" aria-label="Link"&gt;&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;LinuxCNC runs an MDI move only on a machine that is out of E-stop, on, homed and in MDI mode.&#10;Take the machine out of E-stop, turn it on and home it at the machine or in its GUI. The&#10;programs in step 5 never do that. Each one does this:&lt;/p&gt;</description></item></channel></rss>