コード例 #1
0
        /// <summary>
        /// Post Configure Sensor Connection with body and return the response port.
        /// </summary>
        public virtual PortSet <DefaultUpdateResponseType, Fault> ConnectToBrick(MotorState state)
        {
            ConnectToBrick op = new ConnectToBrick();

            op.Body      = new MotorConfig(state.MotorPort);
            op.Body.Name = state.Name;
            op.Body.PollingFrequencyMs = state.PollingFrequencyMs;

            this.PostUnknownType(op);
            return(op.ResponsePort);
        }
コード例 #2
0
        /// <summary>
        /// Clone the LEGO NXT Motor State
        /// </summary>
        /// <returns></returns>
        internal MotorState Clone()
        {
            MotorState clone = new MotorState();

            clone.Connected               = this.Connected;
            clone.CurrentEncoderDegrees   = this.CurrentEncoderDegrees;
            clone.CurrentEncoderTimeStamp = this.CurrentEncoderTimeStamp;
            clone.CurrentMotorRpm         = this.CurrentMotorRpm;
            clone.AvgEncoderPollingRateMs = this.AvgEncoderPollingRateMs;
            clone.CurrentPower            = this.CurrentPower;
            clone.PollingFrequencyMs      = this.PollingFrequencyMs;
            clone.MotorPort               = this.MotorPort;
            clone.Name = this.Name;
            clone.ResetableEncoderDegrees = this.ResetableEncoderDegrees;
            clone.ReversePolarity         = this.ReversePolarity;
            clone.TargetEncoderDegrees    = this.TargetEncoderDegrees;
            clone.TargetPower             = this.TargetPower;
            clone.TargetStopState         = this.TargetStopState;
            return(clone);
        }
コード例 #3
0
 /// <summary>
 /// LEGO NXT Motor Configuration.
 /// </summary>
 /// <param name="state"></param>
 public MotorConfig(MotorState state)
 {
     this.MotorPort          = state.MotorPort;
     this.Name               = state.Name;
     this.PollingFrequencyMs = state.PollingFrequencyMs;
 }
コード例 #4
0
 /// <summary>
 /// Configure Device Connection
 /// </summary>
 /// <param name="state"></param>
 public ConnectToBrick(MotorState state)
     : base(new MotorConfig(state))
 {
 }