> For the complete documentation index, see [llms.txt](https://acezxn.gitbook.io/vex-ji-qi-ren-cheng-shi-jiao-xue/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://acezxn.gitbook.io/vex-ji-qi-ren-cheng-shi-jiao-xue/fan-li-cheng-shi/ji-chu-di-pan-kong-zhi.md).

# 基礎底盤控制

方法1：使用PROS API:

```cpp
void opcontrol() {
	pros::Controller master(pros::E_CONTROLLER_MASTER);
	pros::Motor left_motor(1);
	pros::Motor right_motor(-2);

	while (true) {
		left_motor.move_velocity(std::fmin(std::fmax(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y) + master.get_analog(pros::E_CONTROLLER_ANALOG_RIGHT_X), -127), 127));
		right_motor.move_velocity(std::fmin(std::fmax(master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y) - master.get_analog(pros::E_CONTROLLER_ANALOG_RIGHT_X), -127), 127));
		pros::delay(10);
	}
}
```

方法2：使用Okapilib:

```cpp
// main.h

/**
 * You should add more #includes here
 */
#include "okapi/api.hpp" // <---
#include "pros/api_legacy.h" // <---
// 把上兩行的註解拿掉

// ...

/**
 * If you find doing pros::Motor() to be tedious and you'd prefer just to do
 * Motor, you can use the namespace with the following commented out line.
 *
 * IMPORTANT: Only the okapi or pros namespace may be used, not both
 * concurrently! The okapi namespace will export all symbols inside the pros
 * namespace.
 */
// using namespace pros; 
// using namespace pros::literals;
using namespace okapi; // 把這行的註解拿掉，但是要把pros的namespace都拿掉

```

```cpp
// main.cpp

void opcontrol() {
	Controller master(ControllerId::master);
	Motor left_motor(1);
	Motor right_motor(-2);

	while (true) {
		left_motor.moveVelocity(std::fmin(std::fmax(master.getAnalog(ControllerAnalog::leftY) + master.getAnalog(ControllerAnalog::rightX), -1), 1));
		right_motor.moveVelocity(std::fmin(std::fmax(master.getAnalog(ControllerAnalog::leftY) - master.getAnalog(ControllerAnalog::rightX), -1), 1));
		pros::delay(10);
	}
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://acezxn.gitbook.io/vex-ji-qi-ren-cheng-shi-jiao-xue/fan-li-cheng-shi/ji-chu-di-pan-kong-zhi.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
