20OCT06 - rather than starting a new thread for each piece of code I write on the same theme, I'll post it to my web page (created yesterday afternoon, forgive the lack of polish). I'll post a note here whenever I update the site with new examples.
The work presented here is written in C# and runs in the October CTP of MSRS. It features 16 of the robots used in the tracked vehicle simulation, driving in simple circles on either flat or rolling terrain (thanks to simulation tutorials 2 and 5).
No effort has been made to make the robots presentable in a rendered view- October CTP likes my graphics card even less than September CTP did, I can't see anything at all outside of physics view. Anyone who'd like to make it colorful, go ahead, and post some screenshots.
The main work here was to get accurate heading data - I've used a few quaternion conversion formulae and then manipulated the results a bit to give a compass heading for robots in the environment, and I'm logging this and a few other bits and pieces to a CSV file. In the attached zip file there's an excel spreadsheet, an example of what I do with this information. The code as written logs just one of the robots, but it would be an easy extension to output data in an organised fashion from all robots present.
The next version will simulate formation movement, the idea being that each robot, knowing its position, the position of the marker (that is, the robot to follow at an offset in x and z), and its own heading, can then make adjustments to the torque on each of its tracks in order to stay in formation. As can be seen, if all the robots are simply told, "drive with this motor torque on each side", they fall out of formation quite rapidly. With continuous updating of drive instructions, they should remain in the initial pattern.
To use this upload:
Unzip and copy the Teamwork directory into:
C:\Microsoft Robotics Studio (October 2006)\samples
Use the command line:
bin\dsshost /port:50000 /tcpport:50001 /manifest:"samples\Teamwork\Teamwork.manifest.xml"
Any usage issues / comments please post response.
Forum Read Only
This forum has been made read only by the site admins. No new threads or comments can be added.
nice work. but can u show us a demo using VB. I know u can do it
Sure, I'll learn and/or make a mess of *another* language....
The code presented here uses C# and is pretty scrappy- it falls into the category of "this works, but don't try to learn good coding practice from here". Reason being, I'm an engineer by inclination, not a programmer. My last formal instruction in coding was with C (not C+, C++ or C#, just C) about 5 years ago, for 12 weeks- since then, I've been using microcontrollers. Purely global variables, assembly instructions, mucking about with 1's and 0's. This business of scope, floating point numbers, 500K data files, gigahertz processing speeds and all the rest...
For the moment I'm using C# as a vehicle for working with MSRS. As soon as I shift from simulating back into the real world, where I've got to pay for the construction of and build the robots, it'll be back to PICs, and goodbye C#. Code functionality will be replicated minus windows related overhead.
Anyways, I'll put my soapbox away- next update to this code will come out in this thread at the end of the week, I got formation movement (including data sharing etc) working today.
New C# MSRS program examples posted to my web page,
They deal with formation movement, position update algorithms, data logging, and information sharing between robots (albeit in a less than ideal way).
I've only created the site in the last two days, some features may not be fully functional yet, but the downloads at least should work.
My next bit of software is posted, full details at the site below. A team of six robots share data and act semi-intelligently on it, allowing them to move to specified targets without crashing into each other. Source code is well commented, simple C#.
A separate GUI allows the user to give destination objectives to the robot team while the simulation is running, controlling where the team goes as a group. Source code, screenshot and video of operation are available for download from:
Any / all comments appreciated, please feel free to help yourself to the source, modify and re-post it. One note- I know the robots are not colored / rendered, my graphics card doesn't fully support the simulator.
New code example, screenshot and videos posted at:
It works with the October CTP, I'll update it if necessary to work with the hot-off-the-presses November CTP later this week.
On launch, the code starts up the simulation enviornment with six 4WD robots in it. A marker ball (zero-mass, floating) indicates which one is Robot Zero initially. A GUI, launched automatically on a separate thread, comes up, allowing control of the team and read-back of instantaneous robot data. The GUI permits:
--Group target changes (x,z co-ordinates of group objective)
--Formation changes (lines, geometric shapes, and 'attempt' crash)
--Stop override (switch individual robots off for a while)
--Marking track-ball re-allocation (mark any robot, or none)
--Display of current data of all robots at an instant
A couple of videos of the simulation running and a screen shot are posted, so the functionality can be seen without any MSRS CTP needed at all.
As always feel free to help yourselves to the source code, modify and re-post at will.