demo: renamed demo folder to sample, updated readme

This commit is contained in:
Ruixiang Du
2023-03-31 09:55:40 +08:00
parent 4f8c9ac1cb
commit ac2c92e6d9
16 changed files with 11 additions and 4 deletions

View File

@@ -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

View File

@@ -120,14 +120,21 @@ The log file can be replayed using the following command
$ canplayer -I <candump-log-file-name>.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/)

View File

@@ -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();