Compare commits
2 Commits
ec9ca8890c
...
de055dbf93
| Author | SHA1 | Date | |
|---|---|---|---|
| de055dbf93 | |||
| 6dae4519e3 |
@@ -0,0 +1,134 @@
|
|||||||
|
#include <Adafruit_PWMServoDriver.h>
|
||||||
|
#include <HardwareSerial.h>
|
||||||
|
#include <SoftwareSerial.h>
|
||||||
|
#include <Wire.h>
|
||||||
|
|
||||||
|
// Self Made Lib
|
||||||
|
#include <JackBotEmotes.h>
|
||||||
|
|
||||||
|
// Verbindung
|
||||||
|
Adafruit_PWMServoDriver board0 = Adafruit_PWMServoDriver(0x40);
|
||||||
|
Adafruit_PWMServoDriver board1 = Adafruit_PWMServoDriver(0x41);
|
||||||
|
SoftwareSerial BTSerial(11, 10); // RX | TX
|
||||||
|
|
||||||
|
// Konstanten
|
||||||
|
#define SERVOMIN 125 // this is the 'minimum' pulse length count (out of 4096)
|
||||||
|
#define SERVOMAX 625 // this is the 'maximum' pulse length count (out of 4096)
|
||||||
|
#define BUFFERSIZE 128
|
||||||
|
|
||||||
|
// Variablen
|
||||||
|
const int numRows = 6;
|
||||||
|
const int numCols = 3;
|
||||||
|
int legarray[numRows][numCols];
|
||||||
|
char legBuffer[BUFFERSIZE];
|
||||||
|
int bufIndex = 0;
|
||||||
|
boolean reading = false;
|
||||||
|
|
||||||
|
JackBotEmotes face;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
// USB
|
||||||
|
//Serial.begin(9600);
|
||||||
|
// Bluetooth
|
||||||
|
BTSerial.begin(38400);
|
||||||
|
|
||||||
|
board0.begin();
|
||||||
|
board0.setPWMFreq(50);
|
||||||
|
board1.begin();
|
||||||
|
board1.setPWMFreq(50);
|
||||||
|
pinMode(3, OUTPUT); //Define TX Pin as output
|
||||||
|
pinMode(2, INPUT); //Define RX Pin as input
|
||||||
|
|
||||||
|
// Initialiesieren der Start Position
|
||||||
|
for (int i = 0; i < 6; i++) {
|
||||||
|
for (int j = 0; j < 3; j++) {
|
||||||
|
legarray[i][j] = 90;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ServoControll(legarray);
|
||||||
|
|
||||||
|
face.begin();
|
||||||
|
face.showText("Hello JackBot!", 1, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
face.update();
|
||||||
|
|
||||||
|
while (BTSerial.available()) {
|
||||||
|
char c = BTSerial.read();
|
||||||
|
|
||||||
|
if (c == '<') {
|
||||||
|
// reset buffer for new frame
|
||||||
|
bufIndex = 0;
|
||||||
|
reading = true;
|
||||||
|
}
|
||||||
|
else if (c == '>') {
|
||||||
|
// end of frame
|
||||||
|
if (reading) {
|
||||||
|
legBuffer[bufIndex] = '\0'; // null-terminate string
|
||||||
|
if (stringToArray(String(legBuffer))) {
|
||||||
|
ServoControll(legarray);
|
||||||
|
face.smile();
|
||||||
|
face.showText("Moving!", 4, 1);
|
||||||
|
} else {
|
||||||
|
face.showText("Data Err!", 3, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
reading = false;
|
||||||
|
}
|
||||||
|
else if (reading) {
|
||||||
|
if (bufIndex < BUFFERSIZE - 1) {
|
||||||
|
legBuffer[bufIndex++] = c;
|
||||||
|
} else {
|
||||||
|
// buffer overflow → discard this frame
|
||||||
|
reading = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Funktion: Ansteuern der Servos
|
||||||
|
void ServoControll(int leg[6][3]) {
|
||||||
|
for (int i = 0; i < 6; i++) {
|
||||||
|
for (int j = 0; j < 3; j++) {
|
||||||
|
if (i < 3) {
|
||||||
|
board0.setPWM(i * 3 + j, 0, angleToPulse(leg[i][j]));
|
||||||
|
} else {
|
||||||
|
board1.setPWM((i - 3) * 3 + j, 0, angleToPulse(leg[i][j]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Funktion: Konvertiert den Winkel in PWM
|
||||||
|
int angleToPulse(int ang) {
|
||||||
|
return map(ang, 0, 180, SERVOMIN, SERVOMAX);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Funktion: Konvertiert den String in das Array
|
||||||
|
bool stringToArray(String input) {
|
||||||
|
input.replace("\n", ",");
|
||||||
|
char buffer[input.length() + 1];
|
||||||
|
input.toCharArray(buffer, sizeof(buffer));
|
||||||
|
|
||||||
|
char *token = strtok(buffer, ",");
|
||||||
|
int row = 0, col = 0;
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
while (token != NULL && row < numRows) {
|
||||||
|
legarray[row][col] = atoi(token);
|
||||||
|
count++;
|
||||||
|
col++;
|
||||||
|
if (col >= numCols) {
|
||||||
|
col = 0;
|
||||||
|
row++;
|
||||||
|
}
|
||||||
|
token = strtok(NULL, ",");
|
||||||
|
}
|
||||||
|
|
||||||
|
return count == (numRows * numCols);
|
||||||
|
}
|
||||||
@@ -0,0 +1,96 @@
|
|||||||
|
#include <Wire.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "BotNetwork.h"
|
||||||
|
#include "MotionController.h"
|
||||||
|
#include "DisplayManager.h"
|
||||||
|
|
||||||
|
// Initialize Objects
|
||||||
|
BotNetwork botNetwork("PfLANze", "isteinbisschenengandiehals", "JackBot-AP", "robot-control");
|
||||||
|
MotionController motion;
|
||||||
|
DisplayManager display(5, 16, 17); // TFT_CS, TFT_DC, TFT_RST
|
||||||
|
|
||||||
|
static QueueHandle_t motionQueue = nullptr;
|
||||||
|
static QueueHandle_t configQueue = nullptr;
|
||||||
|
static QueueHandle_t displayQueue = nullptr;
|
||||||
|
|
||||||
|
static void servoTask(void*) {
|
||||||
|
TickType_t lastWakeTime = xTaskGetTickCount();
|
||||||
|
const TickType_t updatePeriod = pdMS_TO_TICKS(5);
|
||||||
|
MotionFrame frame;
|
||||||
|
MotionConfig config;
|
||||||
|
|
||||||
|
for (;;) {
|
||||||
|
if (xQueueReceive(configQueue, &config, 0) == pdTRUE) {
|
||||||
|
motion.setConfigs(config.minPulse, config.maxPulse, config.intervalMs);
|
||||||
|
}
|
||||||
|
if (xQueueReceive(motionQueue, &frame, 0) == pdTRUE) {
|
||||||
|
motion.setTarget(frame);
|
||||||
|
}
|
||||||
|
motion.update();
|
||||||
|
vTaskDelayUntil(&lastWakeTime, updatePeriod);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void displayTask(void*) {
|
||||||
|
display.begin();
|
||||||
|
DisplayMessage message;
|
||||||
|
|
||||||
|
for (;;) {
|
||||||
|
if (xQueueReceive(displayQueue, &message, pdMS_TO_TICKS(10)) == pdTRUE) {
|
||||||
|
display.drawCenteredText(message.text, message.color);
|
||||||
|
}
|
||||||
|
display.update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void queueDisplayText(const char* text, uint16_t color) {
|
||||||
|
if (!displayQueue) return;
|
||||||
|
|
||||||
|
DisplayMessage message;
|
||||||
|
size_t length = strlen(text);
|
||||||
|
if (length >= sizeof(message.text)) length = sizeof(message.text) - 1;
|
||||||
|
memcpy(message.text, text, length);
|
||||||
|
message.text[length] = '\0';
|
||||||
|
message.color = color;
|
||||||
|
xQueueOverwrite(displayQueue, &message);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(115200);
|
||||||
|
delay(500);
|
||||||
|
Wire.begin();
|
||||||
|
Wire.setClock(400000);
|
||||||
|
motion.begin();
|
||||||
|
|
||||||
|
motionQueue = xQueueCreate(1, sizeof(MotionFrame));
|
||||||
|
configQueue = xQueueCreate(1, sizeof(MotionConfig));
|
||||||
|
displayQueue = xQueueCreate(1, sizeof(DisplayMessage));
|
||||||
|
if (!motionQueue || !configQueue || !displayQueue) {
|
||||||
|
Serial.println("Failed to create task queues");
|
||||||
|
while (true) delay(1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (xTaskCreate(servoTask, "Servo", 4096, nullptr, 3, nullptr) != pdPASS ||
|
||||||
|
xTaskCreate(displayTask, "Display", 8192, nullptr, 1, nullptr) != pdPASS) {
|
||||||
|
Serial.println("Failed to create application tasks");
|
||||||
|
while (true) delay(1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
queueDisplayText("Connecting...", ST77XX_YELLOW);
|
||||||
|
if (botNetwork.begin(3323)) {
|
||||||
|
queueDisplayText("WiFi: Connected", ST77XX_CYAN);
|
||||||
|
} else {
|
||||||
|
queueDisplayText("AP: JackBot", ST77XX_MAGENTA);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
uint8_t buffer[512];
|
||||||
|
int size = botNetwork.readPacket(buffer, 512);
|
||||||
|
|
||||||
|
if (size > 0) {
|
||||||
|
botNetwork.parsePacket(buffer, size, motionQueue, configQueue, displayQueue);
|
||||||
|
}
|
||||||
|
|
||||||
|
delay(1);
|
||||||
|
}
|
||||||
@@ -0,0 +1,96 @@
|
|||||||
|
#include <Wire.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "BotNetwork.h"
|
||||||
|
#include "MotionController.h"
|
||||||
|
#include "DisplayManager.h"
|
||||||
|
|
||||||
|
// Initialize Objects
|
||||||
|
BotNetwork botNetwork("PfLANze", "isteinbisschenengandiehals", "JackBot-AP", "robot-control");
|
||||||
|
MotionController motion;
|
||||||
|
DisplayManager display(5, 3, 2); // TFT_CS, TFT_DC, TFT_RST
|
||||||
|
|
||||||
|
static QueueHandle_t motionQueue = nullptr;
|
||||||
|
static QueueHandle_t configQueue = nullptr;
|
||||||
|
static QueueHandle_t displayQueue = nullptr;
|
||||||
|
|
||||||
|
static void servoTask(void*) {
|
||||||
|
TickType_t lastWakeTime = xTaskGetTickCount();
|
||||||
|
const TickType_t updatePeriod = pdMS_TO_TICKS(5);
|
||||||
|
MotionFrame frame;
|
||||||
|
MotionConfig config;
|
||||||
|
|
||||||
|
for (;;) {
|
||||||
|
if (xQueueReceive(configQueue, &config, 0) == pdTRUE) {
|
||||||
|
motion.setConfigs(config.minPulse, config.maxPulse, config.intervalMs);
|
||||||
|
}
|
||||||
|
if (xQueueReceive(motionQueue, &frame, 0) == pdTRUE) {
|
||||||
|
motion.setTarget(frame);
|
||||||
|
}
|
||||||
|
motion.update();
|
||||||
|
vTaskDelayUntil(&lastWakeTime, updatePeriod);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void displayTask(void*) {
|
||||||
|
display.begin();
|
||||||
|
DisplayMessage message;
|
||||||
|
|
||||||
|
for (;;) {
|
||||||
|
if (xQueueReceive(displayQueue, &message, pdMS_TO_TICKS(10)) == pdTRUE) {
|
||||||
|
display.drawCenteredText(message.text, message.color);
|
||||||
|
}
|
||||||
|
display.update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void queueDisplayText(const char* text, uint16_t color) {
|
||||||
|
if (!displayQueue) return;
|
||||||
|
|
||||||
|
DisplayMessage message;
|
||||||
|
size_t length = strlen(text);
|
||||||
|
if (length >= sizeof(message.text)) length = sizeof(message.text) - 1;
|
||||||
|
memcpy(message.text, text, length);
|
||||||
|
message.text[length] = '\0';
|
||||||
|
message.color = color;
|
||||||
|
xQueueOverwrite(displayQueue, &message);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(115200);
|
||||||
|
Wire.begin(6,7);
|
||||||
|
Wire.setClock(400000);
|
||||||
|
|
||||||
|
motion.begin();
|
||||||
|
|
||||||
|
motionQueue = xQueueCreate(1, sizeof(MotionFrame));
|
||||||
|
configQueue = xQueueCreate(1, sizeof(MotionConfig));
|
||||||
|
displayQueue = xQueueCreate(1, sizeof(DisplayMessage));
|
||||||
|
if (!motionQueue || !configQueue || !displayQueue) {
|
||||||
|
Serial.println("Failed to create task queues");
|
||||||
|
while (true) delay(1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (xTaskCreate(servoTask, "Servo", 4096, nullptr, 3, nullptr) != pdPASS ||
|
||||||
|
xTaskCreate(displayTask, "Display", 4096, nullptr, 1, nullptr) != pdPASS) {
|
||||||
|
Serial.println("Failed to create application tasks");
|
||||||
|
while (true) delay(1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
queueDisplayText("Connecting...", ST77XX_YELLOW);
|
||||||
|
if (botNetwork.begin(3323)) {
|
||||||
|
queueDisplayText("WiFi: Connected", ST77XX_CYAN);
|
||||||
|
} else {
|
||||||
|
queueDisplayText("AP: JackBot", ST77XX_MAGENTA);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
uint8_t buffer[512];
|
||||||
|
int size = botNetwork.readPacket(buffer, 512);
|
||||||
|
|
||||||
|
if (size > 0) {
|
||||||
|
botNetwork.parsePacket(buffer, size, motionQueue, configQueue, displayQueue);
|
||||||
|
}
|
||||||
|
|
||||||
|
delay(1);
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
name=JackBot
|
||||||
|
version=1.0.0
|
||||||
|
author=JackM
|
||||||
|
maintainer=JackM
|
||||||
|
sentence=Shared JackBot board code
|
||||||
|
paragraph=Shared code for JackBot Arduino sketches.
|
||||||
|
category=Device Control
|
||||||
|
architectures=esp32
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
#include "BotNetwork.h"
|
||||||
|
|
||||||
|
IPAddress local_IP(192, 168, 188, 32);
|
||||||
|
IPAddress gateway(192, 168, 188, 1);
|
||||||
|
IPAddress subnet(255, 255, 255, 0);
|
||||||
|
|
||||||
|
BotNetwork::BotNetwork(const char* ssid, const char* pass, const char* ap_ssid, const char* ap_pass)
|
||||||
|
: _ssid(ssid), _pass(pass), _ap_ssid(ap_ssid), _ap_pass(ap_pass) {}
|
||||||
|
|
||||||
|
bool BotNetwork::begin(uint16_t port) {
|
||||||
|
WiFi.mode(WIFI_STA);
|
||||||
|
WiFi.config(local_IP, gateway, subnet);
|
||||||
|
WiFi.begin(_ssid, _pass);
|
||||||
|
|
||||||
|
unsigned long start = millis();
|
||||||
|
while (WiFi.status() != WL_CONNECTED && millis() - start < 8000) {
|
||||||
|
delay(200);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isWifi = true;
|
||||||
|
if (WiFi.status() != WL_CONNECTED) {
|
||||||
|
WiFi.mode(WIFI_AP);
|
||||||
|
WiFi.softAPConfig(local_IP, local_IP, subnet);
|
||||||
|
WiFi.softAP(_ap_ssid, _ap_pass);
|
||||||
|
isWifi = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
_udp.begin(port);
|
||||||
|
return isWifi;
|
||||||
|
}
|
||||||
|
|
||||||
|
int BotNetwork::readPacket(uint8_t* buffer, size_t maxSize) {
|
||||||
|
int size = _udp.parsePacket();
|
||||||
|
if (size > 0) return _udp.read(buffer, maxSize);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void enqueueDisplayText(QueueHandle_t displayQueue, const uint8_t* data, size_t length) {
|
||||||
|
if (!displayQueue) return;
|
||||||
|
|
||||||
|
DisplayMessage message;
|
||||||
|
size_t textLength = length < sizeof(message.text) - 1 ? length : sizeof(message.text) - 1;
|
||||||
|
memcpy(message.text, data, textLength);
|
||||||
|
message.text[textLength] = '\0';
|
||||||
|
message.color = 0x07E0;
|
||||||
|
xQueueOverwrite(displayQueue, &message);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BotNetwork::parsePacket(uint8_t *buffer, size_t size, QueueHandle_t motionQueue,
|
||||||
|
QueueHandle_t configQueue, QueueHandle_t displayQueue) {
|
||||||
|
if (size < sizeof(PacketHeader)) return;
|
||||||
|
PacketHeader *header = (PacketHeader *)buffer;
|
||||||
|
if (header->version != PACKET_VERSION) return;
|
||||||
|
if (header->payload_len > size - sizeof(PacketHeader)) return;
|
||||||
|
|
||||||
|
uint8_t *payload = buffer + sizeof(PacketHeader);
|
||||||
|
size_t pos = 0;
|
||||||
|
|
||||||
|
static int currentServoMin = 125;
|
||||||
|
static int currentServoMax = 625;
|
||||||
|
static int currentPythonInterval = 50;
|
||||||
|
|
||||||
|
while (pos < header->payload_len) {
|
||||||
|
if (header->payload_len - pos < 3) return;
|
||||||
|
uint8_t f_type = payload[pos++];
|
||||||
|
uint16_t f_len = payload[pos] | (payload[pos+1] << 8);
|
||||||
|
pos += 2;
|
||||||
|
if (f_len > header->payload_len - pos) return;
|
||||||
|
uint8_t *data = payload + pos;
|
||||||
|
|
||||||
|
if (header->packet_id == PKT_COMMAND) {
|
||||||
|
if (f_type == FT_ARRAY_F32 && f_len == 18 && motionQueue) {
|
||||||
|
MotionFrame frame;
|
||||||
|
for (int i=0; i<6; i++) {
|
||||||
|
for (int j=0; j<3; j++) frame.leg[i][j] = data[i*3+j];
|
||||||
|
}
|
||||||
|
xQueueOverwrite(motionQueue, &frame);
|
||||||
|
} else if (f_type == FT_STRING) {
|
||||||
|
enqueueDisplayText(displayQueue, data, f_len);
|
||||||
|
}
|
||||||
|
} else if (header->packet_id == PKT_DISPLAY) {
|
||||||
|
if (f_type == FT_STRING) {
|
||||||
|
enqueueDisplayText(displayQueue, data, f_len);
|
||||||
|
}
|
||||||
|
} else if (header->packet_id == PKT_CONFIG) {
|
||||||
|
if (f_type == FT_CONFIG_VAL && f_len >= 3) {
|
||||||
|
uint8_t id = data[0];
|
||||||
|
int16_t val = data[1] | (data[2] << 8);
|
||||||
|
|
||||||
|
if (id == 1) currentServoMin = val;
|
||||||
|
if (id == 2) currentServoMax = val;
|
||||||
|
if (id == 3) currentPythonInterval = val;
|
||||||
|
|
||||||
|
MotionConfig config;
|
||||||
|
config.minPulse = currentServoMin;
|
||||||
|
config.maxPulse = currentServoMax;
|
||||||
|
config.intervalMs = currentPythonInterval;
|
||||||
|
if (configQueue) xQueueOverwrite(configQueue, &config);
|
||||||
|
Serial.printf("Config Sync: ID %d -> %d\n", id, val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pos += f_len;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
#ifndef BOTMANAGER_H
|
||||||
|
#define BOTMANAGER_H
|
||||||
|
|
||||||
|
#include <WiFi.h>
|
||||||
|
#include <WiFiUdp.h>
|
||||||
|
#include <freertos/FreeRTOS.h>
|
||||||
|
#include <freertos/queue.h>
|
||||||
|
#include "Protocol.h"
|
||||||
|
#include "MotionController.h"
|
||||||
|
#include "DisplayManager.h"
|
||||||
|
|
||||||
|
class BotNetwork {
|
||||||
|
public:
|
||||||
|
BotNetwork(const char* ssid, const char* pass, const char* ap_ssid, const char* ap_pass);
|
||||||
|
bool begin(uint16_t port); // Returns true if WiFi, false if AP
|
||||||
|
int readPacket(uint8_t* buffer, size_t maxSize);
|
||||||
|
|
||||||
|
void parsePacket(uint8_t *buffer, size_t size, QueueHandle_t motionQueue,
|
||||||
|
QueueHandle_t configQueue, QueueHandle_t displayQueue);
|
||||||
|
|
||||||
|
private:
|
||||||
|
const char* _ssid;
|
||||||
|
const char* _pass;
|
||||||
|
const char* _ap_ssid;
|
||||||
|
const char* _ap_pass;
|
||||||
|
WiFiUDP _udp;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,133 @@
|
|||||||
|
#include "DisplayManager.h"
|
||||||
|
#include "img/image_cards_hearts_bits.h"
|
||||||
|
#include "img/image_paint_3_bits.h"
|
||||||
|
#include "img/tenor.h"
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
|
DisplayManager::DisplayManager(int8_t cs, int8_t dc, int8_t rst)
|
||||||
|
: _tft(cs, dc, rst) {}
|
||||||
|
|
||||||
|
static void drawAnimationFrame(Adafruit_ST7789& tft, int16_t x, uint8_t frame) {
|
||||||
|
uint16_t pixels[240];
|
||||||
|
const uint8_t* bitmap = tenor_frames[frame];
|
||||||
|
|
||||||
|
tft.startWrite();
|
||||||
|
tft.setAddrWindow(x, 0, 240, 240);
|
||||||
|
for (int16_t y = 0; y < 240; y++) {
|
||||||
|
for (int16_t byteIndex = 0; byteIndex < 30; byteIndex++) {
|
||||||
|
uint8_t bits = pgm_read_byte(&bitmap[y * 30 + byteIndex]);
|
||||||
|
for (uint8_t bit = 0; bit < 8; bit++) {
|
||||||
|
pixels[byteIndex * 8 + bit] = (bits & (0x80 >> bit)) ? ST77XX_WHITE : ST77XX_BLACK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tft.writePixels(pixels, 240);
|
||||||
|
}
|
||||||
|
tft.endWrite();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DisplayManager::begin() {
|
||||||
|
_tft.init(240, 320);
|
||||||
|
_tft.setRotation(1);
|
||||||
|
clear();
|
||||||
|
drawFaceScreen();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DisplayManager::clear() {
|
||||||
|
_tft.fillScreen(ST77XX_BLACK);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DisplayManager::setState(DisplayState state) {
|
||||||
|
_currentState = state;
|
||||||
|
// Force a redraw when state changes
|
||||||
|
if (_currentState == STATE_FACE) {
|
||||||
|
drawFaceScreen();
|
||||||
|
} else {
|
||||||
|
drawMenuScreen();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DisplayManager::toggleState() {
|
||||||
|
if (_currentState == STATE_FACE) {
|
||||||
|
setState(STATE_MENU);
|
||||||
|
} else {
|
||||||
|
setState(STATE_FACE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DisplayManager::update() {
|
||||||
|
if (_currentState != STATE_FACE) return;
|
||||||
|
|
||||||
|
unsigned long now = millis();
|
||||||
|
if (_showingText) {
|
||||||
|
if (now - _textShownAt < 2000) return;
|
||||||
|
drawFaceScreen();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (now - _lastScreenUpdate < 71) return;
|
||||||
|
_lastScreenUpdate = now;
|
||||||
|
|
||||||
|
int16_t x = (_tft.width() - 240) / 2;
|
||||||
|
drawAnimationFrame(_tft, x, _animationFrame);
|
||||||
|
_tft.drawBitmap(x + 105, 14, image_cards_hearts_bits, 30, 32, 0xE8EC);
|
||||||
|
_animationFrame = (_animationFrame + 1) % 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- DESIGNED VIA LOPAKA.APP ---
|
||||||
|
void DisplayManager::drawFaceScreen() {
|
||||||
|
_showingText = false;
|
||||||
|
_animationFrame = 0;
|
||||||
|
clear();
|
||||||
|
int16_t x = (_tft.width() - 240) / 2;
|
||||||
|
_tft.drawBitmap(x, 0, image_paint_3_bits, 240, 240, ST77XX_WHITE);
|
||||||
|
_tft.drawBitmap(x + 105, 14, image_cards_hearts_bits, 30, 32, 0xE8EC);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DisplayManager::drawMenuScreen() {
|
||||||
|
_showingText = false;
|
||||||
|
clear();
|
||||||
|
|
||||||
|
// Example Menu/Stats UI layout adapted from Lopaka export
|
||||||
|
_tft.drawRect(10, 10, 300, 220, ST77XX_BLUE); // Outer box
|
||||||
|
|
||||||
|
_tft.setTextColor(ST77XX_WHITE);
|
||||||
|
_tft.setTextSize(2);
|
||||||
|
_tft.setCursor(30, 30);
|
||||||
|
_tft.print("-- JACKBOT CONFIG --");
|
||||||
|
|
||||||
|
_tft.setTextSize(1);
|
||||||
|
_tft.setCursor(30, 80);
|
||||||
|
_tft.print("Status: Connected (UDP)");
|
||||||
|
|
||||||
|
_tft.setCursor(30, 110);
|
||||||
|
_tft.print("Servo Profile: Standard");
|
||||||
|
|
||||||
|
_tft.setCursor(30, 140);
|
||||||
|
_tft.print("Press button to exit menu");
|
||||||
|
}
|
||||||
|
|
||||||
|
void DisplayManager::drawCenteredText(const char* text, uint16_t color) {
|
||||||
|
if (_currentState != STATE_FACE || text == nullptr) return;
|
||||||
|
if (strcmp(text, _lastText) == 0) return;
|
||||||
|
|
||||||
|
size_t textLength = strlen(text);
|
||||||
|
if (textLength >= sizeof(_lastText)) textLength = sizeof(_lastText) - 1;
|
||||||
|
memcpy(_lastText, text, textLength);
|
||||||
|
_lastText[textLength] = '\0';
|
||||||
|
|
||||||
|
_showingText = true;
|
||||||
|
_textShownAt = millis();
|
||||||
|
clear();
|
||||||
|
_tft.setTextSize(2);
|
||||||
|
_tft.setTextColor(color);
|
||||||
|
|
||||||
|
int16_t x1, y1;
|
||||||
|
uint16_t w, h;
|
||||||
|
_tft.getTextBounds(text, 0, 0, &x1, &y1, &w, &h);
|
||||||
|
|
||||||
|
int16_t cx = (_tft.width() - w) / 2;
|
||||||
|
int16_t cy = (_tft.height() - h) / 2;
|
||||||
|
|
||||||
|
_tft.setCursor(cx, cy);
|
||||||
|
_tft.print(text);
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
#ifndef DISPLAYMANAGER_H
|
||||||
|
#define DISPLAYMANAGER_H
|
||||||
|
|
||||||
|
#include <Adafruit_GFX.h>
|
||||||
|
#include <Adafruit_ST7789.h>
|
||||||
|
|
||||||
|
enum DisplayState {
|
||||||
|
STATE_FACE,
|
||||||
|
STATE_MENU
|
||||||
|
};
|
||||||
|
|
||||||
|
struct DisplayMessage {
|
||||||
|
char text[64];
|
||||||
|
uint16_t color;
|
||||||
|
};
|
||||||
|
|
||||||
|
class DisplayManager {
|
||||||
|
public:
|
||||||
|
DisplayManager(int8_t cs, int8_t dc, int8_t rst);
|
||||||
|
|
||||||
|
void begin();
|
||||||
|
void update();
|
||||||
|
|
||||||
|
void drawCenteredText(const char* text, uint16_t color);
|
||||||
|
void setState(DisplayState state);
|
||||||
|
void toggleState(); // Switches between Face and Menu
|
||||||
|
|
||||||
|
// Lopaka-generated screen renderers
|
||||||
|
void drawFaceScreen();
|
||||||
|
void drawMenuScreen();
|
||||||
|
void clear();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Adafruit_ST7789 _tft;
|
||||||
|
DisplayState _currentState = STATE_FACE;
|
||||||
|
unsigned long _lastScreenUpdate = 0;
|
||||||
|
unsigned long _textShownAt = 0;
|
||||||
|
bool _showingText = false;
|
||||||
|
uint8_t _animationFrame = 0;
|
||||||
|
char _lastText[64] = {};
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
Binary file not shown.
@@ -0,0 +1,71 @@
|
|||||||
|
#include "MotionController.h"
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
MotionController::MotionController() : board0(0x40), board1(0x41) {}
|
||||||
|
|
||||||
|
void MotionController::begin() {
|
||||||
|
board0.begin(); board0.setPWMFreq(50);
|
||||||
|
board1.begin(); board1.setPWMFreq(50);
|
||||||
|
// Initialize current position at 90 degrees
|
||||||
|
for(int i=0; i<6; i++) {
|
||||||
|
for(int j=0; j<3; j++) {
|
||||||
|
currentLegF[i][j] = 90.0;
|
||||||
|
targetLeg[i][j] = 90.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
writeServos(currentLegF);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MotionController::update() {
|
||||||
|
bool moved = false;
|
||||||
|
for(int i=0; i<6; i++) {
|
||||||
|
for(int j=0; j<3; j++) {
|
||||||
|
float remaining = targetLeg[i][j] - currentLegF[i][j];
|
||||||
|
float step = stepSize[i][j];
|
||||||
|
if (fabsf(remaining) > fabsf(step)) {
|
||||||
|
currentLegF[i][j] += step;
|
||||||
|
} else {
|
||||||
|
currentLegF[i][j] = targetLeg[i][j];
|
||||||
|
}
|
||||||
|
if (currentLegF[i][j] != targetLeg[i][j] || remaining != 0.0f) {
|
||||||
|
moved = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (moved) {
|
||||||
|
writeServos(currentLegF);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MotionController::setTarget(const MotionFrame& frame) {
|
||||||
|
int numSteps = (_pythonInterval + 4) / 5;
|
||||||
|
if (numSteps < 1) numSteps = 1;
|
||||||
|
|
||||||
|
for(int i=0; i<6; i++) {
|
||||||
|
for(int j=0; j<3; j++) {
|
||||||
|
targetLeg[i][j] = (float)frame.leg[i][j];
|
||||||
|
stepSize[i][j] = (targetLeg[i][j] - currentLegF[i][j]) / (float)numSteps;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MotionController::setConfigs(int minP, int maxP, int interval) {
|
||||||
|
_servoMin = minP;
|
||||||
|
_servoMax = maxP;
|
||||||
|
_pythonInterval = interval < 5 ? 5 : interval;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MotionController::writeServos(float leg[6][3]) {
|
||||||
|
for (int i = 0; i < 6; i++) {
|
||||||
|
for (int j = 0; j < 3; j++) {
|
||||||
|
int pulse = map((int)leg[i][j], 0, 180, _servoMin, _servoMax);
|
||||||
|
if (i < 3) board0.setPWM(i * 3 + j, 0, pulse);
|
||||||
|
else board1.setPWM((i - 3) * 3 + j, 0, pulse);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int MotionController::degToPulse(int deg) {
|
||||||
|
return map(deg, 0, 180, _servoMin, _servoMax);
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
#ifndef MOTIONCONTROLLER_H
|
||||||
|
#define MOTIONCONTROLLER_H
|
||||||
|
|
||||||
|
#include <Adafruit_PWMServoDriver.h>
|
||||||
|
#include "Protocol.h"
|
||||||
|
|
||||||
|
struct MotionFrame { int leg[6][3]; };
|
||||||
|
struct MotionConfig { int minPulse; int maxPulse; int intervalMs; };
|
||||||
|
|
||||||
|
class MotionController {
|
||||||
|
public:
|
||||||
|
MotionController();
|
||||||
|
void begin();
|
||||||
|
void update();
|
||||||
|
void setTarget(const MotionFrame& frame);
|
||||||
|
void setConfigs(int minP, int maxP, int interval);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void writeServos(float leg[6][3]);
|
||||||
|
int degToPulse(int deg);
|
||||||
|
|
||||||
|
Adafruit_PWMServoDriver board0;
|
||||||
|
Adafruit_PWMServoDriver board1;
|
||||||
|
|
||||||
|
// Movement state
|
||||||
|
float targetLeg[6][3];
|
||||||
|
float currentLegF[6][3];
|
||||||
|
float stepSize[6][3];
|
||||||
|
|
||||||
|
// Configs
|
||||||
|
int _servoMin = 125;
|
||||||
|
int _servoMax = 625;
|
||||||
|
int _pythonInterval = 50;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
#ifndef PROTOCOL_H
|
||||||
|
#define PROTOCOL_H
|
||||||
|
|
||||||
|
#define PACKET_VERSION 1
|
||||||
|
#define PKT_COMMAND 1
|
||||||
|
#define PKT_CONFIG 2
|
||||||
|
#define PKT_DISPLAY 3
|
||||||
|
|
||||||
|
#define FT_ARRAY_F32 1
|
||||||
|
#define FT_STRING 2
|
||||||
|
#define FT_UINT8 3
|
||||||
|
#define FT_CONFIG_VAL 4
|
||||||
|
|
||||||
|
struct PacketHeader {
|
||||||
|
uint8_t packet_id;
|
||||||
|
uint8_t version;
|
||||||
|
uint16_t payload_len;
|
||||||
|
uint32_t timestamp;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
#ifndef IMAGE_CARDS_HEARTS_BITS_H
|
||||||
|
#define IMAGE_CARDS_HEARTS_BITS_H
|
||||||
|
|
||||||
|
#include <Arduino.h>
|
||||||
|
|
||||||
|
static const unsigned char PROGMEM image_cards_hearts_bits[] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0xc0,0x0f,0xc0,0x0f,0xc0,0x0f,0xc0,0x3f,0xf0,0x3f,0xf0,0x3f,0xf0,0x3f,0xf0,0xff,0xfc,0xff,0xfc,0xff,0xfc,0xff,0xfc,0xff,0xff,0xff,0xfc,0xff,0xff,0xff,0xfc,0xff,0xff,0xff,0xfc,0xff,0xff,0xff,0xfc,0xff,0xff,0xff,0xfc,0xff,0xff,0xff,0xfc,0x3f,0xff,0xff,0xf0,0x3f,0xff,0xff,0xf0,0x0f,0xff,0xff,0xc0,0x0f,0xff,0xff,0xc0,0x03,0xff,0xff,0x00,0x03,0xff,0xff,0x00,0x00,0xff,0xfc,0x00,0x00,0xff,0xfc,0x00,0x00,0x3f,0xf0,0x00,0x00,0x3f,0xf0,0x00,0x00,0x0f,0xc0,0x00,0x00,0x0f,0xc0,0x00,0x00,0x03,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
|
||||||
|
|
||||||
|
#endif // IMAGE_CARDS_HEARTS_BITS_H
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,158 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<robot name="JackBot" xmlns:xacro="http://www.ros.org/wiki/xacro">
|
||||||
|
<xacro:property name="coxa_length" value="0.0627"/>
|
||||||
|
<xacro:property name="coxa_diagonal_x" value="0.098574"/>
|
||||||
|
<xacro:property name="coxa_diagonal_y" value="0.068584"/>
|
||||||
|
<xacro:property name="coxa_center_x" value="0"/>
|
||||||
|
<xacro:property name="coxa_center_y" value="0.08565"/>
|
||||||
|
<xacro:property name="femur_length" value="0.0602"/>
|
||||||
|
<xacro:property name="tibia_length" value="0.08055"/>
|
||||||
|
<xacro:property name="leg_radius" value="0.005"/>
|
||||||
|
<xacro:property name="tip_radius" value="0.01"/>
|
||||||
|
<xacro:property name="base_size" value="0.200 0.140 0.090"/>
|
||||||
|
<xacro:property name="joint_lower_limit" value="0.2618"/>
|
||||||
|
<xacro:property name="joint_upper_limit" value="2.8798"/>
|
||||||
|
<xacro:property name="joint_effort" value="1"/>
|
||||||
|
<xacro:property name="joint_velocity" value="1"/>
|
||||||
|
|
||||||
|
<xacro:macro name="default_inertial" params="">
|
||||||
|
<inertial>
|
||||||
|
<origin xyz="0 0 0" rpy="0 0 0"/>
|
||||||
|
<mass value="1"/>
|
||||||
|
<inertia
|
||||||
|
ixx="0.001" ixy="0" ixz="0"
|
||||||
|
iyy="0.001" iyz="0"
|
||||||
|
izz="0.001"/>
|
||||||
|
</inertial>
|
||||||
|
</xacro:macro>
|
||||||
|
|
||||||
|
<link name="base_link">
|
||||||
|
<xacro:default_inertial/>
|
||||||
|
<visual>
|
||||||
|
<geometry>
|
||||||
|
<box size="${base_size}"/>
|
||||||
|
</geometry>
|
||||||
|
<origin xyz="0 0 0" rpy="0 0 0"/>
|
||||||
|
<material name="red">
|
||||||
|
<color rgba="1 0 0 0.5"/>
|
||||||
|
</material>
|
||||||
|
</visual>
|
||||||
|
<collision>
|
||||||
|
<geometry>
|
||||||
|
<box size="${base_size}"/>
|
||||||
|
</geometry>
|
||||||
|
<origin xyz="0 0 0" rpy="0 0 0"/>
|
||||||
|
</collision>
|
||||||
|
</link>
|
||||||
|
|
||||||
|
<xacro:macro name="leg" params="id x y yaw femur_roll">
|
||||||
|
<link name="leg${id}_coxa">
|
||||||
|
<xacro:default_inertial/>
|
||||||
|
<visual>
|
||||||
|
<geometry>
|
||||||
|
<cylinder length="${coxa_length}" radius="${leg_radius}"/>
|
||||||
|
</geometry>
|
||||||
|
<origin xyz="${coxa_length / 2} 0 0" rpy="0 1.5708 0"/>
|
||||||
|
<material name="green">
|
||||||
|
<color rgba="0 1 0 1"/>
|
||||||
|
</material>
|
||||||
|
</visual>
|
||||||
|
<collision>
|
||||||
|
<geometry>
|
||||||
|
<cylinder length="${coxa_length}" radius="${leg_radius}"/>
|
||||||
|
</geometry>
|
||||||
|
<origin xyz="${coxa_length / 2} 0 0" rpy="0 1.5708 0"/>
|
||||||
|
</collision>
|
||||||
|
</link>
|
||||||
|
<joint name="leg${id}_coxa_joint" type="revolute">
|
||||||
|
<parent link="base_link"/>
|
||||||
|
<child link="leg${id}_coxa"/>
|
||||||
|
<origin xyz="${x} ${y} 0" rpy="0 0 ${yaw}"/>
|
||||||
|
<axis xyz="0 0 1"/>
|
||||||
|
<limit lower="${joint_lower_limit}" upper="${joint_upper_limit}" effort="${joint_effort}" velocity="${joint_velocity}"/>
|
||||||
|
</joint>
|
||||||
|
|
||||||
|
<link name="leg${id}_femur">
|
||||||
|
<xacro:default_inertial/>
|
||||||
|
<visual>
|
||||||
|
<geometry>
|
||||||
|
<cylinder length="${femur_length}" radius="${leg_radius}"/>
|
||||||
|
</geometry>
|
||||||
|
<origin xyz="0 0 -${femur_length / 2}" rpy="0 0 0"/>
|
||||||
|
<material name="blue">
|
||||||
|
<color rgba="0 0 1 1"/>
|
||||||
|
</material>
|
||||||
|
</visual>
|
||||||
|
<collision>
|
||||||
|
<geometry>
|
||||||
|
<cylinder length="${femur_length}" radius="${leg_radius}"/>
|
||||||
|
</geometry>
|
||||||
|
<origin xyz="0 0 -${femur_length / 2}" rpy="0 0 0"/>
|
||||||
|
</collision>
|
||||||
|
</link>
|
||||||
|
<joint name="leg${id}_femur_joint" type="revolute">
|
||||||
|
<parent link="leg${id}_coxa"/>
|
||||||
|
<child link="leg${id}_femur"/>
|
||||||
|
<origin xyz="${coxa_length} 0 0" rpy="${femur_roll} 0 0"/>
|
||||||
|
<axis xyz="0 -1 0"/>
|
||||||
|
<limit lower="${joint_lower_limit}" upper="${joint_upper_limit}" effort="${joint_effort}" velocity="${joint_velocity}"/>
|
||||||
|
</joint>
|
||||||
|
|
||||||
|
<link name="leg${id}_tibia">
|
||||||
|
<xacro:default_inertial/>
|
||||||
|
<visual>
|
||||||
|
<geometry>
|
||||||
|
<cylinder length="${tibia_length}" radius="${leg_radius}"/>
|
||||||
|
</geometry>
|
||||||
|
<origin xyz="${tibia_length / 2} 0 0" rpy="0 1.5708 0"/>
|
||||||
|
<material name="yellow">
|
||||||
|
<color rgba="0 1 1 1"/>
|
||||||
|
</material>
|
||||||
|
</visual>
|
||||||
|
<collision>
|
||||||
|
<geometry>
|
||||||
|
<cylinder length="${tibia_length}" radius="${leg_radius}"/>
|
||||||
|
</geometry>
|
||||||
|
<origin xyz="${tibia_length / 2} 0 0" rpy="0 1.5708 0"/>
|
||||||
|
</collision>
|
||||||
|
</link>
|
||||||
|
<joint name="leg${id}_tibia_joint" type="revolute">
|
||||||
|
<parent link="leg${id}_femur"/>
|
||||||
|
<child link="leg${id}_tibia"/>
|
||||||
|
<origin xyz="0 0 -${femur_length}" rpy="0 0 0"/>
|
||||||
|
<axis xyz="0 1 0"/>
|
||||||
|
<limit lower="${joint_lower_limit}" upper="${joint_upper_limit}" effort="${joint_effort}" velocity="${joint_velocity}"/>
|
||||||
|
</joint>
|
||||||
|
|
||||||
|
<link name="leg${id}_tip">
|
||||||
|
<xacro:default_inertial/>
|
||||||
|
<visual>
|
||||||
|
<geometry>
|
||||||
|
<sphere radius="${tip_radius}"/>
|
||||||
|
</geometry>
|
||||||
|
<origin xyz="0 0 0" rpy="0 0 0"/>
|
||||||
|
<material name="purple">
|
||||||
|
<color rgba="1 0 1 1"/>
|
||||||
|
</material>
|
||||||
|
</visual>
|
||||||
|
<collision>
|
||||||
|
<geometry>
|
||||||
|
<sphere radius="${tip_radius}"/>
|
||||||
|
</geometry>
|
||||||
|
<origin xyz="0 0 0" rpy="0 0 0"/>
|
||||||
|
</collision>
|
||||||
|
</link>
|
||||||
|
<joint name="leg${id}_tip_joint" type="fixed">
|
||||||
|
<parent link="leg${id}_tibia"/>
|
||||||
|
<child link="leg${id}_tip"/>
|
||||||
|
<origin xyz="${tibia_length} 0 0" rpy="0 0 0"/>
|
||||||
|
</joint>
|
||||||
|
</xacro:macro>
|
||||||
|
|
||||||
|
<xacro:leg id="1" x="${coxa_diagonal_x}" y="${coxa_diagonal_y}" yaw="-0.7854" femur_roll="0"/>
|
||||||
|
<xacro:leg id="2" x="${coxa_center_x}" y="${coxa_center_y}" yaw="0" femur_roll="0"/>
|
||||||
|
<xacro:leg id="3" x="-${coxa_diagonal_x}" y="${coxa_diagonal_y}" yaw="0.7854" femur_roll="0"/>
|
||||||
|
<xacro:leg id="4" x="-${coxa_diagonal_x}" y="-${coxa_diagonal_y}" yaw="2.3562" femur_roll="3.1416"/>
|
||||||
|
<xacro:leg id="5" x="${coxa_center_x}" y="-${coxa_center_y}" yaw="3.1416" femur_roll="3.1416"/>
|
||||||
|
<xacro:leg id="6" x="${coxa_diagonal_x}" y="-${coxa_diagonal_y}" yaw="-2.3562" femur_roll="3.1416"/>
|
||||||
|
</robot>
|
||||||
@@ -113,7 +113,17 @@ The repository contains a few pieces that are still present but not fully connec
|
|||||||
|
|
||||||
* **Python:** 3.12 recommended
|
* **Python:** 3.12 recommended
|
||||||
* **OS:** Windows 10/11 or Linux
|
* **OS:** Windows 10/11 or Linux
|
||||||
* **Dependencies:** `pybullet`, `gymnasium`, `stable-baselines3`, `torch`, `numpy`, `pygame`, `ikpy`, `pyserial`, `matplotlib`, `dearpygui`
|
* **Dependencies:** `pybullet`, `gymnasium`, `stable-baselines3`, `torch`, `numpy`, `pygame`, `ikpy`, `pyserial`, `matplotlib`, `dearpygui`, `xacro`
|
||||||
|
|
||||||
|
## Robot model
|
||||||
|
|
||||||
|
Edit [`JackBotUrdf.xacro`](JackBotUrdf.xacro), which defines shared leg dimensions, coxa starting-position properties, and a reusable leg macro. Regenerate the checked-in URDF after changing the model:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
xacro JackBotUrdf.xacro -o JackBotUrdf.urdf
|
||||||
|
```
|
||||||
|
|
||||||
|
The `xacro` dependency is included in `requirements.txt`. Keep `JackBotUrdf.urdf` as generated output; the simulator and kinematics continue loading that file.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -13,3 +13,4 @@ stable-baselines3[extra]
|
|||||||
gymnasium
|
gymnasium
|
||||||
shimmy
|
shimmy
|
||||||
tensorboard
|
tensorboard
|
||||||
|
xacro
|
||||||
|
|||||||
Reference in New Issue
Block a user