Use `static_cast<double>(cmd_speed)` here instead of C style casting. It is a good habit - it will pick up some errors in compile time that C style casting won't and implicitly has more meaning.