locked
Need help with communacating with serial port RRS feed

  • Question

  • Hello,

    I’m in desperate need of some help with sending a command to my Roboteq ax2850 motor controller that is directly connected to and on board computer running windows 7. My group is working on our senior project and we are in our 3rd phase which is getting our robot to move on its own. The problem I’m having is that I want to send the command “! A1f” to a motor driver on com port 3 to spin the motor forward but when I try nothing happens (I don’t even get an error). I’ve read the service tutorial 1-6 and all of Trevor Taylor articles/post I could find on serial communication. I also purchased the programming Robotics Developer Studio and Professional Microsoft Robotics Developer Studio but there is still something I do not understand.

     

    In the “SerialPort.csproj” file I found from http://www.promrds.com/Downloads.htm I made the following alterations

     

    SerialPortTypes.cs

    I’ve added

    private string _motorCommand = "!a1f"
    
            [DataMember]
    
            public string MotorCommand
    
            {
    
                get { return _motorCommand; }
    
                set { _motorCommand = value; }
    
            }
    
    public class ControlMotor : Update<ControlMotorRequest, PortSet<DefaultUpdateResponseType, Fault>>
    
        {
    
            public ControlMotor()
    
                : base(new ControlMotorRequest())
    
            {
    
            }
    
        }
    
     
    
        [DataContract]
    
        public class ControlMotorRequest
    
        {
    
        }

    SerialPort.cs

    Add towards the end of file


    [ServiceHandler]
    
            public IEnumerator<ITask> controlMotorHandler(ControlMotor controlMotor)
    
            {
    
                // Only update the state here because this is an Exclusive handler
    
                _state.Equals("1A1f");
    
                LogInfo("command: " + _state);
    
                controlMotor.ResponsePort.Post(DefaultUpdateResponseType.Instance);
    
                yield break;
    
            }
     



    I don’t know if anything I’m saying is helpful in order for you to help me but and guidance would be greatly appreciate because I know once I can get the actuator service to communicate with the actual device I can build on it to obtain other desired results

    Thursday, March 15, 2012 2:22 AM

Answers

  • The latest (just released) version of RDS (RDS4) includes a new service for just this purpose.

    It is a generic Serial Communications service (SerialCOMService) and the code can be found in <install root>\samples\Platforms\ReferencePlatform2011.

    It is in that directory becuase it was created in support of the Reference Design, but it is not tied to any particular robot.

    To see how it used for one robot, you can download and install (to the root directory) the package from parallax (http://www.parallax.com/Portals/0/Downloads/docs/prod/robo/eddie/ParallaxKit.zip) and inspect the Parallax2011ReferencePlatformIoController service that partners with the SerialCOMService to issue commands.

    Gershon.

    Thursday, March 15, 2012 8:15 PM