Import upstream snapshot 57d13ead53206a6bf0db3d66f86506ae8c2ce01a
Upstream: https://github.com/pollen-robotics/bam Upstream-Commit: 57d13ead53206a6bf0db3d66f86506ae8c2ce01a Upstream-Branch: mjlab_frictionloss
|
After Width: | Height: | Size: 42 KiB |
|
After Width: | Height: | Size: 82 KiB |
|
After Width: | Height: | Size: 57 KiB |
|
After Width: | Height: | Size: 55 KiB |
|
After Width: | Height: | Size: 82 KiB |
|
After Width: | Height: | Size: 27 KiB |
@@ -0,0 +1,103 @@
|
||||
/* Minimal custom style for BAM docs */
|
||||
.bd-page-width {
|
||||
max-width: 92rem;
|
||||
}
|
||||
|
||||
h1, h2 {
|
||||
letter-spacing: 0.01em;
|
||||
}
|
||||
|
||||
/* Add breathing room above and below content images */
|
||||
.bd-article img {
|
||||
margin-top: 1rem;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
/* Center the left (trajectory name) column of the trajectories table */
|
||||
.traj-table td:first-child,
|
||||
.traj-table th:first-child {
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
video {
|
||||
width: 100%;
|
||||
max-width:700px;
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
/* Getting started cards */
|
||||
.bam-getting-started {
|
||||
margin-top: 1.5rem;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.bam-card {
|
||||
border-radius: 0.6rem;
|
||||
transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
|
||||
}
|
||||
|
||||
.bam-card:hover {
|
||||
transform: translateY(-4px);
|
||||
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
|
||||
border-color: var(--pst-color-primary);
|
||||
}
|
||||
|
||||
.bam-card .sd-card-title {
|
||||
font-size: 1.15rem;
|
||||
}
|
||||
|
||||
/* Float the card footer link to the right */
|
||||
.bam-card .sd-card-footer {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
/* "Use in simulation" buttons on the identified-actuators table */
|
||||
.actuators-table td {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.motor-btn {
|
||||
display: block;
|
||||
width: 100%;
|
||||
margin: 0.25rem 0;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* Compact inline warning that fits inside a table cell */
|
||||
.mini-warning {
|
||||
margin: 0.5rem 0 0;
|
||||
font-size: 0.8em;
|
||||
line-height: 1.35;
|
||||
color: var(--pst-color-warning, #966600);
|
||||
}
|
||||
|
||||
.mini-warning code {
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
/* Banner shown on usage pages indicating the motor the examples target */
|
||||
.motor-banner {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 1.25rem;
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
|
||||
.motor-banner-img {
|
||||
flex: 0 0 auto;
|
||||
width: 90px;
|
||||
height: auto;
|
||||
margin: 0;
|
||||
border-radius: 0.4rem;
|
||||
}
|
||||
|
||||
.motor-banner-text {
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
|
||||
.motor-banner-text p:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
After Width: | Height: | Size: 52 KiB |
|
After Width: | Height: | Size: 88 KiB |
|
After Width: | Height: | Size: 50 KiB |
|
After Width: | Height: | Size: 94 KiB |
|
After Width: | Height: | Size: 93 KiB |
|
After Width: | Height: | Size: 104 KiB |
|
After Width: | Height: | Size: 9.0 KiB |
|
After Width: | Height: | Size: 7.9 MiB |
|
After Width: | Height: | Size: 6.7 MiB |
|
After Width: | Height: | Size: 5.3 MiB |
@@ -0,0 +1,103 @@
|
||||
// Fill the {actuator} placeholder in the usage code examples with the motor
|
||||
// chosen via the ?motor=<name> query parameter (set by the buttons on the
|
||||
// "Identified actuators" page). When no motor is given, xl330 is used as the
|
||||
// default. Only whitelisted motor names are ever inserted.
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
// name -> human-readable label
|
||||
var MOTORS = {
|
||||
mx64: "MX-64",
|
||||
mx106: "MX-106",
|
||||
xl320: "XL-320",
|
||||
xl330: "XL-330",
|
||||
feetech_sts3215_7_4V: "STS3215 (7.4V)",
|
||||
};
|
||||
var DEFAULT_MOTOR = "xl330";
|
||||
var PLACEHOLDER = "{actuator}";
|
||||
|
||||
function selectedMotor() {
|
||||
var value = new URLSearchParams(window.location.search).get("motor");
|
||||
if (value && Object.prototype.hasOwnProperty.call(MOTORS, value)) {
|
||||
return value;
|
||||
}
|
||||
return DEFAULT_MOTOR;
|
||||
}
|
||||
|
||||
function pageHasPlaceholder() {
|
||||
var blocks = document.querySelectorAll("div.highlight pre");
|
||||
for (var i = 0; i < blocks.length; i++) {
|
||||
if (blocks[i].textContent.indexOf(PLACEHOLDER) !== -1) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function updateCodeBlocks(motor) {
|
||||
// The placeholder is a contiguous token inside a string literal, so a plain
|
||||
// substring replace on innerHTML is enough (motor is whitelisted).
|
||||
document.querySelectorAll("div.highlight pre").forEach(function (pre) {
|
||||
if (pre.textContent.indexOf(PLACEHOLDER) === -1) return;
|
||||
pre.innerHTML = pre.innerHTML.split(PLACEHOLDER).join(motor);
|
||||
});
|
||||
}
|
||||
|
||||
// Derive the "_static/" URL prefix from an existing asset link, so the motor
|
||||
// image resolves correctly regardless of the current page's depth.
|
||||
function staticBase() {
|
||||
var link = document.querySelector('link[href*="_static/"]');
|
||||
if (link) {
|
||||
var href = link.getAttribute("href");
|
||||
var idx = href.indexOf("_static/");
|
||||
if (idx !== -1) return href.slice(0, idx + "_static/".length);
|
||||
}
|
||||
return "_static/";
|
||||
}
|
||||
|
||||
function showBanner(motor) {
|
||||
var article =
|
||||
document.querySelector("article") ||
|
||||
document.querySelector("main") ||
|
||||
document.body;
|
||||
var heading = article.querySelector("h1");
|
||||
var img = staticBase() + "actuator_" + motor + ".png";
|
||||
|
||||
var banner = document.createElement("div");
|
||||
banner.className = "admonition tip motor-banner";
|
||||
banner.innerHTML =
|
||||
'<img class="motor-banner-img" src="' +
|
||||
img +
|
||||
'" alt="' +
|
||||
MOTORS[motor] +
|
||||
'">' +
|
||||
'<div class="motor-banner-text">' +
|
||||
'<p class="admonition-title">Motor selected</p>' +
|
||||
"<p>Examples on this page are shown for " +
|
||||
'<code class="docutils literal notranslate"><span class="pre">' +
|
||||
motor +
|
||||
"</span></code> (" +
|
||||
MOTORS[motor] +
|
||||
"). " +
|
||||
'<a href="actuators.html">Choose a different motor</a>.</p>' +
|
||||
"</div>";
|
||||
|
||||
if (heading && heading.parentNode) {
|
||||
heading.parentNode.insertBefore(banner, heading.nextSibling);
|
||||
} else {
|
||||
article.insertBefore(banner, article.firstChild);
|
||||
}
|
||||
}
|
||||
|
||||
function apply() {
|
||||
// Only act on pages that actually carry the {actuator} placeholder.
|
||||
if (!pageHasPlaceholder()) return;
|
||||
var motor = selectedMotor();
|
||||
updateCodeBlocks(motor);
|
||||
showBanner(motor);
|
||||
}
|
||||
|
||||
if (document.readyState === "loading") {
|
||||
document.addEventListener("DOMContentLoaded", apply);
|
||||
} else {
|
||||
apply();
|
||||
}
|
||||
})();
|
||||
|
After Width: | Height: | Size: 39 KiB |
|
After Width: | Height: | Size: 49 KiB |
|
After Width: | Height: | Size: 65 KiB |
|
After Width: | Height: | Size: 38 KiB |
|
After Width: | Height: | Size: 113 KiB |
|
After Width: | Height: | Size: 175 KiB |