예제 #1
0
BOOL sentStrategyRobotPosition(unsigned char status, unsigned int x, unsigned int y, int angleInDeciDegree) {
	OutputStream* debugOutputStream = getOutputStreamLogger(INFO);
	appendString(debugOutputStream, "sentStrategyRobotPosition:");

    OutputStream* outputStream = getDriverRequestOutputStream();

    append(outputStream, COMMAND_STRATEGY_SET_ROBOT_POSITION);
    appendHex2(outputStream, status);
    appendSeparator(outputStream);

    appendHex4(outputStream, x);
    appendSeparator(outputStream);

    appendHex4(outputStream, y);
    appendSeparator(outputStream);

    appendHex4(outputStream, angleInDeciDegree);

	appendStringAndDec(debugOutputStream, "status=", status);
	appendStringAndDec(debugOutputStream, ", x=", x);
	appendStringAndDec(debugOutputStream, ", y=", y);
	appendStringAndDec(debugOutputStream, ", angle=", angleInDeciDegree);
	println(debugOutputStream);

    BOOL result = transmitFromDriverRequestBuffer();

    return result;
}
void disableNotificationRobotInfraredDetector(enum InfraredDetectorGroupType type) {
    OutputStream* outputStream = getDriverRequestOutputStream();

    append(outputStream, ROBOT_INFRARED_DETECTOR_DEVICE_HEADER);
    append(outputStream, DETECTOR_DISABLE_NOTIFICATION_COMMAND);
    appendHex2(outputStream, type);
    transmitFromDriverRequestBuffer();
}
예제 #3
0
BOOL motionDriverStop() {
    OutputStream* outputStream = getDriverRequestOutputStream();
    append(outputStream, COMMAND_MOTION_CANCEL);

    BOOL result = transmitFromDriverRequestBuffer();

    return result;
}
예제 #4
0
BOOL motionDriverObstacle() {
    OutputStream* outputStream = getDriverRequestOutputStream();
    append(outputStream, COMMAND_MOTION_OBSTACLE);

    BOOL result = transmitFromDriverRequestBuffer();

    return result;
}
예제 #5
0
BOOL motionDriverRight(float rightDeciDegree) {
    OutputStream* outputStream = getDriverRequestOutputStream();
    append(outputStream, COMMAND_MOTION_RIGHT_IN_DECI_DEGREE);
    appendHex4(outputStream, rightDeciDegree);

    BOOL result = transmitFromDriverRequestBuffer();

    return result;
}
예제 #6
0
bool clientDistributor2018EjectDirty(void) {
    OutputStream* outputStream = getDriverRequestOutputStream();
    append(outputStream, LAUNCHER_2018_DEVICE_HEADER);
    append(outputStream, DISTRIBUTOR_EJECT_DIRTY_BALL_COMMAND);

    bool result = transmitFromDriverRequestBuffer();

    return result;
}
예제 #7
0
BOOL motionDriverLeftOneWheel(float leftDeciDegree) {
    OutputStream* outputStream = getDriverRequestOutputStream();
    append(outputStream, COMMAND_MOTION_LEFT_ONE_WHEEL_IN_DECI_DEGREE);
    appendHex4(outputStream, leftDeciDegree);

    BOOL result = transmitFromDriverRequestBuffer();

    return result;
}
예제 #8
0
BOOL motionDriverBackward(float distanceInMM) {
    OutputStream* outputStream = getDriverRequestOutputStream();
    append(outputStream, COMMAND_MOTION_BACKWARD_IN_MM);
    appendHex4(outputStream, distanceInMM);

    BOOL result = transmitFromDriverRequestBuffer();

    return result;
}
예제 #9
0
bool clientLightOn2018(int launcherIndex) {
    OutputStream* outputStream = getDriverRequestOutputStream();
    append(outputStream, LAUNCHER_2018_DEVICE_HEADER);
    append(outputStream, LAUNCHER_LIGHT_ON_SERVO_MOVE_COMMAND);
    appendHex2(outputStream, launcherIndex);

    bool result = transmitFromDriverRequestBuffer();

    return result;
}
예제 #10
0
BOOL motionSetParameters(int motionType, int a, int speed) {
    OutputStream* outputStream = getDriverRequestOutputStream();
    append(outputStream, COMMAND_SET_MOTION_PARAMETERS);
    appendHex2(outputStream, motionType);
    appendHex2(outputStream, a);
    appendHex2(outputStream, speed);

    BOOL result = transmitFromDriverRequestBuffer();

    return result;
}
예제 #11
0
bool clientDistributor2018LoadAndSendUnicolorBallList(int direction) {
    OutputStream* outputStream = getDriverRequestOutputStream();
    append(outputStream, LAUNCHER_2018_DEVICE_HEADER);
    append(outputStream, LAUNCHER_LOAD_AND_SEND_UNICOLOR_BALL_LIST);
    
    appendHex2(outputStream, direction);
    
    bool result = transmitFromDriverRequestBuffer();

    return result;
}
예제 #12
0
BOOL sendStrategyConfiguration(int configuration) {
	appendString(getOutputStreamLogger(INFO), "sendStrategyConfiguration\n");

    OutputStream* outputStream = getDriverRequestOutputStream();

    append(outputStream, COMMAND_STRATEGY_SET_CONFIG);
    appendHex4(outputStream, configuration);

    BOOL result = transmitFromDriverRequestBuffer();

    return result;
}
bool robotInfraredDetectorHasObstacle(enum InfraredDetectorGroupType type) {
    OutputStream* outputStream = getDriverRequestOutputStream();
    InputStream* inputStream = getDriverResponseInputStream();

    append(outputStream, ROBOT_INFRARED_DETECTOR_DEVICE_HEADER);
    append(outputStream, COMMAND_INFRARED_DETECTOR_DETECTION);
    appendHex2(outputStream, type);
    bool result = transmitFromDriverRequestBuffer();
    if (result) {
        int result = readHex2(inputStream);
        return result == 0x01;
    }
    return false;
}
예제 #14
0
bool clientDistributor2018CleanNext(int direction) {
    OutputStream* outputStream = getDriverRequestOutputStream();
    InputStream* inputStream = getDriverResponseInputStream();

    append(outputStream, LAUNCHER_2018_DEVICE_HEADER);
    append(outputStream, DISTRIBUTOR_LOAD_NEXT_BALL_COMMAND);
    appendHex2(outputStream, direction);

    bool result = transmitFromDriverRequestBuffer();

    // Read the distance of detection, but we don't care about
    readHex2(inputStream);

    return result;
}
예제 #15
0
bool clientLaunch2018(int launcherIndex, bool prepare) {
    OutputStream* outputStream = getDriverRequestOutputStream();
    append(outputStream, LAUNCHER_2018_DEVICE_HEADER);
    if (prepare) {
        append(outputStream, LAUNCHER_PREPARE_BALL_COMMAND);
        appendHex2(outputStream, launcherIndex);
    }
    else {
        append(outputStream, LAUNCHER_SEND_BALL_COMMAND);
        appendHex2(outputStream, launcherIndex);
    }
    bool result = transmitFromDriverRequestBuffer();

    return result;
}
예제 #16
0
BOOL sendStrategyNextStep() {
	appendString(getOutputStreamLogger(INFO), "sendStrategyNextStep\n");

    OutputStream* outputStream = getDriverRequestOutputStream();
    InputStream* inputStream = getDriverResponseInputStream();

    append(outputStream, COMMAND_STRATEGY_NEXT_STEP);

    BOOL result = transmitFromDriverRequestBuffer();
    if (result) {
        int result = readHex2(inputStream);
		return result;
    }
    return FALSE;
}
예제 #17
0
BOOL motionDriverGotoPositionPulse(float left,
                                   float right,
                                   float a,
                                   float s) {
    OutputStream* outputStream = getDriverRequestOutputStream();
    append(outputStream, COMMAND_MOTION_GOTO_IN_PULSE);
    appendHex4(outputStream, left);
    appendHex4(outputStream, right);
    appendHex2(outputStream, a);
    appendHex2(outputStream, s);

    BOOL result = transmitFromDriverRequestBuffer();

    return result;
}
예제 #18
0
BOOL sendStrategyOpponentRobotPosition(Point* opponentRobotPosition) {
	OutputStream* debugOutputStream = getOutputStreamLogger(INFO);
	appendString(debugOutputStream, "sendStrategyOpponentRobotPosition: ");

    OutputStream* outputStream = getDriverRequestOutputStream();

    append(outputStream, COMMAND_STRATEGY_SET_OPPONENT_ROBOT_POSITION);
    appendHex4(outputStream, opponentRobotPosition->x);
    appendSeparator(outputStream);
    appendHex4(outputStream, opponentRobotPosition->y);

	appendStringAndDec(debugOutputStream, " x=", opponentRobotPosition->x);
	appendStringAndDec(debugOutputStream, ", y=", opponentRobotPosition->y);
	println(debugOutputStream);

    BOOL result = transmitFromDriverRequestBuffer();

    return result;
}
예제 #19
0
BOOL motionDriverBSplineAbsolute(float x, float y, float angle, float dist0, float dist1, int accelerationFactor, int speedFactor) {
    OutputStream* outputStream = getDriverRequestOutputStream();
    append(outputStream, COMMAND_MOTION_SPLINE_ABSOLUTE);
    appendHex4(outputStream, x);
    appendSeparator(outputStream);
    appendHex4(outputStream, y);
    appendSeparator(outputStream);
    appendHex4(outputStream, angle);
    appendSeparator(outputStream);
    appendHex2(outputStream, dist0);
    appendSeparator(outputStream);
    appendHex2(outputStream, dist1);
    appendSeparator(outputStream);
    appendHex(outputStream, accelerationFactor);
    appendHex(outputStream, speedFactor);

    BOOL result = transmitFromDriverRequestBuffer();

    return result;
}