/// <summary> /// Add an Actuator associated with the subsystem and with call it by the given name. /// </summary> /// <param name="subsystem">The subsystem this component is part of.</param> /// <param name="name">The name of this component.</param> /// <param name="component">A LiveWindowSendable component that represents an actuator.</param> public static void AddActuator(string subsystem, string name, ILiveWindowSendable component) { if (!s_components.ContainsKey(component)) { s_components.Add(component, new LiveWindowComponent(subsystem, name, false)); } }
/// <summary> /// Add Sensor to LiveWindow. The components are shown with the type and /// channel like this: Gyro[1] for a gyro object connected to the first /// analog channel. /// </summary> /// <param name="moduleType">A string indicating the type if the module used in the naming (above)</param> /// <param name="channel">The channel number the device is connected to</param> /// <param name="component">A reference to the object being added</param> public static void AddSensor(string moduleType, int channel, ILiveWindowSendable component) { AddSensor("Ungrouped", moduleType + "[" + channel + "]", component); if (s_sensors.Contains(component)) { s_sensors.Remove(component); } s_sensors.Add(component); }
/// <summary> /// Add Actuator to LiveWindow. </summary><remarks>The components are shown with the module /// type, slot and channel like this: Servo[1,2] for a servo object connected /// to the first digital module and PWM port 2. /// </remarks> /// <param name="moduleType">A string that defines the module name in the label for the value</param> /// <param name="moduleNumber">The number of the particular module type</param> /// <param name="channel">The channel number the device is connected to (usually PWM)</param> /// <param name="component">A reference to the object being added</param> public static void AddActuator(string moduleType, int moduleNumber, int channel, ILiveWindowSendable component) { AddSensor("Ungrouped", moduleType + "[" + moduleNumber + "," + channel + "]", component); }
/// <summary> /// Add an Actuator associated with the subsystem and with call it by the given name. /// </summary> /// <param name="subsystem">The subsystem this component is part of.</param> /// <param name="name">The name of this component.</param> /// <param name="component">A LiveWindowSendable component that represents an actuator.</param> public static void AddActuator(string subsystem, string name, ILiveWindowSendable component) { try { s_components.Add(component, new LiveWindowComponent(subsystem, name, false)); } catch (ArgumentException) { //Component already exists. So we don't need to add it again. } }