void PWMCbTurn(const std_msgs::Int32& msg) { if (isMovingForward) { if (msg.data > 0) { thrusterEast(255 - msg.data, true); thrusterWest(255 - msg.data, false); } else { thrusterEast(255 + msg.data, false); thrusterWest(255 + msg.data, true); } } else { if (msg.data > 0) { thrusterNorthSway(255 - msg.data, false); thrusterSouthSway(255 - msg.data, true); } else { thrusterNorthSway(255 + msg.data, true); thrusterSouthSway(255 + msg.data, false); } } }
void PWMCbTurnSway(const std_msgs::Int32 &msg) { if (msg.data > 0) { thrusterEast(msg.data, true); thrusterWest(msg.data, false); } else { thrusterEast(msg.data, false); thrusterWest(msg.data, true); } }
void PWMCbForward(const std_msgs::Int32 &msg) { if (msg.data > 0) { thrusterEast(msg.data, true); thrusterWest(msg.data, true); } else { thrusterEast(msg.data, false); thrusterWest(msg.data, false); } isMovingForward = true; }