Home
Joystick - Florida Gulf Coast University
Contents
1. try Thread sleep 30 catch Interruptedexception stop System out printin Stopped h SwingUtilities invokeLater updateJoyAxis else jaxispan setColor Color BLACK jaxispan addToX 0 jaxispan addToY 0 40 public void onEvent ActionEvent eve jaxispan repaint if eve getSource radioOn jjoystick addJoystickListener this Appendix 6 Created and Written by Jess Summerhill Florida Gulf Coast University JoySixAppJDS java Created on April 1 2008 7 53 PM SI This is property of Florida Gulf Coast University Any distrubution of this source code is at the liberty of the students and Professors at this college Therefore it is at the Universities discretion to whom this source code is distrubuted and modified A import com centralnexus input import java awt event import javax swing import java applet import java awt import java io import java net JFrame public class JoyStixAppJDS extends private JMenu mainMenu private JMenu helpMenu private JMenuItem exitApp private JMenuItem helpOnApp private JTabbedPane jstixTabApp private Icon patterns private ImageIcon helpdis 41 private Image helpimg private JLabel informativeTxt private JButton co
2. 580 t new Font Tahoma 1 t This establishes a 50 20 18 scrol tAreaCon sei tAreaCon sei tAreaCon sei lAreaCon sel getConnected add tColumns 20 tRows 5 tEditable false t ViewportView txtAreaCon scrollAreaCon scrollAreaCon setBounds 190 110 330 350 getConnected add connectButton connectButton setFont new Font Verdana 1 16 connectButton setText Connect connectButton setToolTipText Establish a connection to the robot connectButton setBounds 160 500 130 35 connectButton addActionListener new ActionListener public void actionPerformed ActionEvent eve connectAct eve getCon discon 1 16 discon discon the bluetooth discon discon ActionListener blic void actionPerformed ActionEvent eve pu n tB t ec ton ton con con setFont new setTex se disconnectAct eve setBounds 420 50 addActionListener new ted add disconnectButton ton Font Verdana t Disconnect tToolTipText Disconnect from 0 130 35 jstixTabApp addTab Robo Movement Tracker trackroboPanel roboMovePatterns setLayout null jstixTabApp addTab Robo Movement Patterns roboMovePatterns Color mellowgreen new Color 0
3. The end result is a fully robust application that fully interacts with the joystick and with the robot as well with some difficulty though This is the topic for a future which would allow the robot to be controlled from the Internet 23 On the positive side the music works well However there was some difficulty getting this to work with the robot s Bluetooth program because this program is also built on using an infinite loop and not multi threaded program Thus there are some problems with switching between the music and the robot patterns These bugs should be fixed Therefore the next stage is to get the whole program engineered to a more stable and fluid state both with the computer end application and the robot application This is needed because there are bugs on both sides The next initial step is to solve the concurrency problems with the GUI application Once solved this should resolve problems between the data streams established between the Bluetooth modules The next and assumed final phase to resolve all problems with the robot side of the application would be to fix the concurrency problems with the robot program Several threads need to be running synchronously but as of current there are no handlers in the software therefore there are timing issues Once completed all the bugs in both applications should be resolved Appendix Appendix 1 import import robotics intellibrain com ridgesof com
4. 8 gt Authentication Send Break Service Class Device Class Encryption Factory Defaults Inguiry Scan Window Page Scan Window Parity Mode X8 slau i mstr 2 trig 3 auto 4 DTR 5 f invy Name conn discon Status Pin Code Remote fiddress Seruice Name Config Timer Baudrate Sniff Rate Bonding TR power Raw Baudrate 7bit data Profile X8B8 SPP 1 DCE 2 DTE 3 MDM role switch CMD mode char io port dir io port val io boot dir io boot val pio lt 8 11 gt set wee DISPLAY Basic Settings Extended Settings Stored setting BT Address Connect Status 1 0 Ports Firmare version R HEH Connect Kill lt disconnect gt Link Quality Pass Thru Quiet lt no discovery Figure 14 TeraTerm Firmware Setup for Bluetooth On the part of the Bluetooth modules all that it really needed is to tell the firmware on the modules which one is the master and which is the slave The main part of this project that makes it different from the project is the robot built GUI The MAIN project source a GUI consisting of several source files most of them at least 300 lines of code each is presented in Appendix 6 NetBeans 6 0 has been to design the program As you can see this application is quite robust I would be more efficient to for me to show you screen shots of the program running 26 B Jess s Joystick Remote Control Robo Program File Help i Robo Movement Tracker Robo Movement Patte
5. The Bluetooth modules vvere successfully integrated vvith the computer main board as the USB to serial This was accomplished with the aid of Tim Bennett Who has expertise is in working with hardware He has helped with soldering wires that allow for hardware integration with the robot s main board and getting the Bluetooth serial device working and adding serial cables and correctly configuring them to interact with the robot It is described in further detail in the solution part of this paper 2 5 Robotic Basics Software The basics of the software setup were obtained from the Ridgesoft website The only thing needed is to install the RoboJDE as shown in figure 8 16 BE OB 88 am TA 9 VM State Invalid port Free Blocks CPU Utilization Threads Free Bytes Memory Utilization C 1 Objects Figure 8 The RoboJDE Screen Shot It turned out to be necessary to also install a window XP virtual machine shown in figure 9 to allow the robot software to run under Vista File Edit View VM Team ACE Windows Help fbutla Gur Gap Beaches Sidebar x 5 Windows XP Home Edition R D Powered On N ai B Favorites Windows XP Home Edition RoboJDE 8 Windows XP Home Edition RoboJDE State Powered off Recent ACE Management Servers Guest OS Windows XP Home Edition Configuration file C Users Ruum Documents Virtual Machines Windows
6. XP Home Edition RoboJDE Windows XP Home Edition vmx Version Workstation 6x virtual machine Commands Devices D Start this virtual machine ED Memory 512 MB fh Edit virtual machine settings C2 Hard Disk IDE 0 0 10 0 GB m Clone this virtual machine e CD ROM IDE 1 0 Auto detect Clone to ACE master Floppy Auto detect E Ethernet Bridged O USB Controller Present Q Sound Adapter Auto detect Display Auto detect Processors 1 Notes Type here to enter notes for this virtual machine Figure 9 The Windows XP Virtual Machine Screen Shot 17 Using the virtual machine one can get the RoboJDE to vvork vvith the hardyvare More of this is discussed in the next solution section 2 6 Robo Music Box While trying to get the robot to work for the first time it was noticed in the robot programming examples that the robot has installed a simple analog speaker built on the robot handy board in figure 4 that will allow for a polyphonic sound The original is the OdeJoy rjp file The robot played simple polyphonic sound and its code allowed the tempo to be controlled by the thumbwheel To prove that it works for other songs two additional files were added The first song is The Entertainer by Scott Joplin and the second is the Halo theme song by Marty O Donnell Section 3 Problem Solution This section s emphasis is what has been currently implemented and to reach the current objectives of t
7. in the text above I have requested and have been granted permission by the two parties mentioned to publish their names and email addresses Timothy Bennett tdbennet eagle fgcu edu Figure xxx Jaxson Dermer j mdermer yahoo com Figure yyy 48 Figure yyy 49 References 1 RidgeSoft Pleasanton CA 2009 http www ridgesoft com 2 Neven Skoro FGCU Florida 2006 http satnet fgcu edu nskoro 3 VVikimedia Foundation February 15 2009 http en wikipedia org wiki The Entertainer rag 4 Bungie Studios Washington March 12 2008 http www bungie net Inside MeetTheTeam aspx person odonnell 5 Logitech Fremont CA 2009 http www logitech com index cfm gaming pc_gaming joysticks devices 302 amp cl us en 6 Netbeans Sun Microsystems Inc Santa Clara CA 2008 http dlc sun com netbeans 6 0 final 7 George Rhoten 2000 2002 http sourceforge net project showfiles php group id 14848 8 Keane Jarvi 1998 2006 http users frii com Jarvi rxtx index html 9 Sun Microsystems Inc Santa Clara CA 2008 http www sun com software products virtualbox get jsp 50
8. n Are you sure you want to exit JOptionPane YES NO OPTION JOptionPane QUESTION MESSAGE if response JOptionPane NO OPTION 1 System exit 0 else return public void helpInfo ActionEvent eve AudioClip audio Applet newAudioClip helpurl Object options Play Stop Return int response JOptionPane showOptionDialog this Jsummerh eagle fgcu edu Help information JOptionPane YES NO CANCEL OPTION JOptionPane INFORMATION MESSAGE null options options 2 switch response 1 case JOptionPane YES OPTION audio play break case JOptionPane NO OPTION audio stop break case JOptionPane CANCEL OPTION return public void triangleAct ActionEvent eve 1 JOptionPane showMessageDialog this Triangle stuf Essa Cg public void squareAct ActionEvent eve 47 JOptionPane showMessageDialog this Square Stuff t s public void zigzagAct ActionEvent eve 1 JOptionPane showMessageDialog this Zig zag SEUEL public void mazelikeAct ActionEvent eve JOptionPane showMessageDialog this Maze like StUEE es public static void main String args throws IOException JoyStixAppJDS joyStixApp new JoyStixAppJDS joyStixApp setVisible true joyStixApp setResizable false Acknowledgements Two people assisted at various stages of the project as mentioned
9. ridgesof ct ct Ct ct public class MoveRoboSquare 1 public static void main String args throws InterruptedException Servo leftwheel IntelliBrain getServo 1 Servo rightwheel IntelliBrain getServo 2 Add your code here for int i 0 i lt 4 i leftwheel setPosition 0 rightwheel setPosition 100 34 Thread sleep 7500 leftwheel setPosition 100 rightwheel setPosition 100 Thread sleep 625 leftwheel off rightwheel off Appendix 2 import import com ridgesoft com ridgesofi robotics intellibrain ct ct public class MoveRoboTriangle public static void main String args throws InterruptedException Servo leftwheel IntelliBrain getServo 1 Servo rightwheel IntelliBrain getServo 2 Add your code here for int i 0 i lt 3 i i leftwheel setPosition 0 rightwheel setPosition 100 Thread sleep 5000 leftwheel setPosition 100 rightwheel setPosition 100 Thread sleep 313 leftwheel off rightwheel off Appendix 3 public class MoveRoboForward public static void main String args throws InterruptedException Servo leftwheel IntelliBrain getServo 1 Servo rightwheel IntelliBrain getServo 2 35 Add your code here T ftuh l s tPosition 0 rightwheel setPos
10. to be applied The user vvill take the end of the serial cable that is not connected to the computing device and connect it to the Handyboard s serial port seen in figure 4 Once completed upload and deploy the robot application to the robot Disconnect both ends of the serial cable to both the computing device and the robot Connect the modified serial cable the computing device this cable has black electrical tape on it and has to labels on each end of the cable make sure that the serial cable end that is labeled PC is connected to the serial port on the computing device This is seen in figure 13 Connect the Bluetooth module to the modified serial cable end that is not connected to the computing device Once connected plug in the power cord to the Bluetooth module for the computing device and make sure that the LED is lit and the other is blinking The end result should either be exactly the same in figure 13 or very similar Figure 13 has the serial to USB device connected to the cable The indication that the Bluetooth modules have properly synchronized is that one of the LED have stopped blinking and turned to a solid color light on both Bluetooth modules The final step is for the user to connect the Joystick of choice to his or her s computing device The user should be able to start the application that he or she as created for the computing device to control wirelessly the robot via the Blu
11. 199 0 roboMovePatterns setBackground mellowgreen for roboPa roboPa will move in a int i 0 ig robopatnTT tnBu tonlil new tnBu ton i setTool 44 length i JButton 7 ITipText The robot robopatnTT i pattern patterns i new mageIcon getClass getResource filenames i roboPatnButton i setIcon patterns i roboMovePatterns add roboPatnButton i roboPatnButton 0 setBounds 60 75 250 125 roboPatnButton 1 setBounds 380 75 250 125 roboPatnButton 2 setBounds 60 320 250 125 roboPatnButton 3 setBounds 380 320 250 125 roboPatnButton 0 addActionListener new ActionListener 1 public void actionPerformed ActionEvent eve triangleAct eve roboPatnButton 1 addActionListener new ActionListener 1 public void actionPerformed ActionEvent eve SquareAct eve roboPatnButton 2 addActionListener new ActionListener 1 public void actionPerformed ActionEvent eve zigzagAct eve 1 roboPatnButton 3 addActionListener new ActionListener 1 public void actionPerformed ActionEvent eve mazelikeAct eve i jstixTabApp addTab Testing Joystick Movement joystixdis set JMenuBar joystixMenuBar joystixMenuBar add mainMenu mainMenu setMnemonic KeyEvent VK_ALT mainMenu s
12. Bluetooth Robot Remote Joystick Control jsummerh eagle fgcu edu satnet fgcu edu jsummerh csidc fgcu edu jsummerh Florida Gulf Coast University Professor Janusz Zalewski CEN 3213 Embedded Systems Date Modified February 20 2009 Table Of Contents 1 Preface User Manual a Initial Setup i Disclaimer ii Software iii Hardware 2 Section 1 Introduction a Problem introduction i Initial Setup ii Robotic Basics Hardware ili Joystick iv Robotic Basics Software v Robo Music Box 3 Section 3 Problem Solution a Initial Setup b Robotic Basics Hardware c Robotic Basics Software Conclusion Appendix Acknowledgements A 5 cx Reference Preface User Manual This user manual is designed for the next university student or hobbyist that might have an interest in this project Direction disclaims and caution will be given to the user who decides to undergo the continuation of this project If any problems arise all the needed information to contact me is on the title page of this document Please note that all of the work has been completed for the wiring of the Bluetooth modules firmware configuration for the modules which is displayed in figure 14 and acquiring the needed Java software libraries for the joystick and the serial ports reference 7 and 8 Thus instruction will be given on the current information needed for installment D
13. S8N pause here Beat MS4N Beat MS8N Beat MSI16N Beat MS16N Beat MSI16N Beat MS8N Beat MS16N Beat MS8N Beat MS16N Beat MS16N Beat MS4N Beat MS16N Beat MSI16N Beat MS16N Beat MSI16N Beat MS16N Beat MS16N Beat MS16N Beat MS16N Beat MS16N Beat MS16N Beat MS8N Beat MS4N Beat MS8N Beat MS16N Beat MS16N Beat MS16N Beat MS16N Beat MS16N Beat MS16N Beat MS16N Beat MS16N Beat MS16N Beat MS16N Beat MS4N Beat MS8N Beat MSI16N Beat MS16N Beat MS16N Beat MS8N Beat MSI16N Beat MS8N Beat MSI16N Beat MS16N Beat MS4N Beat MS16N Beat MSI16N Beat MS16N Beat MS16N Beat MS16N Beat MS16N Beat MS16N Beat MS16N Beat MS16N Beat MS16N Beat MS8N Beat MS4N Beat MS8N Beat MSI16N Beat MS16N Beat MS16N Beat MS16N Beat MS16N Beat MS16N Beat MS16N Beat MS16N Beat MS16N Beat MS16N Beat MS16N Beat MS16N Beat MS16N Beat MS16N Beat MS16N Beat MS16N Beat MS16N Beat MS16N Beat MS16N Beat MS16N Beat MS16N Beat MS16N MS16N MS16N MSSN 116 static int notesArry Note D Note E Note C Note A Note A Note B Note G Note D Note E Note C Note A Note A Note B Note G 37 z O te D Note E Note C Note A Note A Note B Note A Note G S Note G 0 Note D Note D S Note E Note C Note E Note C Note E Note C 0 Not
14. e C Note D Note D S Note E Note C Note D Note E Note B Note D Note C O0 Note D Note D S Note E Note C Note E Note C Note E Note C Note C Note A Note G Note F S Note A Note C Note E Note E Note D Note C Note A Note D Note D S Note E Note C Note E Note C Note E Note C Note C Note D S Note E Note A Note D Note E Note B Note D Note C Note C Note D Note E Note C Note D Note C Note E Note C Note D Note C Note E Note By Notes Dy Note MITIS public static void playMusic Speaker speaker for int i20 i lt notesArry length i Speaker play notesArry i beatsArry i public static void main String args throws InterruptedException System out println Press START to replay PushButton startButton IntelliBrain getStartButton Speaker speaker IntelliBrain getBuzzer playMusic speaker while startButton isPressed 1 Thread sleep 100 38 Appendix 5 import com centralnexus input private Joystick jjoystick Joystick createInstance public class JoyStixDisplayTest extends JPanel implements Joysticklistener 1 public void joystickButtonChanged Joystick j 1 j jjoystick if radioOn isSelected if j isButtonDown jJ BUTTON4 displayTestButtons 0 setForeground Color RED displayTestB
15. e notice that the disclaimer suggests that the user should have the required knowledge of integrating the required jar file into their development environment of choice a There are instructions for initial setup in other platforms such as Linux Mac and Solaris the required system files accompany the instructions as well therefore depending on the platform depends how the system files will be placed and how the operating system will recognize these system files Please download the JavaJoystick package in reference 7 The setup process is nearly identical for this package as it is in set 2 Repeat the file placement with the 33stick aii and setup the Joystick jar file the same way as instructed as in the set 2 a This same information and system files are provided in this package also The final suggested step before the user applies the robot application to be run on the HandyBoard figure 4 is take the Java source code written in the users Java development of choice that is to be run on the robot and open it with the RidgeSoft JDE and use this software environment to compile and deploy the software onto the HandyBoard I b Hardware setup This will provide similar step by step instructions with hardware acquired by Professor Zalewski to the initial setup and deployment of the Bluetooth wireless robot application Therefore it is assumed that the user has received from the Professor the hardware that was acquired configured and
16. ences 7 and 8 This requirement maybe optional If the current computing device the user is working with does not have a serial port then a serial to USB device will need to be acquired like in figure 5 Once acquired install the required software to use this device His or her Joystick of choice that can be acquired locally similar to the one in figure 6 Finally it is highly advisable that the user acquire a Java programming environment of choice Netbeans reference 6 is the example of choice in the project The user is encouraged to use one he or she prefers Figure i List of requirements I a Software setup This section will guide and direct the current user which could be a university student or computing hobbyist the required steps for writing robot programs that will be uploaded to the robot Handyboard figure 4 or adding the required Java libraries to the Java development environment to create an application that vvill run on the computer that will wirelessly communicate with the robot Therefore the user needs to be aware that to create software that will wirelessly control the robot there needs to be two applications created one application will be running on the user s computer that will be sending data to the application running one the robot and the application running on the robot Handyboard figure 4 receiving data from the application running on the computer The following information lists the steps needed t
17. eracting with software Whether it is a simple application such as a calculator or a whole project that could change the computing world such as building a conscience AI program that can understand human word and sentences and respond accordingly it is clear that for a computer to work the hardware and the software have to be functional to the point where the user has the capacity for full optimization of the device that he or she is using In this project it s to use the hardware with the programming language Java to program the robot to interact with the Bluetooth device and the joystick game device to interact with a server to perform a remote control link with the robot Section 2 Problem Specification This project is a multilayered problem to the robot and it involves several steps to achieve the objectives There are a lot of issues that need to be overcome and some problems have already been addressed The synopsis of the project is pretty straightforward The purpose of the endeavor is to look at the former project reference 2 produce the same results 2 1 Problem introduction The problem is reuse code and buy the additional hardware to be purchased and configured to this project s required specifications not only to duplicate the previous project reference 2 did but also build a java application that will interact with the robot and joystick devices The hardware includes the Bluetooth serial module and
18. etText File helpMenu setText Help G 45 exitApp setAccelerator KeyStroke getKeyStroke KeyEvent VK X inputEvent CTRL MASK exitApp setText Exit Program mainMenu add exitApp exitApp addActionListener new ActionListener public void actionPerformed ActionEvent eve exitOption eve i helponApp setText Help info Ys helpOnApp setAccelerator KeyStroke getKeyStroke KeyEvent VK F1 0 helpOnApp addActionListener new ActionListener public void actionPerformed ActionEvent eve helpinfo eve joystixMenuBar add helpMenu helpMenu add helpOnApp jstixTabApp setForeground Color WHITE jstixTabApp setBackground Color BLACK getContentPane add jstixTabApp java awt BorderLayout CENTER pack Gparam args the command line arguments aad public void connectAct ActionEvent eve JOptionPane showMessageDialog this Connect SEUL way public void disconnectAct ActionEvent eve 1 JOptionPane showMessageDialog this Disconnect Stutfficscvt s public void exitOption ActionEvent eve int response JOptionPane showConfirmDialog this 46 Are you sure you would like to exit the program n nPlease enter YES if you want to exit nEnter NO if you want to return to the program Anand you dont have a amp clue how you got to this message
19. etooth modules using the joystick The disclaimer suggests that there is no instruction on creating an application that will work with these devices The website in reference 2 has an example as well as the website provided in the heading of this document Section 1 Introduction What is the purpose of learning embedded systems or a better question is why learn how to program any type of hardware Well the very simple answer is that we must learn how software interacts with hardware As someone who desires to pursue software development as a potential career I realize the need to learn this skill Software that really doesn t do anything to the hardware is pretty useless software and the contrary is also true hardware that does not have any software programming into is pretty useless as well Software that does not interact with hardware in any shape or form is like having a set of instructions on how to fly a remote control airplane without the airplane Software tells the hardware what to do it is the set of instructions that hardware follows exactly If the computer is told to go jump off a bridge given the correct hardware it will do so This class s emphasis is on the bridge between hardware and software This project is going to take knowledge of making software work in unison with hardware For a programmer and a computer scientist it is important to not only realize but put into practice the concept of hardware int
20. f the data was requested To solve this problem I have connected pins 7 and 9 to 7 each other on the robot s Bluetooth module so it always thinks data is ready to be received and transmitted PC Bluetooth DCD 1 1 DCD RD 2 2 RD TD 3 3 TD DTR 4 4 DTR SGND 5 5 SGND DSR 6 6 DSR E ND CTS 8 8 CTS 9 9 Figure 10 The Wiring the RXTX devices correctly 19 PRERE Above we can see the solution to the problem We can simply wire pins 1 4 and 6 together so that the computer things it found the device looping back DTS DTR and DCD back to itself On the computer part of the connection I had to wire pins 1 4 and 6 together because the Bluetooth modules only use pins 2 3 5 7 9 and therefore it does not tell the computer if a DCD device vvas detected on the other end This term is know as spoofing the connection and should be done very carefully Further on the robot side On the robot side I have connected the brown wire to the send pin red to the receive pin yellow to the ground pin and gray to the power pin The corresponding pin to the colors can be found in the coloring table below Figure 11 DB9 Pin Wire Color RS232 DCE RS485 4 wire RS485 2 wire 1 Black DCD 2 Brown RXD TX T R A 3 Red TXD RX 4 Orange DTR 5 Yellow GND GND 6 Green DSR 7 Blue RTS RX 8 Violet CTS TX T R B 9 Gray PWR RI PWR PWR i Figure 11 The Classifying the RXTX Wires However there were some complications due to s
21. he project I included pictures and code examples to show the approach to the problems encountered A fully robust GUI was built that not only allows the user to use the joystick but also provides an audio tutorial that explains the details of this project 3 1 Initial Setup As stated previously it was necessary to install a virtual machine on the server to get the RoboJDE working A fellow student Timothy Bennett see Acknowledgements 18 section was able to provide the means of installing the Window s XP virtual machine onto the server and aided vvith setting up the COM ports and the baud rate correctly Once this vvas established the RoboJDE vvas able to establish a connection to the robot and upload any program written 3 2 Robotic Basics Hardware To have the Bluetooth module be soldered to the robot s main board and have the Bluetooth interact with the serial to USB device on the server the instructions from the original report we followed reference 2 The spoofing of the serial cables is required to make the connection between the robot and the computer work Bellow we can see the colors used in a regular serial cable for corresponding pin The standard RS232 cable has 9 pins which we can see from the table 1 3 Most DCE devices only use pins 2 3 5 which are Receive transmit and ground respectively This makes at problem for the Bluetooth because it requires an active CTS and RTS signals in order to know i
22. isclaimer Instruction will not be giving on how to program the Ridgesoft robot reference 1 nor how to install the Java programming environment of choice nor instructions on how to assemble the robot Instruction on robot assembly should not be needed since the one given to the user should be assembled and so should proper installment of the Bluetooth modules There will not be given any instruction on using the Java programming language this knowledge should be assumed before attempting the project The chosen Java programming environment for this project was Netbeans reference 6 These are things that can either be easily acquired knowledge by visiting the required websites or it is at the current user s discretion of the preferred Java programming environment de de aja aja ge aie ale aie oe oe oe K K K K K K K K K K K K KK ale je e K ale K K 2 ok ok End of Disclaimer cese oe eoe oe e ok ok ole K ale K K K K K K K K KK K K K ze KK K K K I Initial Setup This guide vvill consist of tyvo parts the hardyvare required for setup and the required software for installment Figure i will list the needed requirements 1 2 The Ridgesoft robot with Bluetooth module installed visible in figure 11 The serial cable that will connect to the user s computing device of choice in figure 13 and example could be a server laptop or personal pc The Javajoystick and the RXTX Java libraries which can be acquired and downloaded using refer
23. ition 100 Thread slee leftwheel o rightwheel off p 10000 ff Appendix 4 import com ridgesoft robotics import com ridgesoft intellibrain import com ridgesoft io public class RoboMusicMan public static class Note 1 public static final int C 262 public static final int C S 277 public static final int D 294 public static final int D S 311 public static final int E 330 public static final int F 349 public static final int F S 370 public static final int G 392 public static final int G S 415 public static final int A 440 public static final int A S 466 public static final int B 494 This is for playing a song 8 80 beats per minute public static class Beat 1 final final final S S S tatic int M tatic int M tatic int M static int beatsArry Beat MS16N Beat MS16N Beat MSI6N Beat SAN 850 S8N 475 S16N 288 Beat MS16N Beat MSI16N MS16N Beat MS8N 36 Beat MS16N Beat MS16N Beat MS16N Beat MS16N Beat MS16N Beat MS16N Beat MS8N Beat MS16N Beat MSI16N Beat MS16N Beat MS16N Beat MS16N Beat MS16N Beat MS16N Beat MS16N Beat M
24. n the Firefly manual directly above section 5 1 2 The connection from pins 4 to 6 was not necessary on the robot side because the Bluetooth controller is not capable of using those pins As aresult the robot with the Bluetooth module on it looks as in figure 11 PC pin Bluetooth pin 2 3 7 8 1 4 6 1 7 8 5 5 6 Null 9 Null Null 9 Table 2 New Wiring configuration 21 Figure 11 The Bluetooth Wired to the Robot Figure 12 displays the custom cable that time wired to meet the new specifications in table 2 This was wired to the handy board in figure 4 It is this wire that connects to the Bluetooth module and transmits the signal wirelessly to the computer side Bluetooth module in figure 13 22 Figure 12 The Bluetooth Device VVired for the Robot This was done on the robot side of the project which communicated with the Bluetooth module that vvas connected to the computer side my laptop 23 I E LI Figure 13 The Bluetooth Device Wired for the Computer 3 3 Robotic Basics Software There are several software solutions to this project e First one can follow the RoboJDE has given examples It makes sense to use the example source code to upload a program to the robot and see the effect One can also examine the example code to analyze it so one could use the robot Java libraries to create my program e Second one can use the online resources and the given code exam
25. nnectButton private JButton disconnectButton private JScrollPane scrollAreaCon private JTextArea txtAreaCon private JSeparator separateConnect private JPanel getConnecteg protected WatchRoboTracker trackroboPanel protected JoyStixDisplayTest joystixdis private JButton roboPatnButton private javax swing JPanel roboMovePatterns End of variables declaration GEN END variables private JMenuBar joystixMenuBar private URL helpurl getClass getResource helpInfoMessage wav private String robopatnTT triangle square zig zag maze like Jj private String filenames i triangle jpg square jpg zigzag jpg maze jpg Creates new form JoySixAppJDS public JoyStixAppJDS throws IOException setTitle Jess s Joystick Remote Control Robo Program initComponents setSize 700 650 Dimension findscreensize getSize Dimension screensize Toolkit getDefaultToolkit getScreenSize int x screensize width findscreensize width 2 int y screensize height findscreensize height 2 x Math max 0 x keep the corner on the screen y Math max 0 y setlocation x y This method is called from within the constructor to initialize the form WARNING Do NOT modify this code The content of this method 42 allows for main componen
26. o setup and deploy the software requirements for deployment of the wireless application 1 Visit the Ridgesoft website reference 1 and download the RoboJDE in figure 8 This will allow the user to compile and deploy robot application for the Handyboard figure 4 May the user take note that the version for the RoboJDE used in this project is not the current version and did not support Windows Vista Ridgesoft reference 1 has as of recent updated their software to accommodate the most recent Microsoft operating system a Since this project did not have a Window s Vista compatible RoboJDE the Virtual machine is an optional step An example of a free virtual machine is available to download in reference 9 It may still be necessary to have to download and use a virtual machine of the user s choice for this project due to complications in using Vista with COM ports 2 Visit Trent Jarvi s website reference 8 and download the Java RXTX software package Once acquired it will be necessary to copy the file rxtxSerial d11 and the rxtxParalle1 d11 and place it in the c windows system32 folder Once accomplished it will be required to place the RxTxcomm jar file and add it to the Netbeans or the Java development environment of the user s choice compile and runtime libraries This added library is required to correctly compile and deploy a Java application that utilizes the serial port on the user s computing device May the user tak
27. olves program the RidgeSoft IntelliBrain small wheeled robot All of the pictures below are taken from the Ridgesoft website reference 1 11 Figure 1 The IntelliBrain Robot For the robot that is presented in figure 1 They are shown in figure 2 Figure 2 The Parts Display Parts List 12 1 IntelliBrain robotics controller 1 LCD display module 2 infrared photoreflector sensors 1 battery holder 1 metal chassis 2 continuous rotation servos 2 large vvheels 4 rubber band tires 1 ball tail wheel 1 13 32 grommet 4 1 standoffs 1 cotter pin 10 3 8 long 4 40 round head screws 2 3 8 long 4 40 flat head screws 4 1 4 short 4 40 round head screws 4 1 4 short 4 40 flat head screws 12 4 40 nuts 1 6 serial extension cable not shown 1 Software and documentation CDROM not shown In addition Figure 3 The Parts Table When purchased the robot comes assembled however for this project the robot was already assembled From simple observation it is easy to ascertain that most important parts of the robot would be the wheels chassis the LCD display and the circuit board that it comes on and the batteries A more detailed view of the controller s circuit board is presented in Figure 1 Figure 4 The IntelliBrain Handyboard 13 These are the robot s main components needed for basic assembly This is the first stage to prepare the robot for programming and making a remote interface v
28. ome of the error in ordering of the Bluetooth modules Rather than ordering straight through male to female converters null modem cables were ordered which basically means that the small converters were wired differently Therefore there was some intense time spent on reworking the Bluetooth modules themselves so that they would work with the null modem cables or converters correctly 20 The following is a paraphrased version of Tim Bennett s explanation on what was done with the soldering and wiring When the cable was spoofed going from the PC serial port to the Bluetooth on the PC side we made that cable a null modem cable as well by crossing pins 2 3 and 7 8 This allows a DTE device to connect to another DTE device When RS 232 pin signals are identified it is usually understood that the reference point is the PC However in RidgeSoft s case the manual and hence the robot was labeled with the robot as the reference point As connected in the manual the robot is a DTE device Utilizing the null modem cable the computer and the robot should be able to communicate as wired For both Bluetooth modules there was used an internal jumper configuration such that the module shorts pins 7 and 8 together and thus creating a constant loopback to the computer This takes care of the problem of the robot not using CTS RTS signals The cable that was spoofed connected pins 1 4 and 6 together in accordance with the image i
29. ples to create a program of their own Some of the programs created and listed in Appendix 1 through 3 Appendix 1 tells the robot to move in a square pattern Appendix 2 instructs the robot to move in a triangle pattern and in Appendix 3 the robot moves forward 24 Please note that what is in Appendixes 1 3 are just robot Java code examples of some of the software tests that I have run e Third part will be to make the robot play music this is where I went to Educators Music I am currently collaborating with the music instructor Jaxson Demer who is aiding me with taking music and putting it in terms the robot can understand I have currently been able to program the robot and get it to play a song that I was able to make it play I have gotten to play a song that sounds very close to the entertainer and here is some sample source code in Appendix 4 One specific example is to make the Halo theme song work with the robot s internal speaker This software is due to collaboration with Jaxson Dermer see Acknowledgements It should be noted that there isn t a whole a lot of firmware configuration involved So it isn t a big problem to successfully configure the Bluetooth modules using a null modem cable adapter and the USB device to configure it The GridConnect s program TeraTerm is helpful in this regard in figure 14 25 H Tera Term COM3 VT File Edit Setup Control Window Help SET COMMANDS gt gt gt
30. rns Testing Joystick Movement i Connect Disconnect Figure 15 The Robust GUI Tab 1 Connecting to the Robot Wirelessly 27 E Jess s Joystick Remote Control Robo Program Figure 16 The Robust GUI Tab 2 Tracking the Robot s Movement 28 Figure 17 The Robust GUI Tab 2 Tracking the Robot s Movement Active 29 E3 Jess s Joystick Remote Control Robo Program EN na Figure 18 The Robust GUI Tab 3 Robot Movement Patterns 30 FA Jess s Joystick Remote Control Robo Program ys g Robo Movement Tracker Robo Joystick button 4 Joystick button 5 Joystick button 7 Joystick button 8 Joystick button 9 Joystick button 6 Figure 19 The Robust GUI Tab 4 Joystick Test Not Active 3l FA Jess s Joystick Remote Control Robo Program I Establish Connection Robo Movement Tracker I Robo Movement Patterns Joystick button 4 Joystick button 6 Joystick button 8 Joystick button 9 Figure 20 The Robust GUI Tab 4 Joystick Test Active A brief overview of figures 15 20 is the four tabs of each GUI layout Figures 16 and 17 as well as 19 and 20 have two main states active and passive Active is when the user has clicked on the button on thus activating that panel to test the robot s movement or to test to see if the joystick is vvorking Figure 15 is the panel that activates the connection between the robot and the server figures 16 and 17 track the robo
31. synchronized from the results of this project Thus there should be no need to configure the Bluetooth module s hardware and firmware since this has already been achieved 1 First check the batteries on the robot to see if they are adequately charged If this is not the case the take the liberty to replace them 2 The requirements for this project will need the user to set the baud rate for the robot to 115200 This adjustment can be made on the robot s LED display This is not a definite requirement but the user will find that in deploying the software this will make the process run more smoothly The baud rate setting will require the user to configure the desired COM port on the user s computing device to 115200 as well 3 Assuming that the software is setup and the application on the computing device has compiled and is ready to synchronize with the robot software and the software for the robot has compiled and is ready to be deployed the next set of instructions apply The user should have acquired two different serial cables one cable that has been modified and one that is still on factory settings Please take the unmodified cable and connect it to the serial port on the user s computing device If the user s computing device does not possess a serial port then the user vvill need to acquire a USB to serial cable similar to the one in figure 5 The extra step of installing the required driver for the cable vvill also need
32. t s movements figure 18 allows for the robot to perform patterns of movement given the pattern on the button and figure 19 and 20 are the active and passive states for testing to see if the joystick is moving 32 As a courteously this application has an audible tutorial that simply explains what the program does This application allows the software to have a visual interaction with the joystick 4 Conclusion The end solution is to get the users application to work with the robot There were some problems discovered due to multi threading and when using the runnable statement This may lead to a problem with the data stream the data stream needs to be continuous even when the user is not moving the joystick The reason for this is that there is always a signal being sent to the robot from the Bluetooth device letting the Bluetooth module on the robot s side stay alive even when the user is not moving the robot In the previous project problem got resolved by using an infinite loop The problem with the runnable statement is that it only gets used when it is called Therefore the signal was intermittent and does not allow for continuous data flow between the Bluetooth modules This is the reason why the previous projects simple dataflow program worked and the new one didn t The reason why it was ideal to use the runnable statement was because it doesn t now continuously use up processor and memory and infinite loops easily do that
33. the gaming joystick 2 1 a Initial Setup 10 At the first glance the initial setup of this project should have been pretty straight forward it should have been just a matter of installing the software and correctly establishing the connection between the hardware and the software However this was not the case The RidgeSoft IntelliBrain RoboJDE reference 1 is designed for Windows XP and no higher version of Windows however if the server is running Vista we are going to have problems Thus the initial installation would not work and as it was later discovered Vista no longer recognizes COM ports correctly Also the code for having Java recognize COM ports and the Java libraries used in the previous project did not work One has to go to another source to get a java package that would work Trent Jarvi s website reference 8 and contains the code and the information on how to install gnu io package onto my laptop This enables direct access to the COM ports through Java This also helps with the joystick it s not sufficient just grab the previous projects code One has to get the source from the Internet and download the direct package off the Internet reference 7 It turns out that the joystick package proved to be much easier to acquire than getting the COM port code to work I have explained in further detail in the hardware section of this report section 2 1 b 2 1 b Robotic Basics Hardware This project inv
34. ts of this program to run 20 private void initComponents throws joystixMenuBar new JMenuBar mainMenu new JMenu helpMenu new JMenu exitApp new JMenuItem helpOnApp new JMenuItem jstixTabApp new JTabbedPane IOException roboPatnButton new JButton robopatniT length helpdis mageIcon getClass getResource helpBackground Jjpg new helpimg helpdis getImage patterns new Icon robopatnTT length informativeTxt new JLabel connectButton new JButton disconnectButton new JButton scrollAreaCon new JScrollPane txtAreaCon new JTextArea separateConnect new JSeparator getConnected new JPanel trackroboPanel new WatchRoboTracker joystixdis new JoyStixDisplayTest roboMovePatterns setDefaultCloseOperation WindowConstants EX new JPanel T ON CLOSE Code of sub components and layout not shown here jstixTabApp addTab Establish Connection getConnected getConnected setBackground Color RED getConnected setLayout null getConnec tiveTxt setFon tiveTxt se informa informa connection from to ted add informativeTxt the comput the robot tTex ter 203 informativeTxt setBounds 80 20 getConnected add separateConnect separateConnect setBounds 70 80 43 600
35. uttons 0 doClick 550 else displayTestButtons 0 setForeground Color BLACK if j isButtonDown j BUTTON5 displayTestButtons 1 setForeground Color RED displayTestButtons 1 doClick 550 else displayTestButtons 1 setForeground Color BLACK if j isButtonDown j BUTTON6 1 displayTestButtons 2 setForeground Color RED displayTestButtons 2 doClick 550 else displayTestButtons 2 setForeground Color BLACK if j isButtonDown j BUTTON7 displayTestButtons 3 setForeground Color RED displayTestButtons 3 doClick 550 else displayTestButtons 3 setForeground Color BLACK 39 if j isButtonDown j BUTTON8 displayTestButtons 4 setForeground Color RED displayTestButtons 4 doClick 550 else displayTestButtons 4 setForeground Color BLACK if j isButtonDown j BUTTON9 displayTestButtons 5 setForeground Color RED displayTestButtons 5 doClick 550 else displayTestButtons 5 setForeground Color BLACK public void joystickAxisChanged Joystick j j jjoystick if radioOn isSelected 1 jaxispan setColor Color RED Runnable updateJoyAxis new Runnable 1 public void run 1 jjoystick poll joyX int 70 3joystick getX joyY int 80 jjoystick getY jaxispan addToX joyX jaxispan addToY joyY jaxispan repaint
36. vith computer Next it is necessary to acquire a USB to serial converter that would allow to interact vvith the robots serial device located on the robots main board to upload the software to the robot Figure 4 Figure 5 The USB to Serial 2 3 Joystick In contrast to the previous project decided to use a more standard joystick available at retail store 14 Figure 6 The Logitech Joystick It is a Logitech Attack 3 joystick a USB device The software package downloaded off the Internet allows it to interact with any joystick acquired provided that the drivers are available for the com centralnexus input library to use A sample joystick code is presented in Appendix 5 It should be noted that for development the latest version of Netbeans reference 6 was used with Javajoystick reference 7 This package includes the Joystick jar file to have Netbeans interact with the joystick libraries It is also necessary to take the jjstick d11 and place it in the c windows system32 folder to get this to work correctly Once this step is completed one should be an application to have the joystick integrating with the computer 2 4 Bluetooth The Bluetooth device shown in Figure 6 15 Figure 7 The Bluetooth Serial Devices Master and Slave The exact name of the device is Bluetooth RS232 Serial Pair Firefly Pair and its function is to convert the RS232 signal to Bluetooth and vice versa
Download Pdf Manuals
Related Search
Related Contents
User Manual Manual de usuario D2 - Registradores de España Whirlpool RB770PXT User's Manual Manual de utilização - SMA Solar Technology AG Philips Bulb 929689873109 LBT-D890AV 2.4 GHz W ireless Exit Sign Camera Les maladies infectieuses Compaq iPAQ Pocket PC Bluetooth機能 LMD-1041 Copyright © All rights reserved.
Failed to retrieve file