Dashboard (web/hand_web.py) - Record/replay panel driving g1_record_replay.py as a pty child: take library (replay/download/duplicate/rename/delete/upload/delete-all), pause & resume, and in-take key buttons that grey out in the --fingers modes the recorder ignores (measured: in touch mode the keys change nothing at all). - /api/restart is container-aware: it kills inspire_g1 and lets the supervisor relaunch it. It used to run manage.sh, which started a SECOND inspire_g1 beside the supervised one - two writers on one RS-485 bus - and never returned. - Shape/combo libraries take a .bak on every write, with an undo button. Both files are rewritten in full, so deleting the last entry was unrecoverable. recorder/ - The recorder lives in this project now: one source of truth for the CLI and the dashboard, with pause/resume added to replay. - record.sh picks a runtime by itself (a python with the SDK, the vendored SDK, or the inspire-hand container). bundle.sh packs a ~340KB portable kit. tools/ - preflight.sh: read-only readiness report for a new robot (hardware, docker, build prerequisites, per-robot settings) ending in an install-path verdict. - fetch_deps.sh: stage build dependencies, verifying the libs are aarch64. - export_ui.py: regenerate an embedding app's vendored copy of the UI. docker/ - build_image.sh resolves its dependencies from several layouts: deps/ inside the project, /usr/local, a source install prefix, or a ROS2 colcon workspace (where the idl headers live when /usr/local has none). - web/ is copied in the last layer, so dashboard edits skip the C++ rebuild. - restart=always, and start.sh always builds so an edit cannot silently run a stale image. deps/unitree_sdk2 is vendored so a robot that has never seen the SDK can build. Docs: README quickstart + embedding notes, SETUP_G1 corrected (that udev rule stopped creating /dev/inspire_* symlinks a while ago), ROBOT_README describing a live install.
87 lines
1.3 KiB
C++
87 lines
1.3 KiB
C++
#include <unitree/common/json/jsonize.hpp>
|
|
|
|
namespace unitree
|
|
{
|
|
namespace common
|
|
{
|
|
class Test : public Jsonize
|
|
{
|
|
public:
|
|
Test() : x(0), y(0), z(0)
|
|
{}
|
|
|
|
void fromJson(JsonMap& json)
|
|
{
|
|
FromJson(json["x"], x);
|
|
FromJson(json["y"], y);
|
|
FromJson(json["z"], z);
|
|
}
|
|
|
|
void toJson(JsonMap& json) const
|
|
{
|
|
ToJson(x, json["x"]);
|
|
ToJson(y, json["y"]);
|
|
ToJson(z, json["z"]);
|
|
}
|
|
|
|
public:
|
|
int x;
|
|
int y;
|
|
int z;
|
|
};
|
|
}
|
|
}
|
|
|
|
using namespace unitree::common;
|
|
|
|
int main()
|
|
{
|
|
std::vector<Test> vec;
|
|
|
|
Test t1;
|
|
t1.x = 1;
|
|
t1.y = 2;
|
|
t1.z = 3;
|
|
|
|
vec.push_back(t1);
|
|
|
|
Test t2;
|
|
t2.x = 10;
|
|
t2.y = 20;
|
|
t2.z = 30;
|
|
|
|
vec.push_back(t2);
|
|
|
|
Test t3;
|
|
t3.x = 100;
|
|
t3.y = 200;
|
|
t3.z = 300;
|
|
|
|
vec.push_back(t3);
|
|
|
|
std::string s = ToJsonString(vec);
|
|
|
|
std::cout << "s=" << s << std::endl;
|
|
|
|
std::vector<Test> vec2;
|
|
FromJsonString(s, vec2);
|
|
|
|
size_t i, size = vec2.size();
|
|
for (i=0; i<size; i++)
|
|
{
|
|
const Test& t = vec2[i];
|
|
std::cout << "t.x=" << t.x << ", t.y=" << t.y << ", t.z=" << t.z << std::endl;
|
|
}
|
|
|
|
std::map<std::string,std::string> tmp;
|
|
|
|
tmp["abc"] = "a1b1c1";
|
|
tmp["xyz"] = "x1y1z1";
|
|
|
|
s = ToJsonString(tmp);
|
|
|
|
std::cout << s << std::endl;
|
|
|
|
return 0;
|
|
}
|