Class Telerobot contains all features of telerobot.  The functions can be divided into two parts.

 

The first part (marked in green in the Method Summary ):  robot movement and environment detect functions. These functions control the telerobot, inclusive sensors , actuators and the telerobot system.

 

The second part (marked in blue in Method Summary ): system routine. These functions are used as background function. Users do not need to used them.

 

The original code please see  Telerobot.h

void  MotorConfigure(int p1d, int p1s, int p2d, int p2s, int d1d, int d2d):

 

Configure all the dc outputs.

 p1d =0, PWM1 channel has no output. p1d=1, PWM1 channels has positive output. P1d=2, PWM1 channels has negative output.

p1s has value from 0 to 99. p1s=0, PSM1 has no output. p1s=99, PWM1 has max output.

pP2d =0, PWM1 channel has not output. p2d=1, PWM2 channels has positive output. P2d=2, PWM2 channels has negative output.

p2s has value from 0 to 99. p2s=0, PSM2 has no output. p2s=99, PWM2 has max output.

d1d=0, DC1 channel has no output. d1d=1,DC1 channel has positive output. d1d=2, DC1 channel has negative output.

d2d=0, DC2 channel has no output. d2d=1,DC2 channel has positive output. d2d=2, DC2 channel has negative output.

 

 

void  MotorConfigure_Asensor(int p1d, int p1s, int p2d, int p2s, int d1d, int d2d):

 

Configure all the dc outputs.  Sensor channel 6 and 7 are used as analogue sensor

 p1d =0, PWM1 channel has no output. p1d=1, PWM1 channels has positive output. P1d=2, PWM1 channels has negative output.

p1s has value from 0 to 99. p1s=0, PSM1 has no output. p1s=99, PWM1 has max output.

pP2d =0, PWM1 channel has not output. p2d=1, PWM2 channels has positive output. P2d=2, PWM2 channels has negative output.

p2s has value from 0 to 99. p2s=0, PSM2 has no output. p2s=99, PWM2 has max output.

d1d=0, DC1 channel has no output. d1d=1,DC1 channel has positive output. d1d=2, DC1 channel has negative output.

d2d=0, DC2 channel has no output. d2d=1,DC2 channel has positive output. d2d=2, DC2 channel has negative output.

 

 

void relayMotor(int d1d, int d2d):

 

Configure 2  dc relay outputs. 

d1d=0, DC1 channel has no output. d1d=1,DC1 channel has positive output. d1d=2, DC1 channel has negative output.

d2d=0, DC2 channel has no output. d2d=1,DC2 channel has positive output. d2d=2, DC2 channel has negative output.

 

 

void relayMotor_Asensor(int d1d, int d2d):

 

Configure 2  dc relay outputs.  Sensor channel 6 and 7 are used as analogue sensor.

d1d=0, DC1 channel has no output. d1d=1,DC1 channel has positive output. d1d=2, DC1 channel has negative output.

d2d=0, DC2 channel has no output. d2d=1,DC2 channel has positive output. d2d=2, DC2 channel has negative output.

 

 

Function description

void Initial():

 

Initial the telerobot. Clean all input and output  buffer variables. Reset the system periode and fault tolerant records.

void checkGuiCommand():

 

This function is used if user wants to connect the process to the MCGUI application. Without this function, user can not join the MCGUI with this task program. Example I

char checkSum(char Input[DATALENGTH]):

 

Routine function checksum() works in backstage. It checks the data frame from input and output. Return value == true, means that the data frame has no failure. If value == false, it comes a failure in the data frame. If the checksum()==false has three times in a row, the emergencyProcess() function will be invoked immediately.

void emergencyProcess() :

 

emergencyProcess() will be invoked automatically if the function checkSum() ==false happens more than three times in a row. It turns off all DC hardware outputs and sends a emergency signal out. If the process connects with MCGUI, MCGUI can show the emergency alarm on the Graphic interface.

void update() :

 

           The update() function checks the communication port. It reads the input data and checks the it (using checksum() ). Finally, it updates all the input variables.     

Original code: Telerobot.h   Telerobot.cpp

 API Document :  Class Telerobot

API

Logo der Universität Hamburg

Constructor  Summary

Telerobot()

       Constructs an Telerobot object

~Telerobot()

       Destructs an Telerobot object.

Method Summary

char

getSensor1()

           Get sensor1 feedback. The feedback value is either true or false.

char

getSensor2()

           Get sensor2 feedback. The feedback value is either true or false.

char

getSensor3()

           Get sensor3 feedback. The feedback value is either true or false.

char

getSensor4()

           Get sensor4 feedback. The feedback value is either true or false.

char

getSensor5()

           Get sensor5 feedback. The feedback value is either true or false.

char

getSensor6()

           Get sensor6 feedback. The feedback value is either true or false.

char

getSensor7()

           Get sensor7 feedback. The feedback value is either true or false.

char

getSensor8()

           Get sensor8 feedback. The feedback value is either true or false.

void

ask()

           Ask the sensor status and robot does not execute any command.

void

ask_Asensor()

          Ask the sensor status and robot does not execute any command, sensor channel 6 and   7     are used as analogue  channel.

void

robotConnect()

             Build the connection between the personal computer and the telerobot.

void

disConnect()

             Break the connection between the personal computer and the telerobot.

void

moveForward(int speed)

             Pwm1 and Pwm2 output rotate in inverse direction with the same velocity. Attribute speed    demonstrates the rotate speed. Value range is from 0 to 99. Telerobot moves forward.

void

moveForwared_Asensor(int speed)

             Pwm1 and Pwm2 output rotate in inverse direction with the same velocity. Attribute speed    demonstrates the rotate speed. Value range is from 0 to 99. Telerobot moves forward. sensor channel 6 and   7  are used as analogue  channel.

void

moveBackward(int speed)

             Pwm1 and Pwm2 output rotate in inverse direction with the same velocity. Attribute speed    demonstrates the rotate speed. Value range is from 0 to 99. Telerobot moves backward.

void

moveForwared_Asensor(int speed)

             Pwm1 and Pwm2 output rotate in inverse direction with the same velocity. Attribute speed    demonstrates the rotate speed. Value range is from 0 to 99. Telerobot moves forward. sensor channel 6 and   7  are used as analogue  channel..

void

turnLeft(int speed)

            Pwm1 and Pwm2 output rotate in same direction with the same velocity. Attribute speed    demonstrates the rotate speed. Value range is from 0 to 99. Telerobot turns left.

void

turnLeft_Asensor(int speed)

            Pwm1 and Pwm2 output rotate in same direction with the same velocity. Attribute speed    demonstrates the rotate speed. Value range is from 0 to 99. Telerobot turns left. sensor channel 6 and   7  are used as analogue  channel.

void

turnRight(int speed)

            Pwm1 and Pwm2 output rotate in same direction with the same velocity. Attribute speed    demonstrates the rotate speed. Value range is from 0 to 99. Telerobot turns right.

void

turnRight_Asensor(int speed)

            Pwm1 and Pwm2 output rotate in same direction with the same velocity. Attribute speed    demonstrates the rotate speed. Value range is from 0 to 99. Telerobot turns right. sensor channel 6 and 7 are used as analogue  channel.

void

stop()

            All DC output will be closed.

void

stop_Asensor()

            All DC output will be closed. Sensor channel 6 and 7 are used as analogue channel

void

MotorConfigure(int p1d, int p1s, int p2d, int p2s, int d1d, int d2d)

           Configure all the dc outputs. More...

void

MotorConfigure_Asensor(int p1d, int p1s, int p2d, int p2s, int d1d, int d2d)

           Configure all the dc outputs. Sensor channel 6 and 7 are used as analogue channel. More…

void

relayMotor(int d1d, int d2d)

           Configure two Dc outputs. More...

void

relayMotor_Asensor(int d1d, int d2d)

           Configure two Dc outputs. Sensor channel 6 and 7 are used as analogue channel. More

void

missionOver()

           Configure the buzzer of the telerobot.

void

Initial()

           Initial the telerobot object before task started. More...

void

checkGuiCommand()

            Explain the Gui input data. More...

char

checksum()

            check the input and output data frame. If the check sum is right, the return value is true, else it is falseMore...

void

emgencyProcess()

            This function will be invoked immediately after the checksum()==false three times in a row. This function guarantees the security of the telerobot. More...

void

update()

           The update() function refresh all the input buffer variables. More...