diff --git a/dynamixel_driver/scripts/set_servo_config.py b/dynamixel_driver/scripts/set_servo_config.py index 04fbe03..6b8439b 100755 --- a/dynamixel_driver/scripts/set_servo_config.py +++ b/dynamixel_driver/scripts/set_servo_config.py @@ -72,6 +72,10 @@ help='set servo motor minimum voltage limit') parser.add_option('--max-voltage-limit', type='int', metavar='MAX_VOLTAGE', dest='max_voltage_limit', help='set servo motor maximum voltage limit') + parser.add_option('--multi-turn-offset', type='int', metavar='OFFSET', dest='multi_turn_offset', + help='set servo motor multi-turn offset') + parser.add_option('--resolution-divider', type='int', metavar='DIVIDER', dest='resolution_divider', + help='set servo motor resolution divider') (options, args) = parser.parse_args(sys.argv) print options @@ -139,6 +143,22 @@ print 'Setting maximum voltage limit to %d' % options.max_voltage_limit dxl_io.set_voltage_limit_max(motor_id, options.max_voltage_limit) + # check if multi-turn offset needs to be changed + if options.multi_turn_offset: + if options.multi_turn_offset < -24576 or options.multi_turn_offset > 24576: + print 'Requested multi-turn offset is out of valid range (-24576 - 24576)' + else: + print 'Setting multi-turn offset to %d' % options.multi_turn_offset + dxl_io.set_multi_turn_offset(motor_id, options.multi_turn_offset) + + # check if resolution divider needs to be changed + if options.resolution_divider: + if options.resolution_divider < 1 or options.resolution_divider > 4: + print 'Requested resolution divider is out of valid range (1 - 4)' + else: + print 'Setting resolution divider to %d' % options.resolution_divider + dxl_io.set_resolution_divider(motor_id, options.resolution_divider) + print 'done' else: print 'Unable to connect to Dynamixel motor with ID %d' % motor_id