From ac2c92e6d9e515ab7527086cb4dfe00e606a12f9 Mon Sep 17 00:00:00 2001 From: Ruixiang Du Date: Fri, 31 Mar 2023 09:55:40 +0800 Subject: [PATCH] demo: renamed demo folder to sample, updated readme --- CMakeLists.txt | 2 +- README.md | 11 +++++++++-- {demo => sample}/CMakeLists.txt | 0 {demo => sample}/bunker_demo/CMakeLists.txt | 0 {demo => sample}/bunker_demo/bunker_robot_demo.cpp | 0 {demo => sample}/hunter_demo/CMakeLists.txt | 0 {demo => sample}/hunter_demo/hunter_robot_demo.cpp | 0 {demo => sample}/ranger_demo/CMakeLists.txt | 0 {demo => sample}/ranger_demo/ranger_robot_demo.cpp | 0 {demo => sample}/scout_demo/CMakeLists.txt | 0 {demo => sample}/scout_demo/scout_mini_omni_demo.cpp | 0 {demo => sample}/scout_demo/scout_robot_demo.cpp | 0 {demo => sample}/tracer_demo/CMakeLists.txt | 0 {demo => sample}/tracer_demo/tracer_robot_demo.cpp | 2 +- {demo => sample}/utils_demo/CMakeLists.txt | 0 .../utils_demo/demo_protocol_detector.cpp | 0 16 files changed, 11 insertions(+), 4 deletions(-) rename {demo => sample}/CMakeLists.txt (100%) rename {demo => sample}/bunker_demo/CMakeLists.txt (100%) rename {demo => sample}/bunker_demo/bunker_robot_demo.cpp (100%) rename {demo => sample}/hunter_demo/CMakeLists.txt (100%) rename {demo => sample}/hunter_demo/hunter_robot_demo.cpp (100%) rename {demo => sample}/ranger_demo/CMakeLists.txt (100%) rename {demo => sample}/ranger_demo/ranger_robot_demo.cpp (100%) rename {demo => sample}/scout_demo/CMakeLists.txt (100%) rename {demo => sample}/scout_demo/scout_mini_omni_demo.cpp (100%) rename {demo => sample}/scout_demo/scout_robot_demo.cpp (100%) rename {demo => sample}/tracer_demo/CMakeLists.txt (100%) rename {demo => sample}/tracer_demo/tracer_robot_demo.cpp (98%) rename {demo => sample}/utils_demo/CMakeLists.txt (100%) rename {demo => sample}/utils_demo/demo_protocol_detector.cpp (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 22b2053..c2be0b0 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -116,7 +116,7 @@ target_include_directories(${PROJECT_NAME} PUBLIC # Build demo if(BUILD_WITHOUT_ROS) - add_subdirectory(demo) + add_subdirectory(sample) endif() # Build tests diff --git a/README.md b/README.md index 641f0d5..777be94 100755 --- a/README.md +++ b/README.md @@ -120,14 +120,21 @@ The log file can be replayed using the following command $ canplayer -I .log ``` -## Demo Code +## Sample Code -You can find demo code for each robot in "demo" folder. For example, run the demo for Scout robot +You can find sample code for each robot in "sample" folder. For example, you can run the demo for Scout robot ``` $ ./bin/demo_scout_robot can0 ``` +**Important note:** + +* **The demo program may command the robot to move!** Please make sure you have the remote controller with you and the + robot is in a safe place to move around. You can also modify the demo code to disable the motion commands. +* If the robot is not moving as expected, please first check if the remote controller is in manual mode and if the + E-Stop buttons are released. + ## Reference * [CAN command reference in Linux](https://notes.rdu.im/system/linux/canbus/) diff --git a/demo/CMakeLists.txt b/sample/CMakeLists.txt similarity index 100% rename from demo/CMakeLists.txt rename to sample/CMakeLists.txt diff --git a/demo/bunker_demo/CMakeLists.txt b/sample/bunker_demo/CMakeLists.txt similarity index 100% rename from demo/bunker_demo/CMakeLists.txt rename to sample/bunker_demo/CMakeLists.txt diff --git a/demo/bunker_demo/bunker_robot_demo.cpp b/sample/bunker_demo/bunker_robot_demo.cpp similarity index 100% rename from demo/bunker_demo/bunker_robot_demo.cpp rename to sample/bunker_demo/bunker_robot_demo.cpp diff --git a/demo/hunter_demo/CMakeLists.txt b/sample/hunter_demo/CMakeLists.txt similarity index 100% rename from demo/hunter_demo/CMakeLists.txt rename to sample/hunter_demo/CMakeLists.txt diff --git a/demo/hunter_demo/hunter_robot_demo.cpp b/sample/hunter_demo/hunter_robot_demo.cpp similarity index 100% rename from demo/hunter_demo/hunter_robot_demo.cpp rename to sample/hunter_demo/hunter_robot_demo.cpp diff --git a/demo/ranger_demo/CMakeLists.txt b/sample/ranger_demo/CMakeLists.txt similarity index 100% rename from demo/ranger_demo/CMakeLists.txt rename to sample/ranger_demo/CMakeLists.txt diff --git a/demo/ranger_demo/ranger_robot_demo.cpp b/sample/ranger_demo/ranger_robot_demo.cpp similarity index 100% rename from demo/ranger_demo/ranger_robot_demo.cpp rename to sample/ranger_demo/ranger_robot_demo.cpp diff --git a/demo/scout_demo/CMakeLists.txt b/sample/scout_demo/CMakeLists.txt similarity index 100% rename from demo/scout_demo/CMakeLists.txt rename to sample/scout_demo/CMakeLists.txt diff --git a/demo/scout_demo/scout_mini_omni_demo.cpp b/sample/scout_demo/scout_mini_omni_demo.cpp similarity index 100% rename from demo/scout_demo/scout_mini_omni_demo.cpp rename to sample/scout_demo/scout_mini_omni_demo.cpp diff --git a/demo/scout_demo/scout_robot_demo.cpp b/sample/scout_demo/scout_robot_demo.cpp similarity index 100% rename from demo/scout_demo/scout_robot_demo.cpp rename to sample/scout_demo/scout_robot_demo.cpp diff --git a/demo/tracer_demo/CMakeLists.txt b/sample/tracer_demo/CMakeLists.txt similarity index 100% rename from demo/tracer_demo/CMakeLists.txt rename to sample/tracer_demo/CMakeLists.txt diff --git a/demo/tracer_demo/tracer_robot_demo.cpp b/sample/tracer_demo/tracer_robot_demo.cpp similarity index 98% rename from demo/tracer_demo/tracer_robot_demo.cpp rename to sample/tracer_demo/tracer_robot_demo.cpp index 9b72fbb..e044725 100644 --- a/demo/tracer_demo/tracer_robot_demo.cpp +++ b/sample/tracer_demo/tracer_robot_demo.cpp @@ -59,7 +59,7 @@ int main(int argc, char **argv) { while (true) { // motion control std::cout << "Motor: 1.0, 0" << std::endl; - tracer->SetMotionCommand(0.0, 0.0); + tracer->SetMotionCommand(1.0, 0.0); // get robot state auto state = tracer->GetRobotState(); diff --git a/demo/utils_demo/CMakeLists.txt b/sample/utils_demo/CMakeLists.txt similarity index 100% rename from demo/utils_demo/CMakeLists.txt rename to sample/utils_demo/CMakeLists.txt diff --git a/demo/utils_demo/demo_protocol_detector.cpp b/sample/utils_demo/demo_protocol_detector.cpp similarity index 100% rename from demo/utils_demo/demo_protocol_detector.cpp rename to sample/utils_demo/demo_protocol_detector.cpp