BrianPeek.com

A Compendium of Random Uselessness
in Search

doubt

Last post Thu, Oct 25 2007 5:22 PM by Brian Peek. 25 replies.
Page 2 of 2 (26 items) < Previous 1 2
Sort Posts: Previous Next
  • Tue, Oct 16 2007 5:58 PM In reply to

    Re: doubt

    I've been told that there are new versions of the Phidgets library and MSRS services at www.phidgets.com .  Give it a try and see if that gets you past the errors you were seeing.

    As for a non-MSRS version, you would just need need to listen for the button click events and toggle the relays appropriately.  It's almost identical to the MSRS version but using the native Phidgets library, not the MSRS service. 

  • Fri, Oct 19 2007 1:50 PM In reply to

    Re: doubt

    the new version for phidget library is present at this location:

    http://www.phidgets.com/downloads.php?os_id=1

    i m unable to find the new version for MSRS Services... :( 

  • Fri, Oct 19 2007 3:20 PM In reply to

    Re: doubt

    I swear, the Phidgets people hate me.

    When I posted that msg, there was a MSRS 1.0 library.  If you click on "Microsoft Robotics Studio" in the left column on that page, you go here:

    http://www.phidgets.com/downloads.php?example_id=14

    ...which is now recompiled for MSRS v1.5.  I don't think this will work with v1.0, and I'm not sure the code from my article is compatible wtih v1.5.
     

  • Sat, Oct 20 2007 6:59 AM In reply to

    Re: doubt

    right u r....i did download the service for v1.5...but your code doesn't work with v1.5... :( i get the error "SetOutputRequestType doesnot exist in Phidgets.Robotics.Services.Proxy"
  • Tue, Oct 23 2007 2:08 AM In reply to

    Re: doubt

    Another person is reporting the same issues.  I will have to find some time to update the project to work against v1.5 of MSRS and this latest Phidgets library.  I'll post here and on the blog when I've done that.

    Thanks, and sorry for the confusion../ 

  • Wed, Oct 24 2007 2:26 AM In reply to

    Re: doubt

    thanx a lot...actually i wanted to gift tis to one of my frens(a small kid) for halloween...i guess i can't do so now...i m also trying...but witout using MSRS...using only .NET code...
  • Wed, Oct 24 2007 2:34 AM In reply to

    Re: doubt

    It's certainly doable from straight .NET, and likely a lot easier.  For the gamepad, take a look at XNA, which is what MSRS uses internally.  You can use the plain Phidgets library for the Phidget board.  For some code on that, take a look at my Animated Holiday Lights article...it talks directly to the Phidget Interface Kit to toggle outputs on and off.

    Links to the above at http://www.brianpeek.com/blogs/articles/1076.aspx
     

  • Wed, Oct 24 2007 11:57 AM In reply to

    Re: doubt

    hey

     thanx a lot for tat link...i was able to create sumthing similar...but it looks very simple when compared to yours...jus have a look at it...

    namespace try2
    {
        public partial class Form1 : Form
        {
            InterfaceKit ik = new InterfaceKit();
            public int i;
            const int WM_KEYDOWN = 0x100;
            public Form1()
            {
                InitializeComponent();
                Phidgets.Manager phidgetsManager = new Phidgets.Manager();
                phidgetsManager.Attach+=new AttachEventHandler(phidgetsManager_Attach);
                phidgetsManager.open();
                ik.open(i);
               
            }
            void phidgetsManager_Attach(object sender, AttachEventArgs e)
            {
                label1.Text=e.Device.Name + "-" + e.Device.SerialNumber;
                i= e.Device.SerialNumber;
            }

            private void btn_ForwardMouseDown(object sender, MouseEventArgs e)
            {
                ik.outputs[0] = true;
            }

            private void btn_ForwardMouseUp(object sender, MouseEventArgs e)
            {
               ik.outputs[0] = false;
            }

            private void btn_BackwardMouseDown(object sender, MouseEventArgs e)
            {
                ik.outputs[1] = true;
            }

            private void btn_BackwardMouseUp(object sender, MouseEventArgs e)
            {
                ik.outputs[1] = false;
            }

            protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
            {
                if (msg.Msg == WM_KEYDOWN)
                {
                    switch (keyData)
                    {
                        case Keys.Up:
                            ik.outputs[0] = true;
                            break;

                        case Keys.Down:
                            ik.outputs[1] = true;
                            break;

                        case Keys.Left:
                            ik.outputs[2] = true;
                            break;

                        case Keys.Right:
                            ik.outputs[3] = true;
                            break;
                    }
                    return true;
                }
                return false;
            }

            private void btn_LeftClick(object sender, EventArgs e)
            {
                if (ik.Attached)
                {
                    if (ik.outputs[2] == false)
                        ik.outputs[2] = true;
                    else
                        ik.outputs[2] = false;
                }
            }

            private void btn_RightClick(object sender, EventArgs e)
            {
                if (ik.Attached)
                {
                    if (ik.outputs[3] == false)
                        ik.outputs[3] = true;
                    else
                        ik.outputs[3] = false;
                }
            }

        }
    }

    i have not used mouse down and mouse up events for left and right button since my car involves turning with a forward or backward driving force...so once i toggle left/right button, i can either turn left or right after clicking on forward or reverse buttons as required....do you think i can improvise on tis...as in make it a bit more "less simpler"? i have also used keydown and keyup mapping idea from your project...however, i don't think hitting on left and forward(for example) simultaneously would move my car forward left...what should i do to implement this requirement?
     

  • Wed, Oct 24 2007 4:00 PM In reply to

    Re: doubt

    It is much simpler to do it in straight .NET without MSRS.  The article was intended to be an intro to MSRS, but in reality, MSRS is not the best approach for a project like this.

    Anyway, the arrow keys should work like you want them.  You will get separate keydown msgs for each arrow pressed.  So if you press Up and then Left, you'll wind up toggling both outputs on.  You'll need a KeyUp event as well to toggle the outputs back to false once you let go of a key (didn't see it above but you may already have it).

    Next to the gamepad, the arrow keys as implemented above (with the addition of KeyUp) is the easiest way to go about driving the car IMO. 

  • Thu, Oct 25 2007 11:46 AM In reply to

    Re: doubt

    yup...almost forgot..was wondering y the car was bumping into everythin...i have now added the KeyUp events as well...thanx a lot..plz do let me know when u have updated your project to run on MSRS 1.5...i m begining to learn MSRS 1.5...i will also try.. :)
  • Thu, Oct 25 2007 5:22 PM In reply to

    Re: doubt

    Glad you were able to make it work.  I'll post here and/or on the blog when I get things updated for MSRS 1.5.  Thanks!
Page 2 of 2 (26 items) < Previous 1 2
Copyright (C) 2008 Brian Peek
Powered by Community Server (Commercial Edition), by Telligent Systems