package Ġcom . ac mer obot ics . road runner . trajectory . constraints Ċ Ċ import Ġcom . ac mer obot ics . road runner . Pose 2 d Ċ import Ġcom . ac mer obot ics . road runner . drive . M ec an um Kin em atics Ċ import Ġcom . ac mer obot ics . road runner . drive . Tank Kin em atics Ċ import Ġkotlin . math . abs Ċ import Ġkotlin . math . min Ċ Ċ /** Ċ Ġ* ĠM ec an um - specific Ġdrive Ġconstraints Ġthat Ġalso Ġlimit Ġmaximum Ġwheel Ġve locities . Ċ Ġ* Ċ Ġ* Ġ@ param Ġbase Constraints Ġbase Ġdrive Ġconstraints Ċ Ġ* Ġ@ param Ġtrack Width Ġtrack Ġwidth Ċ Ġ* Ġ@ param Ġwheel Base Ġwheel Ġbase Ċ Ġ*/ Ċ class ĠM ec an um Constraints Ġ@ Jvm Over loads Ġconstructor ( ĊĠĠĠĠĠĠĠ Ġbase Constraints : ĠDrive Constraints , ĊĠĠĠĠĠĠĠ Ġprivate Ġval Ġtrack Width : ĠDouble , ĊĠĠĠĠĠĠĠ Ġprivate Ġval Ġwheel Base : ĠDouble Ġ= Ġtrack Width Ċ ) Ġ: ĠDrive Constraints ( ĊĠĠĠĠĠĠĠ Ġbase Constraints . maximum Velocity , ĊĠĠĠĠĠĠĠ Ġbase Constraints . maximum Acceleration , ĊĠĠĠĠĠĠĠ Ġbase Constraints . maximum Angular Velocity , ĊĠĠĠĠĠĠĠ Ġbase Constraints . maximum Angular Acceleration Ċ ) Ġ{ ĊĠĠĠ Ġoverride Ġfun Ġmaximum Velocity ( pose : ĠP ose 2 d , Ġpose Deriv : ĠP ose 2 d , Ġpose Second Deriv : ĠP ose 2 d ): ĠDouble Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġrobot Position Deriv Ġ= Ġpose Deriv . pos (). rot ated (- pose . heading ) ĊĊĠĠĠĠĠĠĠ Ġval Ġwheel Ve locities Ġ= ĠM ec an um Kin em atics . robot To Wheel Ve locities ( Pose 2 d ( robot Position Deriv , Ġpose Deriv . heading ), Ġtrack Width , Ġwheel Base ) ĊĠĠĠĠĠĠĠ Ġval Ġmax Trajectory Velocity Ġ= Ġwheel Ve locities . map Ġ{ Ġmaximum Velocity Ġ/ Ġit Ġ}. map (:: abs ). min () Ġ?: Ġ 0 . 0 ĊĊĠĠĠĠĠĠĠ Ġreturn Ġmin ( super . maximum Velocity ( pose , Ġpose Deriv , Ġpose Second Deriv ), Ġmax Trajectory Velocity ) ĊĠĠĠ Ġ} Ċ Ċ }