Custom MAV_CMD_DO waypoints/actions

Hello everybody,
I’m currently working on a rover with an arm which can either go left or right (controlled by ultrasonic sensors and ros). What i’m trying to achieve is to create a custom action/waypoint that once it reaches it will send the message. MAV_CMD_SET_ARM_DIRECTION, 0 for none, 1 for left, 2 for right, and am wondering how I can create this sort of functionality.

You need to add that message to the mavlink protocol, then recompile ardupilot, then add the message processing code to the GCS decode loop of ardupilot and recompile again