Skip to content

Commit

Permalink
deploy: 827257b
Browse files Browse the repository at this point in the history
  • Loading branch information
andyblarblar committed Jan 12, 2024
1 parent c592399 commit 6277af0
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 24 deletions.
4 changes: 2 additions & 2 deletions kart.html
Original file line number Diff line number Diff line change
Expand Up @@ -274,14 +274,14 @@ <h2 id="the-code"><a class="header" href="#the-code">The code</a></h2>
</code></pre>
<p>Feel free to explore the other methods on the class, as they allow for movement in other ways, such as in reverse.</p>
<p>While this high level API is all you will be working with for the autonomy, I want to briefly show how its implemented:</p>
<pre><code class="language-c++"> /// Sets the esc to power forward with some 0.0-1.0 percent.
<pre><code class="language-c++">
/// Sets the esc to power forward with some 0.0-1.0 percent.
void set_forward(float power) const {
assert(power &lt;= 1.0 &amp;&amp; power &gt;= 0.0);

// Forward is 1.5-2.0ms periods
auto value = uint16_t(((1.5 + power * 0.5) / period) * max_pwm_duty);
analogWrite(pwm_pin, value);
}
</code></pre>
<p>As you can see, its actually rather simple, thanks to Arduino. I want to untangle that second line for you, since
there's
Expand Down
8 changes: 4 additions & 4 deletions lidar.html
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,10 @@ <h2 id="scan-building"><a class="header" href="#scan-building">Scan Building</a>
y /= 1000;

// Apply lidar offset
x += lidar_offset.x;
y += lidar_offset.y;
if (x != 0 &amp;&amp; y != 0) {
x += lidar_offset.x;
y += lidar_offset.y;
}

buffer.push_back(ScanPoint{x, y});
}
Expand All @@ -390,8 +392,6 @@ <h2 id="scan-building"><a class="header" href="#scan-building">Scan Building</a>
return std::move(buffer);
}

return std::nullopt;
}
</code></pre>
<p>In the tinykart default implementation, this is configured to read from -90 to 90 degrees:</p>
<pre><code class="language-c++">ScanBuilder scan_builder{360 - 90, 90, ScanPoint{0.1524, 0}};
Expand Down
22 changes: 11 additions & 11 deletions print.html
Original file line number Diff line number Diff line change
Expand Up @@ -571,9 +571,9 @@ <h3 id="tinykart-struct"><a class="header" href="#tinykart-struct">TinyKart stru
TinyKart *tinyKart;
</code></pre>
<p>You can use it to ex. move the steering to a certain angle, or set the throttle or brake:</p>
<pre><code class="language-c++"> // Actuate kart
<pre><code class="language-c++">
// Actuate kart
tinyKart-&gt;set_forward(command.throttle_percent);
tinyKart-&gt;set_steering(command.steering_angle);
</code></pre>
<h3 id="lidar-utilities"><a class="header" href="#lidar-utilities">LiDAR utilities</a></h3>
<p>The <code>LD06</code> class is a driver for the LD06 Lidar. <code>ScanBuilder</code> is a class for working with the
Expand All @@ -593,10 +593,10 @@ <h3 id="logger"><a class="header" href="#logger">Logger</a></h3>
defined
in logger.hpp.</p>
<p>Ex. to printf:</p>
<pre><code class="language-c++">
logger.printf(&quot;Target point: (%hi,%hi)\n&quot;, (int16_t) (target_pt.x * 1000),
(int16_t) (target_pt.y * 1000));
<pre><code class="language-c++"> auto target_pt = *maybe_target_pt;

logger.printf(&quot;Target point: (%hi, %hi)\n&quot;, (int16_t) (target_pt.x * 1000),
(int16_t) (target_pt.y * 1000));
</code></pre>
<p>Unlike the Serial library, this printf is actually non-blocking, and uses interrupts to process the message behind the
scenes. This means that there will be some lag before the message is printed, as it needs to be queued for
Expand Down Expand Up @@ -804,8 +804,10 @@ <h2 id="scan-building"><a class="header" href="#scan-building">Scan Building</a>
y /= 1000;

// Apply lidar offset
x += lidar_offset.x;
y += lidar_offset.y;
if (x != 0 &amp;&amp; y != 0) {
x += lidar_offset.x;
y += lidar_offset.y;
}

buffer.push_back(ScanPoint{x, y});
}
Expand All @@ -817,8 +819,6 @@ <h2 id="scan-building"><a class="header" href="#scan-building">Scan Building</a>
return std::move(buffer);
}

return std::nullopt;
}
</code></pre>
<p>In the tinykart default implementation, this is configured to read from -90 to 90 degrees:</p>
<pre><code class="language-c++">ScanBuilder scan_builder{360 - 90, 90, ScanPoint{0.1524, 0}};
Expand Down Expand Up @@ -974,14 +974,14 @@ <h2 id="the-code"><a class="header" href="#the-code">The code</a></h2>
</code></pre>
<p>Feel free to explore the other methods on the class, as they allow for movement in other ways, such as in reverse.</p>
<p>While this high level API is all you will be working with for the autonomy, I want to briefly show how its implemented:</p>
<pre><code class="language-c++"> /// Sets the esc to power forward with some 0.0-1.0 percent.
<pre><code class="language-c++">
/// Sets the esc to power forward with some 0.0-1.0 percent.
void set_forward(float power) const {
assert(power &lt;= 1.0 &amp;&amp; power &gt;= 0.0);

// Forward is 1.5-2.0ms periods
auto value = uint16_t(((1.5 + power * 0.5) / period) * max_pwm_duty);
analogWrite(pwm_pin, value);
}
</code></pre>
<p>As you can see, its actually rather simple, thanks to Arduino. I want to untangle that second line for you, since
there's
Expand Down
2 changes: 1 addition & 1 deletion searchindex.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion searchindex.json

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions soft_overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,9 @@ <h3 id="tinykart-struct"><a class="header" href="#tinykart-struct">TinyKart stru
TinyKart *tinyKart;
</code></pre>
<p>You can use it to ex. move the steering to a certain angle, or set the throttle or brake:</p>
<pre><code class="language-c++"> // Actuate kart
<pre><code class="language-c++">
// Actuate kart
tinyKart-&gt;set_forward(command.throttle_percent);
tinyKart-&gt;set_steering(command.steering_angle);
</code></pre>
<h3 id="lidar-utilities"><a class="header" href="#lidar-utilities">LiDAR utilities</a></h3>
<p>The <code>LD06</code> class is a driver for the LD06 Lidar. <code>ScanBuilder</code> is a class for working with the
Expand All @@ -312,10 +312,10 @@ <h3 id="logger"><a class="header" href="#logger">Logger</a></h3>
defined
in logger.hpp.</p>
<p>Ex. to printf:</p>
<pre><code class="language-c++">
logger.printf(&quot;Target point: (%hi,%hi)\n&quot;, (int16_t) (target_pt.x * 1000),
(int16_t) (target_pt.y * 1000));
<pre><code class="language-c++"> auto target_pt = *maybe_target_pt;

logger.printf(&quot;Target point: (%hi, %hi)\n&quot;, (int16_t) (target_pt.x * 1000),
(int16_t) (target_pt.y * 1000));
</code></pre>
<p>Unlike the Serial library, this printf is actually non-blocking, and uses interrupts to process the message behind the
scenes. This means that there will be some lag before the message is printed, as it needs to be queued for
Expand Down

0 comments on commit 6277af0

Please sign in to comment.