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.
150 lines
4.9 KiB
C++
150 lines
4.9 KiB
C++
#ifndef __UT_ASSERT_HPP__
|
|
#define __UT_ASSERT_HPP__
|
|
|
|
#include <unitree/common/decl.hpp>
|
|
|
|
/*
|
|
* Declare assert output
|
|
*/
|
|
#define UT_ASSERT_OUT(debug, file, func, line, r) \
|
|
if (debug) \
|
|
{ \
|
|
std::cout << "[" << ::time(NULL) \
|
|
<< "] [" << ::syscall(SYS_gettid) \
|
|
<< "] UT_ASSERT DEBUG at __FILE__:" << file \
|
|
<< ", __FUNCTION__:" << func \
|
|
<< ", __LINE__:" << line \
|
|
<< ", r:" << r \
|
|
<< ", errno:" << errno \
|
|
<< std::endl; \
|
|
} \
|
|
else \
|
|
{ \
|
|
std::cout << "[" << ::time(NULL) \
|
|
<< "] [" << ::syscall(SYS_gettid) \
|
|
<< "] UT_ASSERT ABORT at __FILE__:" << file \
|
|
<< ", __FUNCTION__:" << func \
|
|
<< ", __LINE__:" << line \
|
|
<< ", r:" << r \
|
|
<< ", errno:" << errno \
|
|
<< std::endl; \
|
|
}
|
|
|
|
#define UT_ASSERT_ABORT(debug, file, func, line, r) \
|
|
if (debug) \
|
|
{ \
|
|
UT_ASSERT_OUT(1, file, func, line, r); \
|
|
} \
|
|
else \
|
|
{ \
|
|
UT_ASSERT_OUT(0, file, func, line, r); \
|
|
abort(); \
|
|
}
|
|
|
|
/*
|
|
* Declare assert return value
|
|
*/
|
|
#define UT_ASSERT_EQ(x, r) \
|
|
unitree::common::AssertEqual(x, r, 0, __FILE__, \
|
|
__PRETTY_FUNCTION__, __LINE__)
|
|
|
|
#define UT_ASSERT_EQ_DEBUG(x, r) \
|
|
unitree::common::AssertEqual(x, r, 1, __FILE__, \
|
|
__PRETTY_FUNCTION__, __LINE__)
|
|
|
|
#define UT_ASSERT_NOT_EQ(x, r) \
|
|
unitree::common::AssertNotEqual(x, r, 0, __FILE__, \
|
|
__PRETTY_FUNCTION__, __LINE__)
|
|
|
|
#define UT_ASSERT_NOT_EQ_DEBUG(x, r) \
|
|
unitree::common::AssertNotEqual(x, r, 1, __FILE__, \
|
|
__PRETTY_FUNCTION__, __LINE__)
|
|
|
|
/*
|
|
* Declare assert return value and errno
|
|
*/
|
|
#define UT_ASSERT_ENO_EQ(x, r, eno) \
|
|
unitree::common::AssertEqual(x, r, eno, 0, __FILE__, \
|
|
__PRETTY_FUNCTION__, __LINE__)
|
|
|
|
#define UT_ASSERT_ENO_EQ_DEBUG(x, r, eno) \
|
|
unitree::common::AssertEqual(x, r, eno, 1, __FILE__, \
|
|
__PRETTY_FUNCTION__, __LINE__)
|
|
|
|
#define UT_ASSERT_ENO_EQ_EX(x, r, eno) \
|
|
unitree::common::AssertEqualEx(x, r, eno, 0, __FILE__, \
|
|
__PRETTY_FUNCTION__, __LINE__)
|
|
|
|
#define UT_ASSERT_ENO_EQ_EX_DEBUG(x, r, eno) \
|
|
unitree::common::AssertEqualEx(x, r, eno, 1, __FILE__, \
|
|
__PRETTY_FUNCTION__, __LINE__)
|
|
|
|
/*
|
|
* Declare assert wrapper
|
|
*/
|
|
#define UT_ASSERT_0(x) \
|
|
UT_ASSERT_EQ(x, 0)
|
|
|
|
#define UT_ASSERT_DEBUG_0(x) \
|
|
UT_ASSERT_EQ_DEBUG(x, 0)
|
|
|
|
#define UT_ASSERT_ENO_0(x, eno) \
|
|
UT_ASSERT_ENO_EQ(x, 0, eno)
|
|
|
|
#define UT_ASSERT_ENO_DEBUG_0(x, eno) \
|
|
UT_ASSERT_ENO_EQ_DEBUG(x, 0, eno)
|
|
|
|
|
|
//Declare assert function
|
|
namespace unitree
|
|
{
|
|
namespace common
|
|
{
|
|
inline int AssertEqual(int r, int expectRet, bool debug,
|
|
const char* file, const char* func, int line)
|
|
{
|
|
if (UT_UNLIKELY(r != expectRet))
|
|
{
|
|
UT_ASSERT_ABORT(debug, file, func, line, r);
|
|
}
|
|
|
|
return r;
|
|
}
|
|
|
|
inline int AssertNotEqual(int r, int expectRet, bool debug,
|
|
const char* file, const char* func, int line)
|
|
{
|
|
if (UT_UNLIKELY(r == expectRet))
|
|
{
|
|
UT_ASSERT_ABORT(debug, file, func, line, r);
|
|
}
|
|
|
|
return r;
|
|
}
|
|
|
|
inline int AssertEqual(int r, int expectRet, int expectErrno, bool debug,
|
|
const char* file, const char* func, int line)
|
|
{
|
|
if (UT_UNLIKELY(r != expectRet) && UT_UNLIKELY(errno != expectErrno))
|
|
{
|
|
UT_ASSERT_ABORT(debug, file, func, line, r);
|
|
}
|
|
|
|
return r;
|
|
}
|
|
|
|
inline int AssertEqualEx(int r, int expectRet, int expectErrno, bool debug,
|
|
const char* file, const char* func, int line)
|
|
{
|
|
if (UT_UNLIKELY(r != 0) && UT_UNLIKELY(r != expectRet) &&
|
|
UT_UNLIKELY(errno != expectErrno))
|
|
{
|
|
UT_ASSERT_ABORT(debug, file, func, line, r);
|
|
}
|
|
|
|
return r;
|
|
}
|
|
}
|
|
}
|
|
#endif//__UT_ASSERT_HPP__
|