1. Do not share user accounts! Any account that is shared by another person will be blocked and closed. This means: we will close not only the account that is shared, but also the main account of the user who uses another person's account. We have the ability to detect account sharing, so please do not try to cheat the system. This action will take place on 04/18/2023. Read all forum rules.
    Dismiss Notice
  2. For downloading SimTools plugins you need a Download Package. Get it with virtual coins that you receive for forum activity or Buy Download Package - We have a zero Spam tolerance so read our forum rules first.

    Buy Now a Download Plan!
  3. Do not try to cheat our system and do not post an unnecessary amount of useless posts only to earn credits here. We have a zero spam tolerance policy and this will cause a ban of your user account. Otherwise we wish you a pleasant stay here! Read the forum rules
  4. We have a few rules which you need to read and accept before posting anything here! Following these rules will keep the forum clean and your stay pleasant. Do not follow these rules can lead to permanent exclusion from this website: Read the forum rules.
    Are you a company? Read our company rules

6dof master software modification

Discussion in 'Miscellaneous' started by MSK, Mar 18, 2012.

  1. MSK

    MSK Member

    Joined:
    Oct 9, 2011
    Messages:
    41
    Balance:
    53Coins
    Ratings:
    +1 / 0 / -0
    Hello,

    I am using linear actuators (hydraulic) and building a Stewart Platform. You can view the progress by clicking here .

    Since X-Sim would not do the controlling directly, I was looking for some other plugin/software which can do the job. I am buying a program to do the job. However, I am more inclined towards using X-Sim. I found this software developed by ROBIN on this forum. Its called 6dofmaster.

    6dofmaster uses SD84 controller. The software allows you to chose a COM PORT out of a selection box. Let me provide screen shot for better understanding:

    [img600px]http://s7.postimage.org/n7fg2c5d7/6dofmaster.png[/img600px]

    [img600px]http://s15.postimage.org/7sefvjabf/6dofmaster3d.png[/img600px]


    I have tried to play around with the source code and tried to stop it from seeking SD84 and instead sending the data to my Arduino. However, after I compiled it and ran the new modified version, nothing happens. The software does not hang, but it does nothing at all.

    My plan for the modification of source :

    1. Stop the SD84 seeking tendency of the software.
    2. Change the COM PORT setting in the source to fit my Arduino.
    3. Change the kinematics in a way for the software to control my linear actuators.
    4. Alter the 3D simulation to fit with linear actuators.


    In Robin's thread titled 6dofmaster developing corner , Robin talks of a way to manipulate the source code to do this. However, I have tried and failed. I am a biginner or bellow biginner in such programming, I need some help. Is there anyone who can help with the modification in C++ ? :sos:

    Download 6dofmaster source code

    Download the code uploaded in my Arduni Mega



    Regards
    MSK
    • Informative Informative x 1
  2. MSK

    MSK Member

    Joined:
    Oct 9, 2011
    Messages:
    41
    Balance:
    53Coins
    Ratings:
    +1 / 0 / -0
    Hello friends,

    Here is some update on the software side of my project.

    My progress:

    1. Stop the SD84 seeking tendency of the software. (done) :D

    I followed Robin's method. this is how I did it:

    In the source of the software, I edited the 6dofdlg.cpp. This is the edit:


    Replace everything between these 2 comments in the code:

    // TODO: Add your control notification handler code here

    and

    /// End Dialog Events



    Replace whatever is between those 2 comments by :


    if (!HardwareRunning){
    ResetPosition(); //Initialize the 3D model to default position.
    SetDlgItemText(IDC_RUN_HARDWARE_BUTTON,Stop Hardware);
    }else{
    SetDlgItemText(IDC_RUN_HARDWARE_BUTTON,Run Hardware);
    }
    HardwareRunning = !HardwareRunning;
    }


    When you are done, this is what the code should look like:

    [img600px]http://s9.postimage.org/ev56fk21b/code_modification_to_disable_sd84.png[/img600px]

    Now simply build it, and go to your Debug folder to test the new software. It should connect with any hardware that you have connected to your computer in the specified COM PORT.


    Tasks remaining to do now

    2. Change the COM PORT setting in the source to tailor fit my Arduino. (Currently trying to make the software deliver the signals the way my arduino expects it)
    3. Change the kinematics in a way for the software to control my linear actuators.
    4. Alter the 3D simulation to fit with linear actuators.


    Are there no C++ guys who are free at the moment ? atleast to encourage me, as I am a biginner in these things. :)

    Feel free to ask question. I do not expect anyone to be more of a noob than me, but still... i like asking and answering both. :D

    Regards
    MSK
  3. MSK

    MSK Member

    Joined:
    Oct 9, 2011
    Messages:
    41
    Balance:
    53Coins
    Ratings:
    +1 / 0 / -0
    Hello all,

    I have configured the software to make it connect and send signals to my Arduino. I tested it, it works. The only problem is, its sending crazy signals, since its expecting SD84 hardware on the other end of the serial communication :p

    Here is the code I am trying to modify :

    [img600px]http://img19.imageshack.us/img19/3010/serialoutput.png[/img600px]

    The way I understood it is something like this:

    The software calculates values for 6 servos. And starting with i=0 (first servo) and going all the way upto i=5 , it runs this code 6 times to output an array of values. These values are written on the serial port. Now, my problem is that I am not using SD84, so have to modify the code above. From what I can already tell, if I am not wrong, I should not require the SET_SERVO,GET_SERVO commands.


    The paid software I used to test uses the following format as output and it WORKS !! :

    AB byte1 byte2 byte3 byte4 byte5 byte6 byte7 0x0D (CR)

    In X-sim comport set up, its relatively easier if not easy to make your software output in the above format. Thats because of the nice interface created by the developers. The 6dofmaster software allows you to chose a comport but to change any comport setting, one has to edit and tailor the code I gave above. I am having difficulty doing that. Is there anyone that can help me sort this out ?

    By the way, if its possible, have a look at my progress, the mechanical assembling is done. :)

    Regards
    MSK
  4. tronicgr

    tronicgr

    Balance:
    Coins
    Ratings:
    +0 / 0 / -0
    Try it like this:

    Code:
    //Here's where we output the servo poition to the serial port.
    void C6dofDlg::RunHardware(){
    	
    	DWORD n;
    	BYTE sbuf[100];
    	CString s;
    			sbuf[0] = 0x41;						// send AB indentification command
    			sbuf[1] = 0x42;
    			sbuf[2] = 0xFF;						// send Reserved Byte  command (FF = empty)
    			sbuf[3] = ScaleServoForOutput(0)&255;                // pos low byte
    			sbuf[4] = (ScaleServoForOutput(0)>>8)&255;            // pos high byte
    			sbuf[5] = ScaleServoForOutput(1)&255;                // pos low byte
    			sbuf[6] = (ScaleServoForOutput(1)>>8)&255;            // pos high byte
    			sbuf[7] = ScaleServoForOutput(2)&255;                // pos low byte
    			sbuf[8] = (ScaleServoForOutput(2)>>8)&255;	  	 	 // pos high byte
    			sbuf[9] = ScaleServoForOutput(3)&255;                // pos low byte
    			sbuf[10] = (ScaleServoForOutput(3)>>8)&255;	  	 	 // pos high byte
    			sbuf[11] = ScaleServoForOutput(4)&255;                // pos low byte
    			sbuf[12] = (ScaleServoForOutput(4)>>8)&255;	  	 	 // pos high byte
    			sbuf[13] = ScaleServoForOutput(5)&255;                // pos low byte
    			sbuf[14] = (ScaleServoForOutput(5)>>8)&255;	  	 	 // pos high byte
    			sbuf[15] = 0x0D;
    			WriteFile(hCom, &sbuf, 16, &n, NULL);
    		}
    		s.Format(Writing usb port every= %.1lfmS , (clock()-last_time)/CLOCKS_PER_SEC*1000);
    		SetDlgItemText( IDC_MSG, s );
    		last_time = clock();
    
    
    }
    In the Arduino side you should set it up so you can receive 16-bit values (WORD) for the bytes byte2 byte3 byte4 byte5 byte6 byte7 of the “AB byte1 byte2 byte3 byte4 byte5 byte6 byte7 0x0D (CR)

    Or scale the 16-bit values to 8-bit within C++ code...

    Code:
    //Here's where we output the servo poition to the serial port.
    void C6dofDlg::RunHardware(){
       
       DWORD n;
       BYTE sbuf[100];
       CString s;
             sbuf[0] = 0x41;                  // send AB indentification command
             sbuf[1] = 0x42;
             sbuf[2] = 0xFF;                  // send Reserved Byte  command (FF = empty)
             sbuf[3] = (ScaleServoForOutput(0)/8)&255;                // byte 2
             sbuf[4] = (ScaleServoForOutput(1)/8)&255;                // byte 3
             sbuf[5] = (ScaleServoForOutput(2)/8)&255;                // byte 4
             sbuf[6] = (ScaleServoForOutput(3)/8)&255;                // byte 5
             sbuf[7] = (ScaleServoForOutput(4)/8)&255;                // byte 6
             sbuf[8] = (ScaleServoForOutput(5)/8)&255;                // byte 7
             sbuf[9] = 0x0D;  
             WriteFile(hCom, &sbuf, 10, &n, NULL);
          }
          s.Format(Writing usb port every= %.1lfmS , (clock()-last_time)/CLOCKS_PER_SEC*1000);
          SetDlgItemText( IDC_MSG, s );
          last_time = clock();
    
    
    }
    This is according to the instructions that can be found here: http://buggies.builtforfun.co.uk/Sim/Ma ... ormats.php

    Don't forget to provide us with compiled program once you got it running so we can test it on our controllers as well!! :cheers:

    Thanos
  5. MSK

    MSK Member

    Joined:
    Oct 9, 2011
    Messages:
    41
    Balance:
    53Coins
    Ratings:
    +1 / 0 / -0
    Thanks for the help. I will be testing it today post about the results i get.

    And ofcourse if all goes well, will share it. If I get the right outputs I will then aim towards adjusting the software for liniar actuation.


    Regards,
    MSK
  6. MSK

    MSK Member

    Joined:
    Oct 9, 2011
    Messages:
    41
    Balance:
    53Coins
    Ratings:
    +1 / 0 / -0
    Hello,

    Did you forget the line: for (int i=0; i<6; i++) before the sbuf[0]..... ??? Or did you leave it out intentionally ? I did not leave that out.

    I tested it with my Arduino Uno and little platform made from little servos. It works. But on the 6DOFMASTER (my modification version), when I play with the slider for YAW, it does HEAVE in my platform, and when I play around with the HEAVE, it does a YAW movement.

    I connected it with X-Sim and X-Plane. The pitch works (best in the nose down position at the moment), the sway also works.. need more testing though. The problem is that all of a sudden my RX light turned off, and the LED labelled L is on on my arduino. Need to trouble shoot on that so that I can resume my testing.

    Its so much fun to see it moving. :D Can't wait till I modify it for the linear actuation. Thanks for your help :) My actual platform is almost ready, you can have a look at it by following the link in my signature.

    Regards
    MSK
  7. tronicgr

    tronicgr

    Balance:
    Coins
    Ratings:
    +0 / 0 / -0
    I left the for (int i=0; i<6; i++) out because its not needed for the code anymore. All it does is to change the pointer to the data of each axis. But I do that by directly assigning the number of the pointer value. Think of it...

    Then the two software does not have the same axis assignments. You should try to change the actuator numbering in the code to be the same as Ian's BFF driver assignments like below for example:

    Code:
    //Here's where we output the servo poition to the serial port.
    void C6dofDlg::RunHardware(){
       
       DWORD n;
       BYTE sbuf[100];
       CString s;
             sbuf[0] = 0x41;                  // send AB indentification command
             sbuf[1] = 0x42;
             sbuf[2] = 0xFF;                  // send Reserved Byte  command (FF = empty)
             sbuf[3] = (ScaleServoForOutput(0)/8)&255;                // byte 2
             sbuf[4] = (ScaleServoForOutput(1)/8)&255;                // byte 3
             sbuf[5] = (ScaleServoForOutput(4)/8)&255;                // byte 4
             sbuf[6] = (ScaleServoForOutput(3)/8)&255;                // byte 5
             sbuf[7] = (ScaleServoForOutput(2)/8)&255;                // byte 6
             sbuf[8] = (ScaleServoForOutput(5)/8)&255;                // byte 7
             sbuf[9] = 0x0D;  
             WriteFile(hCom, &sbuf, 10, &n, NULL);
          }
          s.Format(Writing usb port every= %.1lfmS , (clock()-last_time)/CLOCKS_PER_SEC*1000);
          SetDlgItemText( IDC_MSG, s );
          last_time = clock();
    
    
    }
    On the code above I swaped the assignments of byte 4 and byte 6 although I don't know if this will fix it, its just an example. You will find out the correct assignments by comparing BFF driver axis placement information and Robins software axis placement.

    In all cases its always good to keep the same format so your 6-dof platform will be able to be used by both software solutions! ;D

    Thanos
  8. MSK

    MSK Member

    Joined:
    Oct 9, 2011
    Messages:
    41
    Balance:
    53Coins
    Ratings:
    +1 / 0 / -0
    Hello Tronicgr,

    thanks for the suggestion. I tried it out. I made this video of test of X-plane with the new compilation of the software. Here is the video:

    http://www.youtube.com/watch?v=wN-8gb1udtw

    In the video I show you the source code editing as you suggested. Then I show the performance of X-plane with the software. When its connected to X-plane, it performs ok. The roll is roll, the yaw is yaw..etc... However, when I do it manually its different. When done manually, moving yaw slider moves my little platform UP-DOWN (heave), and moving Heave slider makes it yaw...lol. This is what happens:

    1. Yaw --> Heave
    2. Pitch--> Surge
    3. Roll --> Sway
    4. Surge --> Roll
    5. Sway --> Pitch
    6. Heave --> Yaw

    Surge and Sway are not identified correctly in the software. It understands surge as sway , and sway as surge :(


    Let me carry on tests.. let me know what you think.

    Thanks for helping me so much :D

    Regards
    MSK
  9. MSK

    MSK Member

    Joined:
    Oct 9, 2011
    Messages:
    41
    Balance:
    53Coins
    Ratings:
    +1 / 0 / -0
    Hello,

    Here is another video of me testing the little hardware without X-sim and X-plane. Directly using 6dofmaster. When I use the software ALONE, these wierd things happen. Need to carry out a full test, that is, X-sim+X-plane+6dofmaster+arduino+platform.


    http://www.youtube.com/watch?v=wgLdHunjUso

    Let me know what you guys think.


    Regards
    MSK
  10. tronicgr

    tronicgr

    Balance:
    Coins
    Ratings:
    +0 / 0 / -0

    The problem is that each software (Robin's VS Ian's) use different base numbering on the base. See each one and you will notice the difference:

    Robins axis detailPhoto.jpg

    Ians BFF 6DOF Actuators placement.jpg


    You could try shifting around the servo numbering as I think that's whats making the strange assignments happening

    Code:
    //Here's where we output the servo poition to the serial port.
    void C6dofDlg::RunHardware(){
       
       DWORD n;
       BYTE sbuf[100];
       CString s;
             sbuf[0] = 0x41;                  // send AB indentification command
             sbuf[1] = 0x42;
             sbuf[2] = 0xFF;                  // send Reserved Byte  command (FF = empty)
             sbuf[3] = (ScaleServoForOutput(5)/8)&255;                // byte 2
             sbuf[4] = (ScaleServoForOutput(0)/8)&255;                // byte 3
             sbuf[5] = (ScaleServoForOutput(1)/8)&255;                // byte 4
             sbuf[6] = (ScaleServoForOutput(2)/8)&255;                // byte 5
             sbuf[7] = (ScaleServoForOutput(3)/8)&255;                // byte 6
             sbuf[8] = (ScaleServoForOutput(4)/8)&255;                // byte 7
             sbuf[9] = 0x0D;  
             WriteFile(hCom, &sbuf, 10, &n, NULL);
          }
          s.Format(Writing usb port every= %.1lfmS , (clock()-last_time)/CLOCKS_PER_SEC*1000);
          SetDlgItemText( IDC_MSG, s );
          last_time = clock();
    
    
    }
    
    This should make it output to the correct direction now. Give it a try!

    Thanos
  11. MSK

    MSK Member

    Joined:
    Oct 9, 2011
    Messages:
    41
    Balance:
    53Coins
    Ratings:
    +1 / 0 / -0
    Hello tronicgr,


    I thought about that too. But did not think about doing it by code, but through wiring changes. Unfortunately, do not have the little platform with me now. I think I should have it with me today . As soon as I have the platform, will experiment with the alterations of outputs. In theory, mapping Ian's drawing on to Robin's one should make it atleast work better if not the way I want.

    Let me test it, then we will know the truth. :)

    Thanks for the help.


    Regards
    MSK
  12. MSK

    MSK Member

    Joined:
    Oct 9, 2011
    Messages:
    41
    Balance:
    53Coins
    Ratings:
    +1 / 0 / -0
    Hello,

    This is the most bizarre thing I have ever seen. I changed the output sequences to the following orders:

    5-0-1-2-3-4
    5-4-3-2-1-0
    4-5-0-1-2-3
    2-3-0-1-4-5

    I am kind of brute forcing , but still, no matter how I compile it, the end result is the same. When I connect the hardware to the software, yaw does heave and as I stated before, all of them does wrong motions but maintaining a sequence.

    When connected to X-plane, the yaw slider moves all the way to the left as default position. Roll, pitch are not very nicely demonstrated, but atleast doing certain maneuvers the software makes the platform do the roll, pitch. I guess that is a problem with the profile making in X-sim.

    I am totally baffled by what happens when we tweak the format of output. I even tried 0-0-0-0-0-0, the result was Heave , since all actuators were getting the exact same value. But how come the software makes the platform move the way it has been wrongly moving even after changing the code so much ?

    Regards
    MSK
  13. tronicgr

    tronicgr

    Balance:
    Coins
    Ratings:
    +0 / 0 / -0
    What you said that all you get from using 0-0-0-0-0-0 is heave made me thinking. I might be wrong but that should give you YAW... I suspect that half of the servo outputs values should be inverted.

    I would like to try for myself if its possible. I have some servos laying around and an Arduino Mega that I can use the same way you do. So if its ok, I would need some more information to test it on my side:

    1. What version of C++ you are using. (a link to the product page would help to locate it)
    2. The modified C++ code for arduino output.
    3. The arduino code with RC servo code you are using.
    4. And a photo of your model servo platform with what servo number is each one.

    As soon as you provide me these I could recreate the problem and fix it.

    Regards,
    Thanos
  14. MSK

    MSK Member

    Joined:
    Oct 9, 2011
    Messages:
    41
    Balance:
    53Coins
    Ratings:
    +1 / 0 / -0
    Hello tronicgr,

    O God !!! I think I get it... right now... the 6 servos are not in identical situations. Sending 255 to one of them may rotate it clockwise, but the one just beside it is not having the same orientation. So, for the 3 pairs of servos, the values need to be inverted. In theory, understood that. Let me try it on my platform. I am not totally sure if Robin actually did it somewhere in the code. I am only saying that because he used the exact same mechanism, didn't he ? Unless SD84 controller inverted the values for him.

    1. Microsoft Visual C++ 2010, it came with Visual Studio 2010.
    Link : http://www.microsoft.com/visualstudio/en-gb/try

    2. I am using the very code we are discussing here to output the values. I don't exactly understand what you asked for, are you asking for the code I put in my Arduino ? or the 6dofmaster one ?

    3. For Arduino's code :Check your inbox

    Using Futaba S3001 servos

    4. Photo of the platform :

    The forward face of the platform is marked with black marker, you should be able to see it.
    [img600px]http://img845.imageshack.us/img845/2784/servo.jpg[/img600px]

    And you must know the code for 6dofmaster, as you already are helping me understand it. Incase you dont have the source code, I am uploading the whole thing as a zip file, so that your version works with arduino too. Just dont release any of it yet. Here is the link for my source....hmm ... let me send it to you by PM. Check your inbox.


    In the debug folder, you will find my current version of the .exe file . I copied the entire debug folder and gave it to my buddy, he was able to use the software using that folder. I dont know if there will be any problem, but the above source file is my entire folder for the 6dofmaster modification.

    I think that should be enough. Let me know if you need more info.

    Regards

    MSK
  15. MSK

    MSK Member

    Joined:
    Oct 9, 2011
    Messages:
    41
    Balance:
    53Coins
    Ratings:
    +1 / 0 / -0
    Hello,

    I found this code already present in the source for inversion if I am not wrong:

    [img600px]http://img651.imageshack.us/img651/5066/inverto.png[/img600px]

    Let me play with it for a while

    Regards
    MSK
  16. tronicgr

    tronicgr

    Balance:
    Coins
    Ratings:
    +0 / 0 / -0

    Yeap, thats right...

    And as you can see it uses again a pointer to construct for the ODD numbered ones positive direction and for the EVEN ones negative direction... :highfive:

    I'll have more time tomorrow to code it right in case you don't come with the correction before me! :cheers:

    Regards,
    Thanos
  17. tronicgr

    tronicgr

    Balance:
    Coins
    Ratings:
    +0 / 0 / -0
    One more thing. On the Arduino code you are sending the servo position signals to a SPI device... From reading the code it looks that you are using a Digital Potentiometer device there. I assume that you use this to control the proportional valves for your big platform.

    How are you controlling the servos on the mini platform? Are you using a servo controller like pololu ssc03a or you have the servos directly connected on the arduino data ports??

    Regards,
    Thanos
  18. MSK

    MSK Member

    Joined:
    Oct 9, 2011
    Messages:
    41
    Balance:
    53Coins
    Ratings:
    +1 / 0 / -0
    Hello ,

    I fixed it :D YAY !!!!

    The problem was in the code of inversion.

    I simply changed the -1.0 to positive 1.0.

    MAGIC !!! It worked. Now trying to align the face of my platform with the face that the software understands to be. Simply by changing the serial output sequence.

    will test it with X-plane and let you know. If possible with video.

    Thanks for always helping me out...

    Regards,
  19. tronicgr

    tronicgr

    Balance:
    Coins
    Ratings:
    +0 / 0 / -0

    Very good!!! Bravo!! I'll waiting to see the results!!! And, why not, I'll try it myself too! Well done! :highfive:

    Regards,
    Thanos
  20. MSK

    MSK Member

    Joined:
    Oct 9, 2011
    Messages:
    41
    Balance:
    53Coins
    Ratings:
    +1 / 0 / -0
    dude..... it works toooooooo good with X-PLANE :D :D :D

    WOW !! Loving it... will upload videos later... need to work on other stuffs now..... I am sooooooooooo happy at the moment. Thanks for your help. I think I should play around with X-sim profiler to make things more realistic and better...as in washout and filtering spikes, etc. I hope you will be around. :D

    Regards
    MSK