Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: Fingers Program using C #‏ Microsoft robotics studio

  1. Fingers Program using C #‏ Microsoft robotics studio

    Hi Guys

    Currently i m doing a robotics fingers project needed to run 15 servo motor simultaneously. Which means 1 finger to 3 servo motors. Due to some situation instead of using Visual Show automation i needed to use C# to combine with another project but some how i m unable to run it simultaneously even by combining 2 mini ssc2 together to make it from 0-7, 8 -15 servo motors.

    I m able to run the motor 0 - 8 but unable to run 8 - 15. I have checked my connection everything seems right. When i deleted the 0 - 8 servo motor program part and run motors 8 - 15 part i m able to to run it. Could you kindly check my program and see what can be done thank you very much guys. I have enclose my program. My current program is program to open and close the fingers of the robot.
    Thanks
    Jeremy

    using Microsoft.Ccr.Core;
    using Microsoft.Dss.Core;
    using Microsoft.Dss.Core.Attributes;
    using Microsoft.Dss.ServiceModel.Dssp;
    using Microsoft.Dss.ServiceModel.DsspServiceBase;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Xml;
    using W3C.Soap;
    using i_limb = Robotics.I_Limb;
    using System.IO.Ports;

    namespace Robotics.I_Limb

    {

    /// <summary>
    /// Implementation class for I_Limb
    /// </summary>
    [DisplayName("I_Limb")]
    [Description("The I_Limb Service")]
    [Contract(Contract.Identifier)]
    public class I_LimbService : DsspServiceBase

    {
    //Initialize the port, setting port, baud rate....
    private SerialPort port = new SerialPort("COM1", 2400, Parity.None, 8, StopBits.One);


    private byte Sync = 0xFF; //Initialize the Sync

    private byte M0 = 0x00; //Initialize the Motor num
    private byte M1 = 0x01; //M0 equal to Motor 0
    private byte M2 = 0x02;
    private byte M3 = 0x03;
    private byte M4 = 0x04;
    private byte M5 = 0x05;
    private byte M6 = 0x06;
    private byte M7 = 0x07;
    private byte M8 = 0x08;
    private byte M9 = 0x09;
    private byte M10 = 0x0A;
    private byte M11 = 0x0B;
    private byte M12 = 0x0C;
    private byte M13 = 0x0D;
    private byte M14 = 0x0E;
    private byte M15 = 0x0F;


    /// <summary>
    /// _state
    /// </summary>
    private I_LimbState _state = new I_LimbState();

    /// <summary>
    /// _main Port
    /// </summary>
    [ServicePort("/i_limb", AllowMultipleInstances=false)]
    private I_LimbOperations _mainPort = new I_LimbOperations();

    /// <summary>
    /// Default Service Constructor
    /// </summary>
    public I_LimbService(DsspServiceCreationPort creationPort) :
    base(creationPort)
    {

    }

    /// <summary>
    /// Service Start
    /// </summary>
    protected override void Start()
    {
    base.Start();

    Console.Clear();

    port.Open();//Open the port, so that data can be written to port

    position_1();


    // Add service specific initialization here.
    }

    void position_1()
    {

    while (true)

    {

    Console.WriteLine("\nSending Data In Process");

    System.Threading.Thread.Sleep(1000);
    port.Write(new byte[] { Sync, M0, 0x00 }, 0, 3); //writing to the port(COM1), the sync, the servo num, and position
    port.Write(new byte[] { Sync, M1, 0x00 }, 0, 3);
    port.Write(new byte[] { Sync, M2, 0x00 }, 0, 3); //// OPEN FINGERS
    port.Write(new byte[] { Sync, M3, 0x00 }, 0, 3);
    port.Write(new byte[] { Sync, M4, 0x00 }, 0, 3);
    port.Write(new byte[] { Sync, M5, 0x00 }, 0, 3);
    port.Write(new byte[] { Sync, M6, 0x00 }, 0, 3);
    port.Write(new byte[] { Sync, M7, 0x00 }, 0, 3);
    port.Write(new byte[] { Sync, M8, 0x00 }, 0, 3);
    port.Write(new byte[] { Sync, M9, 0x00 }, 0, 3);
    port.Write(new byte[] { Sync, M10, 0x00 }, 0, 3); //// OPEN FINGERS
    port.Write(new byte[] { Sync, M11, 0x00 }, 0, 3);
    port.Write(new byte[] { Sync, M12, 0x00 }, 0, 3);
    port.Write(new byte[] { Sync, M13, 0x00 }, 0, 3);
    port.Write(new byte[] { Sync, M14, 0x00 }, 0, 3);
    port.Write(new byte[] { Sync, M15, 0x00 }, 0, 3);


    System.Threading.Thread.Sleep(2000);

    port.Write(new byte[] { Sync, M0, 0xFF }, 0, 3); //writing to the port(COM1), the sync, the servo num, and position
    port.Write(new byte[] { Sync, M1, 0xFF }, 0, 3);
    port.Write(new byte[] { Sync, M2, 0xFF }, 0, 3);
    port.Write(new byte[] { Sync, M3, 0xFF }, 0, 3);
    port.Write(new byte[] { Sync, M4, 0xFF }, 0, 3); // CLOSE FINGERS
    port.Write(new byte[] { Sync, M5, 0xFF }, 0, 3);
    port.Write(new byte[] { Sync, M6, 0xFF }, 0, 3);
    port.Write(new byte[] { Sync, M7, 0xFF }, 0, 3);
    port.Write(new byte[] { Sync, M8, 0xFF }, 0, 3);
    port.Write(new byte[] { Sync, M9, 0xFF }, 0, 3);
    port.Write(new byte[] { Sync, M10, 0xFF }, 0, 3);
    port.Write(new byte[] { Sync, M11, 0xFF }, 0, 3);
    port.Write(new byte[] { Sync, M12, 0xFF }, 0, 3); // CLOSE FINGERS
    port.Write(new byte[] { Sync, M13, 0xFF }, 0, 3);
    port.Write(new byte[] { Sync, M14, 0xFF }, 0, 3);
    port.Write(new byte[] { Sync, M15, 0xFF }, 0, 3);

    System.Threading.Thread.Sleep(2000);



    Console.Clear();

    System.Threading.Thread.Sleep(1000);//If too fast, set delay

    }
    }

    /// <summary>
    /// Get Handler
    /// </summary>
    /// <param name="get"></param>
    /// <returns></returns>
    [ServiceHandler(ServiceHandlerBehavior.Concurrent)]
    public virtual IEnumerator<ITask> GetHandler(Get get)
    {
    get.ResponsePort.Post(_state);
    yield break;
    }
    }
    }


  2. #2
    Join Date
    Apr 2008
    Location
    Sacramento, CA, USA Area
    Posts
    5,341
    Rep Power
    176

    Re: Fingers Program using C #‏ Microsoft robotics studio

    What serial ports are each of them on? Remember that some serial port interrupts are shared.
    I Void Warranties�

  3. Re: Fingers Program using C #‏ Microsoft robotics studio

    I only use Serial port com 1. Not too sure what u meant probably you would like to elaborate abit thanks

  4. #4
    Join Date
    Apr 2008
    Location
    Sacramento, CA, USA Area
    Posts
    5,341
    Rep Power
    176

    Re: Fingers Program using C #‏ Microsoft robotics studio

    Sorry - I'm just trying to understand better, and I've clearly missed something: You're combining two mini-SSC2 on one com port - I'm not familiar with the mini-SSC. I'd need to look 'em up. I've done a lot of work in C# with the SSC32 fullsize units - in fact, I posted some tutorial code on talking to the SSC32 from C# just a couple days ago.
    I Void Warranties�

  5. #5
    robot maker Guest

    Re: Fingers Program using C #‏ Microsoft robotics studio

    wthout looking at the data like most servo controllers you should be able to have them in a cascoding setup and use only one port and the way he said 0-7 and 8-15 and maybe is a switch on the board or jumper
    looking at the data you need to place a jumper on 8-15 ,serial address pins,might be why you are only getting 0-7 working only

    now in software i dont know if you need to add address,just start to learn programming
    adrenalynn is one of the best here for that

    Quote Originally Posted by Adrenalynn View Post
    Sorry - I'm just trying to understand better, and I've clearly missed something: You're combining two mini-SSC2 on one com port - I'm not familiar with the mini-SSC. I'd need to look 'em up. I've done a lot of work in C# with the SSC32 fullsize units - in fact, I posted some tutorial code on talking to the SSC32 from C# just a couple days ago.
    Last edited by robot maker; 09-03-2008 at 05:04 PM.

  6. Re: Fingers Program using C #‏ Microsoft robotics studio

    Yup i had put a jumper over to enable servo motor 0-15 to work but somehow the the hand goes haywire haha...still trying to figure out anyway thanks for the reply so far guys

  7. #7
    Join Date
    Apr 2008
    Location
    Sacramento, CA, USA Area
    Posts
    5,341
    Rep Power
    176

    Re: Fingers Program using C #‏ Microsoft robotics studio

    If it goes haywire first thing I'd ask is: Where is the power coming from? The onboard regulator can't handle that many simultaneous servos.
    I Void Warranties�

  8. Re: Fingers Program using C #‏ Microsoft robotics studio



    I at first use the batteries pack as i do not want to drain out those batteries i use a power supply at the left back to do my trouble shooting

  9. #9
    Join Date
    Apr 2008
    Location
    Sacramento, CA, USA Area
    Posts
    5,341
    Rep Power
    176

    Re: Fingers Program using C #‏ Microsoft robotics studio

    Neat Design!

    The power supply is set for regulated power unlimited current, right? (It looks like a 20A+, maybe 30A power supply from here, so if that's the case, I'm less worried about the power supply)
    I Void Warranties�

  10. #10
    Join Date
    Apr 2008
    Location
    Sacramento, CA, USA Area
    Posts
    5,341
    Rep Power
    176

    Re: Fingers Program using C #‏ Microsoft robotics studio

    Did you set the ID jumper on the second board? (reading the datasheet now)
    I Void Warranties�

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. MS Robotics Studio
    By asbrandsson in forum Software and Programming
    Replies: 39
    Last Post: 01-11-2009, 09:14 AM
  2. Question(s) Webots or Microsoft Robotic studio for Kondo bots???
    By rpedro in forum Software and Programming
    Replies: 2
    Last Post: 07-21-2008, 12:28 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •