#!/usr/bin/env python

PACKAGE='talon_controllers'

from dynamic_reconfigure.parameter_generator_catkin import *

gen = ParameterGenerator()
#       Name                               Type      Reconfiguration-level  Description  Default  Min  Max
gen.add("pid_config",                      int_t,    0,                     "",          0,       0,   1)
gen.add("p0",                              double_t, 0,                     "",          0,       0,   100)
gen.add("i0",                              double_t, 0,                     "",          0,       0,   100)
gen.add("d0",                              double_t, 0,                     "",          0,       0,   100)
gen.add("f0",                              double_t, 0,                     "",          0,       0,   100)
gen.add("izone0",                          double_t, 0,                     "",          0,       0,   100)
gen.add("allowable_closed_loop_error0",    double_t, 0,                     "",          0,       0,   100)
gen.add("max_integral_accumulator0",       double_t, 0,                     "",          0,       0,   100)
                                           
gen.add("p1",                              double_t, 0,                     "",          0,       0,   100)
gen.add("i1",                              double_t, 0,                     "",          0,       0,   100)
gen.add("d1",                              double_t, 0,                     "",          0,       0,   100)
gen.add("f1",                              double_t, 0,                     "",          0,       0,   100)
gen.add("izone1",                          double_t, 0,                     "",          0,       0,   100)
gen.add("allowable_closed_loop_error1",    double_t, 0,                     "",          0,       0,   100)
gen.add("max_integral_accumulator1",       double_t, 0,                     "",          0,       0,   100)
                                           
gen.add("invert_output",                   bool_t,   0,                     "",          False)
gen.add("sensor_phase",                    bool_t,   0,                     "",          False)
                                           
gen.add("ticks_per_rotation",	           int_t,    0,						"",			 4096,	  0,   64000)
                                           
gen.add("closed_loop_ramp",                double_t, 0,                     "",          0,       0,   100)
gen.add("open_loop_ramp",                  double_t, 0,                     "",          0,       0,   100)
gen.add("peak_output_forward",             double_t, 0,                     "",          0,       0,   100)
gen.add("peak_output_reverse",             double_t, 0,                     "",          0,       0,   100)
gen.add("nominal_output_forward",          double_t, 0,                     "",          0,       0,   100)
gen.add("nominal_output_reverse",          double_t, 0,                     "",          0,       0,   100)
gen.add("neutral_deadband",                double_t, 0,                     "",          0,       0,   100)

gen.add("voltage_compensation_saturation", double_t, 0,                     "",          0,       0,   100)
gen.add("voltage_measurement_filter",      int_t,    0,                     "",          0,       0,   100)
gen.add("voltage_compensation_enable",     bool_t,   0,                     "",          False)

gen.add("softlimit_forward_threshold",     double_t, 0,                     "",          0,       0,   100)
gen.add("softlimit_forward_enable",        bool_t,   0,                     "",          False)
gen.add("softlimit_reverse_threshold",     double_t, 0,                     "",          0,       0,   100)
gen.add("softlimit_reverse_enable",        bool_t,   0,                     "",          False)
gen.add("softlimits_override_enable",      bool_t,   0,                     "",          False)

gen.add("current_limit_peak_amps",         int_t,    0,                     "",          0,       0,   300)
gen.add("current_limit_peak_msec",         int_t,    0,                     "",          0,       0,   20000)
gen.add("current_limit_continuous_amps",   int_t,    0,                     "",          0,       0,   300)
gen.add("current_limit_enable",            bool_t,   0,                     "",          False)

gen.add("motion_cruise_velocity",          double_t, 0,                     "",          0,       0,   100)
gen.add("motion_acceleration",             double_t, 0,                     "",          0,       0,   100)
gen.add("motion_control_frame_period",     int_t,    0,                     "",          20,      0,   2000)
feedback_type_enum = gen.enum([ gen.const("Feedback_Uninitialized",	    int_t, 0,  ""),
								gen.const("QuadEncoder", 				int_t, 1,  ""),
								gen.const("Analog",						int_t, 2,  ""),
								gen.const("Tachometer",					int_t, 3,  ""),
								gen.const("PulseWidthEncodedPosition",	int_t, 4,  ""),
								gen.const("SensorSum",					int_t, 5,  ""),
								gen.const("SensorDifference",			int_t, 6,  ""),
								gen.const("Inertial",					int_t, 7,  ""),
								gen.const("RemoteSensor",				int_t, 8,  ""),
								gen.const("SoftwareEmulatedSensor",		int_t, 9,  ""),
								gen.const("CTRE_Magencoder_Absolute",	int_t, 4, ""),
								gen.const("CTRE_Magencoder_Relative",	int_t, 1, ""),
							], "")
gen.add("feedback_type", 		   int_t,    0,                     "",			0,		  0,   12, edit_method=feedback_type_enum)

neutral_mode_enum = gen.enum([ gen.const("NeutralMode_Uninitialized",int_t, 0,  ""),
								gen.const("EEPROM_Setting",   		 int_t, 1,  ""),
								gen.const("Coast", 					 int_t, 2,  ""),
								gen.const("Brake", 					 int_t, 3,  ""),
							], "")
gen.add("neutral_mode", 		   int_t,    0,                     "",			0,		  0,   4, edit_method=neutral_mode_enum)

limit_switch_source_enum = gen.enum([ gen.const("LimitSwitchSource_Uninitialized",int_t, 0,  ""),
								gen.const("FeedbackConnector",		 int_t, 1,  ""),
								gen.const("RemoteTalonSRX",          int_t, 2,  ""),
								gen.const("RemoteCANifier",    	     int_t, 3,  ""),
								gen.const("Deactivated",       	     int_t, 4,  ""),
							], "")
limit_switch_normal_enum = gen.enum([ gen.const("LimitSwitchNormal_Uninitialized",int_t, 0,  ""),
								gen.const("NormallyOpen",     		 int_t, 1,  ""),
								gen.const("NormallyClosed",          int_t, 2,  ""),
								gen.const("Disabled",          	     int_t, 3,  ""),
							], "")

gen.add("limit_switch_local_forward_source", int_t,    0,                     "",			0,		  0,   5, edit_method=limit_switch_source_enum)
gen.add("limit_switch_local_forward_normal", int_t,    0,                     "",			0,		  0,   4, edit_method=limit_switch_normal_enum)
gen.add("limit_switch_local_reverse_source", int_t,    0,                     "",			0,		  0,   5, edit_method=limit_switch_source_enum)
gen.add("limit_switch_local_reverse_normal", int_t,    0,                     "",			0,		  0,   4, edit_method=limit_switch_normal_enum)
exit(gen.generate(PACKAGE, "talon_reconfigure_node", "TalonConfig"))

