Combination Report Einstein Robot

Download 10.84 Mb.
Date conversion08.07.2018
Size10.84 Mb.
1   ...   28   29   30   31   32   33   34   35   ...   41

Blue Tooth Protocol File Calls in VB

Byte 0: How many bytes total in your message. Don’t count bytes 0 and 1.

Byte 1: Always send 0x00 for this byte.

Byte 2: You have two options here. If you send 0x00 then the NXT will send you a return message. If you send 0x80 then no return message is sent. For most of the programs that I wrote I left this byte programmed with 0x00.

Byte 3: This is the command Byte. Sending the byte 0x00 tells the NXT that you are going to call a function.

Byte 4 - 21: In these bytes you send the ASCII equivalents of your file name. For example, byte 4 would be coded with the ASCII equivalent of the first letter in your software file name. In this example we are calling the software file right so ASCII (“l”) is sent.

Byte 5: Here you would send the ASCII value for “e”.

Byte 6: Send ASCII value of “f”

Byte 7: Send ASCII value of “t”

Byte 8: Send ASCII value of “.”

Byte 9: Send ASCII value of “r”

Byte 10: Send ASCII value of “x”

Byte 11: Send ASCII value of “e”

Byte 12: Send null terminator character “0” to end string. This is important!

An example of calling the left program from the NXT is shown below. You can call all of your software files on the NXT by modifying the program code below to match your own software files in visual basic.

'* This functions calles the left software file on the NXT


Dim byteOut(13) As Byte

byteOut(0) = &HB '11 bytes in output message

byteOut(1) = &H0 'should be 0 for NXT

byteOut(2) = &H80 '&H0 = reply expected &H80 = no reply expected

byteOut(3) = &H0 'Command

byteOut(4) = Asc("l") 'l character

byteOut(5) = Asc("e") 'e character

byteOut(6) = Asc("f") 'f character

byteOut(7) = Asc("t") 't character

byteOut(8) = Asc(".") '. character

byteOut(9) = Asc("r") 'r character

byteOut(10) = Asc("x") 'x character

byteOut(11) = Asc("e") 'e character

byteOut(12) = &H0

SerialPort1.Write(byteOut, 0, 13)

Blue Tooth Protocol Mailbox in VB

In the end we implemented a far better method to control the robot using Bluetooth. The technique discussed earlier was still beneficial because it allowed us to run our final program on the NXT. However, for each robot function such as (forward, reverse, left, right, arm up, etc...) we sent values to the NXT mailbox. These values were then manipulated by the program running on the NXT and that function was performed. The commands below are all implemented and fully functional.

  • Wrist Up

  • Wrist Down

  • Elbow Up

  • Elbow Down

  • Hand Open

  • Hand Close

  • Arm Left

  • Arm Right

  • Forward

  • Reverse

  • Right

  • Left

  • Stop

  • Motor Power Up

  • Motor Power Down

  • Shake Hand Routine

Below is an example of the hand open function.


'* Hand Open Function. This function opens the hand when it is called.


Dim byteOut(9) As Byte


byteOut(0) = &H7 '7 bytes in output message

byteOut(1) = &H0 'should be 0 for NXT

byteOut(2) = &H80 '&H0 = reply expected &H80 = no reply expected

byteOut(3) = &H9 'Command

byteOut(4) = &H0 'inbox 0

byteOut(5) = &H3 'message length 2 + 1 null

byteOut(6) = &H6 'protocal first byte

byteOut(7) = &H8A 'How far to move right

byteOut(8) = &H0 'null terminate

SerialPort1.Write(byteOut, 0, 9)

Catch ex As Exception


End Try

Visual Show Automation

Visual Show Automation (VSA), is a software GUI created by Brookshire Software. It allows one to control servos and automation using drag and drop techniques. The software was already purchased by the previous group and we were able to obtain a soft copy of the software from the president of the robotics society. The image below shows an example of the VSA screen. At the bottom of the screen a wav file is shown. This file can be imported by selecting tools -> load audio file from the menu. Before an animation is created, you have to define the servo definitions.

Wav File

Servo Definitions

Servo controls

Figure 14: Visual Show Automation
The servo definitions are setup in the tools -> settings -> device settings. This is the first step when defining servo name as it allows you to setup minimum and maximum values. Below are the current settings of the servos in the Bohr robot. After the servos are defined, you can drag bars onto the screen. The length of the bars represent the time an animation will run. If you double click a bar you can edit the servo beginning and end positions. For example, to rotate the head from left to right, drag a bar onto the rotate head line. Double click the bar and edit the begin and end positions. The starting position for the robot head is 156 (robot straight), to move the head to the right edit the end value to be 45. Then when the animation plays and the timeline runs over the bar that you just created, the robot head will move from the straight position and end in the right position.

Figure 15: Visual Show Device Settings

1   ...   28   29   30   31   32   33   34   35   ...   41

The database is protected by copyright © 2016
send message

    Main page