#!/usr/bin/env python

PACKAGE = 'pibot_bringup'

from dynamic_reconfigure.parameter_generator_catkin import ParameterGenerator, str_t, double_t, bool_t, int_t

gen = ParameterGenerator()

model_type_enum = gen.enum([ gen.const("2WD_Diff", int_t, 1, "Two-wheel Diff Drive"),
                           gen.const("4WD_Diff",   int_t, 2, "Four-wheel Diff Drive"),
                           gen.const("3WD_Omni",  int_t, 101, "Three-wheel Omni Drvie"),
                        #    gen.const("4WD_Omni",  int_t, 102, "Four-wheel Omni Drvie"),
                           gen.const("4WD_Mecanum",  int_t, 201, "Four-wheel Mecanum Drvie"),
                           gen.const("UNKNOWN",  int_t, 255, "unknown model")],
                           "pibot dirver list")

gen.add("model_type", int_t, 0, "model type", 1, 1, 255, edit_method = model_type_enum)

gen.add("motor1_exchange_flag",   bool_t,   0, "exchange motor1 wire",  False)
gen.add("motor2_exchange_flag",   bool_t,   0, "exchange motor2 wire",  False)
gen.add("motor3_exchange_flag",   bool_t,   0, "exchange motor3 wire",  False)
gen.add("motor4_exchange_flag",   bool_t,   0, "exchange motor4 wire",  False)

gen.add("encoder1_exchange_flag",   bool_t,   0, "exchange encoder1 wire",  False)
gen.add("encoder2_exchange_flag",   bool_t,   0, "exchange encoder2 wire",  False)
gen.add("encoder3_exchange_flag",   bool_t,   0, "exchange encoder3 wire",  False)
gen.add("encoder4_exchange_flag",   bool_t,   0, "exchange encoder4 wire",  False)

gen.add("wheel_diameter", int_t, 0, "The diameter of the wheel", 30, 10, 500)
gen.add("wheel_track", int_t, 0, "The track of the wheel", 300, 50, 1000)
gen.add("encoder_resolution", int_t, 0, "The resolution of the encoder", 1560, 1 , 32000)
gen.add("motor_ratio", int_t, 0, "The ratio of the motor", 1, 1, 1000)

gen.add("do_pid_interval", int_t, 0, "The interval of do pid", 10, 1, 80)
gen.add("kp", int_t, 0, "Kp value", 20, 0, 10000)
gen.add("ki", int_t, 0, "Ki value", 20, 0, 32000)
gen.add("kd", int_t, 0, "Kd value", 20, 0, 1000)
gen.add("ko", int_t, 0, "Ko value", 20, 0, 1000)

gen.add("cmd_last_time", int_t, 0, "cmd_last_time value", 200, 0, 1000)

gen.add("max_v_liner_x", int_t, 0, "liner x", 60, 0, 500)
gen.add("max_v_liner_y", int_t, 0, "liner y", 0, 0, 500)
gen.add("max_v_angular_z", int_t, 0, "angular z", 120, 0, 2000)

imu_type_enum = gen.enum([ gen.const("GY65", int_t, 49, "mpu6050"),
                           gen.const("GY85",   int_t, 69, "adxl345_it43200_hmc5883l"),
                           gen.const("GY87",  int_t, 71, "mpu6050_hmc5883l"),
                           gen.const("nonimu",  int_t, 255, "disable imu")],
                           "imu type list")

gen.add("imu_type", int_t, 0, "imu type", 69, 1, 255, edit_method = imu_type_enum)

exit(gen.generate(PACKAGE, "pibot_bringup", "pibot_parameter"))
