I’ve explained here about creating Microsoft Robotics Service for LEGO NXT 2.0 and configuring its manifest. When I wanted to create my first robotics service, I had many difficulties and found very few resources over the internet for LEGO NXT 2.0 using Microsoft Robotics, so just thought of blogging about this.
Microsoft Robotics Studio – Click here to download. Click here to know more about the studio.
LEGO NXT 2.0
Microsoft Robotics Studio can be used as a stand-alone development environment or it can be used with any of the Visual Studio 2008 or 2010 Editions, including the Express Editions.
How to create DSS Service?
1. After Installing Microsoft Robotics Studio, open Visual Studio IDE (I’m using 2010).
2. Click File/New Project, you should be able to see Microsoft Robotics under C# like this -
3. Create the project under Microsoft Robotics Studio installation folder (it will be mostly in c:\user\username\microsoft robotics dev studio 2008 r3\), so that the common robotics dlls will be referenced properly.
4. Click OK and you will be allowed to enter your service name, namespace and other details. The most important thing is – you will be allowed to choose your partners from here -
5. Choose the partners one by one from the list and click “Add as partner”. Check the “Add notification port” checkbox and leave the Creation Policy as it is. Lego NXT Brick (v2) should be selected as one of the partners, and the other partners can be selected based on the sensors that you will be using. In case if you want to edit or delete any of the added partners, you can choose the partner from the partner dropdown and perform your actions. Once all the partners are selected, click OK.
6. You should be able to see the auto-generated code now. Build your solution.
How to create manifest using DSS Manifest Editor?
1. Open DSS Manifest Editor.
2. Choose your service from the left, drag and drop it on the editor. You should be able to see this -
3. Search for your partners on the left, drag and drop on “Use service’s partner definition (UseExistingOrCreate)” boxes appropriately.
4. As the sensors in turn use the nxtbrick as their partner, another set of “Use service’s partner definition (UseExistingOrCreate)” boxes will be created for the brick.
5. You need to select nxtbrick service again and drop it on the boxes. If you see a pop like the one below, choose the already created service and NOT “Add a new instance”.
6. To configure the service, click it and then press “Create Initial State” button on the properties window. For the NxtBrick, you need to set the serial port number used for bluetooth connection. For the sensors, you need to set the ports appropriately.
7. Replace this manifest with the manifest created by the service.
8. To start the service execute dsshost /port:50000 /manifest:"C:\Users\username\Microsoft Robotics Dev Studio 2008 R3\MyDemoService\MyDemoService.manifest.xml” in DSS Command Prompt.
9. You can also start the service from the DSS Control Panel. In order to view the control panel, start DSS Node and then go to http://localhost:50000 (default port is 50000, if you’ve changed it use it accordingly).
10. Switch ON your LEGO NXT 2.0 and then start the service. If everything is configured properly, you should be able to hear connecting sound from the NXT Brick.
This is it for now, in the next blog post, I’ll be explaining about adding handlers to the sensors and using the motors.
I have learned a lot on developing my website, about .NET, ASP.NET, Web Design, Servers, Database etc., it’s been a good platform to learn the new technologies and implement them. I have played and been playing many roles in its development, here are them:
Being a creative person, I’ve always liked web designing, graphics, animation etc. This pushed me to create my first version of my website (HTML based), spent a lot of time on it and at the same time learned (self-learned) a lot on designing, good and bad techniques :). When I started working closely with a designer in HHS, learned many good practices on HTML Designing from her. It eventually pushed me to redesign my website. Though I acquired decent designing skills, I didn’t spend much time on designing as I wanted it to be simple and neat. I just followed the good practices on designing, this made my site look consistent in most of the browsers, in different resolutions, colors, point sizes etc.
Before setting up my site I just had a minimal knowledge on networking - to just share folders, open firewall/router ports, setup static ip etc. But, after setting up my site or in the process of setting up my site I learned a lot about networking technologies/methodologies like Virtualization, Domain Controllers, Backup Strategies, Re-routing Network Traffic, Security, Access Control etc. Initially, I had my site hosted on Godaddy’s Servers, and later on built my own servers and deployed everything on my servers. It was definitely worth spending extra bucks in building my own server and taking business connection (as I my ISP blocked port 80 for residential connections). Its advantages – installed softwares as I wished, and upgraded them as and when updates were released, opened ports in the firewall, changed security settings as per my needs, and many more. My responsibilities as a network admin:-
1. Instead of buying a server machine, I just converted my desktop to a server by installing server 2003 r2, and added RAM (had 4 GB RAM, added another 4 GB) and hard drives (bought another hard drive for backup).
2. Thought Virtualization will serve me better in terms of security, availability, usage etc. So, I used VMWare Server to setup virtualized servers. Built a virtualized server in my main server machine (server 2003 r2), and another virtualized server in my personal computer (windows 7), thus got 3 servers (windows 2003 r2). Setup my server machine as the domain controller (just for reference, I’ll name it as “A”), the virtual machine in it as the web/ftp/file/shoutcast/sql servers (name - “B”), and the virtual machine in my PC as the backup server (or testing machine), clone of B (name - “C”). Just before major software updates or changes in the network settings or any other changes that was supposed to affect the web traffic in B, I rerouted my network traffic to C.
3. Synchronization Strategy – Synchronized servers B and C using SyncToy (for folders) and Backup/Restore feature in SQL Server (for database). I will explain this in detail in my next blog.
4. Backup Strategy – Scheduled nightly backup of windows folders, SQL server and few other settings, and monthly backup of virtual machines (manually copied virtual machine files) to a hard drive dedicated for backups.
5. At least at the time of writing this blog, I didn’t have anything to do with ASP.NET Sessions, so rerouting the web traffic was not a big deal – just opening and closing ports in my router took care of it. However, as I didn’t have a proper way to reroute my radio traffic, I just played some pre-recorded announcements saying “Server is going to be restarted, it will be back in X minutes” or “Server is unavailable due to maintenance, it will be back in few minutes (or hours)”
6. Domain Management – I added and modified @ and CNAME records, changed name servers etc.
Godaddy’s ASP.NET Hosting was good (not great though), but their Database Hosting was ridiculous. They had an ASP.NET based interface, just to execute db scripts… running DDL scripts was not a problem; however, executing DML or importing data was not easy. So, decided to host my SQL Server Database in a different place, and only when I found that Godaddy blocked remote SQL Server access. All these limitations and the price factor pushed me to setup my own database server. My responsibilities as a database administrator or developer:
1. I’ve never liked writing dynamic or inline queries in the frontend, so always followed stored procedure approach. Performed most of the database operations using stored procedures. Once I started using LINQtoSQL and Entity Framework, the usage of stored procedures got reduced, I used them only for complex operations.
2. Created database, user accounts, roles etc., mapped user accounts or roles to data objects appropriately.
3. Built backup (full and differential) and restore strategy, and scheduled sql server jobs to perform these operations appropriately.
4. Created and used SSIS for routine GeoIP to Location data imports from MaxMind.
I used my server “C” as a backup or a testing server. I always applied patches or installed/upgraded softwares here, and only after thorough testing, I performed the same operations in my server “B” (my main server).
Working as a Web Developer, I created many Web 2.0 websites at my work, and at one point I found Web Development to be interesting than Windows Development. At that point, I felt I should convert my HTML site to Web 2.0 using all the latest web technologies. With all the experiences that I gained on web development from my job, I developed my website, and based on the experiences that I gained from developing my website, I did many things at my office – my work and my website served each other well.
I developed the first .NET version of my site using VS 2005/.NET 2.0 Framework with SQL Server 2005. Later on, upgraded to .NET Framework 3.5/VS 2008, used LINQtoSQL and other new features in VS 2008. My current version (as of Aug 15 2010), uses .NET 4.0 and SQL Server 2008.
If you need any help on building your own server, feel free to contact me.
Link to my site – http://www.gokulnath.com
Thirukural, written by Thiruvalluvar, in the form of couplets that convey noble thoughts. It is considered to be a book of ethics for the ordinary man, the administrator, the king and the ascetic. It is universal in perspective, and hence called "Ulaga Podhu Marai" meaning the Common Knowledge for the world. It is as timely today as when it was written more than 2000 years ago. Click here to know more about this book.
It has been translated to 80 languages (including many Indian languages). However, as far as I know only few people from India, other than from Tamil Nadu (a southern state in India) have known about or read this book. It is one of the reasons, why I decided to add it to my site ... just an attempt to spread this book further, hope you will do the same.
I took most of the content from - Tamil.pdf (254.88 KB), English.pdf (351.65 KB) and TamilMeaning.pdf (972.86 KB). Thanks a lot to all those who have worked on these projects. A special thanks to B.Viswanathan, the creator of the software Azhagi, using which I generated reverse-transliterations. Thanks to Google for its Transliteration API. Last but not least, thanks to all others who have worked/are working/will be working on spreading this book.
1. Spent a lot of time in collecting and importing the content to my database than designing the pages; used all sort of scraping techniques (programmatic) to fetch the content from the pdfs listed above. So, I cannot assure you that all the kurals, meanings (Tamil & English) and the Transliterations are 100% correct. In case if anything is wrong with any of the content, please report to me by following the report link.
2. Searched many places in Chennai for Thirukural CD with files separated by kurals, didn’t get one! However, I got 3 CDs for each section and files separated by adhigarams (chapters).
3. Had a tough time adding adhigaram mp3s in un-downloadable format. Shoutcast’s streaming content was easier compared to httphandlers, flash playlist etc. However, Shoutcast generated playlist in .pls format, and it didn’t work in Windows Media Player. So, wrote separate code to generate windows media playlist file (.wpl). If you have any problems in listening, download the playlist files and then try to open it in any of the players installed in your system.
Here is the link - http://www.gokulnath.com/thirukurals
If audio is not working in your server, check whether Windows Audio service is started…
How to do:
1. On Windows Run (windows key + R key), type services.msc
2. Look for Windows Audio service and check whether it is started, if not, start it
If this doesn't resolve your problem, try updating your audio drivers.
If audio is not working only when remoting, try the following:
1. On Windows Run (windows key + R key), type gpedit.msc
2. Go to Local Computer Policy/Computer Configuration/Administrative Templates/Windows Components/Terminal Services/ClientServer redirection
3. Enable Allow audio redirection
and then do this too:
1. On Windows Run (windows key + R key), type tscc.msc
2. Open the Connections folder in the left sidebar
3. Right-click RDP-Tcp, select Properties
4. Click Client Settings tab
5. UNCHECK the "Audio mapping" checkbox under the section "Disable the following:"
7. Click OK, and close tscc
8. You may see a warning which says this change will not take effect for any currently-connected RDP sessions. Click out of that
If you are remoting from a Windows XP machine, try to remote into the console by typing "mstsc /console" on run window.
If you are remoting from a Windows 7 or a Vista machine, try to remote into the console by typing "mstsc /admin" on run window.
After upgrading my PC from Windows XP to Windows 7, an external hard drive which was working fine on XP lost write permissions.
Found a solution:
1. Right click on the drive icon for the external drive.
2. Select Properties
3. Click Security Tab
4. Click Advanced Button
5. Click Owner Tab
6. Click Edit Button
7. Choose your account or administrators group, whichever you want to give permissions
8. Check 'Replace owner on subcontainers and objects'
9. Click OK
If this doesn’t resolve your problem, choose the user from “Group or user names” list, click “Edit”, and give appropriate permissions.
Hope this works for you!
Recently, when I tried to copy a large file (around 1 GB) to Virtual Machine (VM) from the host machine, it froze either of the machines. However, when I tried to copy a large file from the VM to the host machine, everything was normal.
Found a solution for this problem:
your Virtual Hard Disk's space upfront.
Unfortunately, I didn't find a way to modify my existing virtual hard disk, so I added a new virtual drive and pre-allocated its space, and it resolved the file transfer problem.
If you are setting up a FTP Server in a Domain, this article should help you. I have just taken info from various sites and had consolidated into one.
Installation - Click here to view the entire article
- Click Start, point to Control Panel, and then click Add or Remove Programs.
- Click Add/Remove Windows Components.
- In the Components list, click Application Server, click Internet Information Services (IIS) (but do not select or clear the check box), and then click Details.
- Click to select the following check boxes (if they are not already selected):
File Transfer Protocol (FTP) Service
Internet Information Services Manager
- Click to select the check boxes next to any other IIS-related service or subcomponent that you want to install, and then click OK.
- Click Next.
- When you are prompted, insert the Windows Server 2003 CD-ROM into the computer's CD-ROM or DVD-ROM drive or provide a path to the location of the files, and then clickOK.
- Click Finish.
To Isolate the Users - Click here to view the entire article
- Start Internet Information Services Manager or open the IIS snap-in.
- Expand Server_name, where Server_name is the name of the server.
- Expand FTP Sites
- Right-click Default FTP Site, and then click Properties.
- Click the Security Accounts tab.
- Click to select the Allow Anonymous Connections check box (if it is not already selected), and then click to select the Allow only anonymous connections check box.
When you click to select the Allow only anonymous connections check box, you configure the FTP Service to allow only anonymous connections. Users cannot log on by using user names and passwords.
- Click the Home Directory tab.
- Click to select the Read and Log visits check boxes (if they are not already selected), and then click to clear the Write check box (if it is not already cleared).
- Click OK.
To create a new FTP site that isolates users
1. In IIS Manager, expand the local computer, right-click the FTP Sites folder, point to New, and click FTP Site.
2. Provide the required information in the FTP Site Description and IP Address and Port Settings dialog boxes, and click Next.
3. In the FTP User Isolation dialog box, click Isolate users, and click Next.
4. In the Path box, type or browse to the directory that contains, or will contain, the site content, and then click Next.
5. Select the check boxes for the FTP site access permissions you want to assign to your users, and then click Next.
6. Click Finish.
To create FTP root-point and user folders
If users of different domains log on with their explicit domain\username credentials, create a subdirectory for each domain (by using the name of the domain) under the FTP site root directory you specified when you creating the FTP site.
For Example -
Domain Name: Account
FTP root directory -> D:\MyFTP\
LocalUser locate at D:\MyFTP\Account
For individual domain user, you need to create folder in this format - Domain\username
Domain User: Nancy locate at D:\MyFTP\Account\Nancy
How To Configure PassivePortRange In IIS - Click here to view the entire article. Folders will be listed only if passiveportrange is configured.
a) To Enable Direct Metabase Edit
1. Open the IIS Microsoft Management Console (MMC).
2. Right-click on the Local Computer node.
3. Select Properties.
4. Make sure the Enable Direct Metabase Edit checkbox is checked.
b) Configure PassivePortRange via ADSUTIL script
1. Click Start, click Run, type cmd, and then click OK.
2. Type cd Inetpub\AdminScripts and then press ENTER.
3. Type the following command from a command prompt.
adsutil.vbs set /MSFTPSVC/PassivePortRange "5500-5700"
4. Restart the FTP service (Start->Run->services.msc, find FTP Publishing Service and Restart it).
Note: this is what I executed in my machine - cscript.exe adsutil.vbs set /MSFTPSVC/PassivePortRange "5500-5700"
You'll see the following output, when you configure via ADSUTIL script:
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
PassivePortRange : (STRING) "5500-5700"
Open Ports in Windows Firewall
Default FTP port is 21, add this TCP port in Windows Firewall Exception list.
To Open/Delete multiple ports
for /L %i in (5000,1,5200) do netsh firewall add portopening TCP %i "FTP %i"
delete opened ports
FOR /L %I IN (5000,1,5200) DO netsh firewall delete portopening TCP %I
FreeCommander is a windows file manager which comes with FTP Client, I have been using this for quite some time...I'm satisfied!
Presumption: You know the other users' passwords.
1. Open VSS Explorer
2. Choose File > Open SourceSafe Database
3. Change the Username (the user who has checked out the files)
4. Once you change the Username, "Open" button will be enabled
5. Click Open and enter the user's credentials
6. Now you should be able checkin the files
Sometimes I do my development stuff in my laptop and sometimes in my desktop, and I share code using VSS...this approach had helped me many times as I know both the systems' credentials. I don't have any idea how to do this without knowing the other users' credentials.
Here I'm going to use MaxMind's GeoIP flat file To create a new Integration Services package:
1. Choose Start > All Programs > Microsoft SQL Server 2005 > SQL Server Business Intelligence Development Studio.
2. On the File menu, choose New > Project to create a new Integration Services project.
3. In the New Project dialog box, select Integration Services Project.
4. In the Name box, change the default name to Importing Flat Text File.
5. Click OK.
An empty package called Package.dtsx will be created and added to your project, you can rename this package as you want. To add connections to the flat file and the database
1. Right-click anywhere in the Connection Managers area (bottom most window) and then click New Flat File Connection (for other type of connections like Excel, FTP etc., choose New Connection), it will open Flat File Conneciton Manager Editor.
2. On the Flat File Connection Manager Editor screen, enter connection manager name.
3. Click Browse.
4. In the Open dialog box, browse to the flat text file you intend to extract data from.
5. Set the fields according to your flat file. To preview the columns in the text file, click Columns tab. To rename the columns, click Advanced, and in the property pane change the "Name" property for each column.
6. To add connection to the database, right-click in the Connection Managers area and then click New OLE DB Connection.
7. On the Configure OLE DB Connection Manager screen, click New.
8. Choose your server (servers in your network will be listed) or enter IP.
9. Choose authentication type and the database.
10. Test the connection.
Your connection managers window will look something like this:To add a Data Flow task:
1. Click the Control Flow tab.
2. Add a Data Flow Task from the toolbox (under Control Flow Items section) to the design surface of the control flow tab. Rename it as you want.To add a Data Flow Source:
1. Click on the Data flow tab.
2. Add a Flat File Source from the toolbox (under Data Flow Sources section) to the design surface of the data flow tab. Rename it as you want.
3. Double-click the Flat File source to open the Flat File Source Editor box.
4. In the Flat file connection manager dropdown, select the created flat file connection.
5. You can rename the output columns if you want.To add a OLE DB destination:
1. Add a OLE DB Destination from the toolbox (under DataFlow Destinations).
2. Drag the green arrow from the Flat file source to the OLE DB Destination.
Your data flow design surface will look something like this:
3. Double click OLE DB Destination to open OLE DB Destination Editor.
4. Select the created OLE DB connnection for OLE DB connection manager (it will be automatically selected).
5. Click New to create a new table or choose already created table.
6. Here, I have already created a table, so I'm just going to map the input columns with the table's columns.
My table structure:
Mapping:To run this package:
1. Click on the Debug menu and click Start Debugging.
2. After the package has completed running, on the Debug menu click Stop Debugging.Additional work:
If you see above, all the columns in my flat file are enclosed within double quotes, to strip them or to format the data.To format the format columns in the flat file before importing:
1. Add a Derived Column from the toolbox (under Data Flow Transformations).
2. Connect Flat file source's output to Derived Column and Derived Column's output to OLE DB Destination.
3. Double click the Derived Column to open Derived Column Transformation Editor.
4. Expand Columns tree and drag the column to be formatted to Derived Column Name, and add you expression. Here, I'm removing double quotes.To truncate data in the existing table before importing:
1. Click Control Flow tab.
2. Add Execute SQL Task from the toolbox (under Control Flow Items) to the design surface of control flow tab.
3. Double click it to open Execute SQL Task Editor, click the SQLStatement section ellipsis and add your SQL statement i.e., "Delete From TableName"
4. You can add it before or after the data flow task.
5. Add the connections appropriately.
Start running and the colors will change automatically:
There might be better ways to accomplish this, if so, please let me know.