description {
 * @brief A robot that moves in 3-D

The position3d interface is used to control mobile robot bases in 3D
(i.e., pitch and roll are important).
}

/** Data subtype: state */
message { DATA, STATE, 1, player_position3d_data_t };
/** Data subtype: geometry */
message { DATA, GEOMETRY, 2, player_position3d_geom_t };

/** Command subtype: velocity control */
message { CMD, SET_VEL, 1, player_position3d_cmd_vel_t };
/** Command subtype: position control */
message { CMD, SET_POS, 2, player_position3d_cmd_pos_t };

/** Request/reply subtype: get geometry */
message { REQ, GET_GEOM, 1, player_position3d_geom_t };
/** Request/reply subtype: motor power */
message { REQ, MOTOR_POWER, 2, player_position3d_power_config_t };
/** Request/reply subtype: velocity mode */
message { REQ, VELOCITY_MODE, 3, player_position3d_velocity_mode_config_t };
/** Request/reply subtype: position mode */
message { REQ, POSITION_MODE, 4, player_position3d_position_mode_req_t };
/** Request/reply subtype: reset odometry */
message { REQ, RESET_ODOM, 5, NULL };
/** Request/reply subtype: set odometry */
message { REQ, SET_ODOM, 6, player_position3d_set_odom_req_t };
/** Request/reply subtype: set speed PID params */
message { REQ, SPEED_PID, 7, player_position3d_speed_pid_req_t };
/** Request/reply subtype: set position PID params */
message { REQ, POSITION_PID, 8, player_position3d_position_pid_req_t };
/** Request/reply subtype: set speed profile params */
message { REQ, SPEED_PROF, 9, player_position3d_speed_prof_req_t };

/** @brief Data: state (@ref PLAYER_POSITION3D_DATA_STATE)

This interface returns data regarding the odometric pose and velocity
of the robot, as well as motor stall information.  */
typedef struct player_position3d_data
{
  /** (x, y, z, roll, pitch, yaw) position [m, m, m, rad, rad, rad] */
  player_pose3d_t pos;
  /** (x, y, z, roll, pitch, yaw) velocity [m, m, m, rad, rad, rad] */
  player_pose3d_t vel;
  /** Are the motors stalled? */
  uint8_t stall;
} player_position3d_data_t;

/** @brief Command: position (@ref PLAYER_POSITION3D_CMD_SET_POS)

It accepts new positions and/or velocities for the robot's motors
(drivers may support position control, speed control, or both).  */
typedef struct player_position3d_cmd_pos
{
  /** (x, y, z, roll, pitch, yaw) position [m, m, m, rad, rad, rad] */
  player_pose3d_t pos;
  /** velocity at which to move to the position [m/s] or [rad/s] */
  player_pose3d_t vel;
  /** Motor state (FALSE is either off or locked, depending on the driver). */
  uint8_t state;
} player_position3d_cmd_pos_t;

/** @brief Command: velocity (@ref PLAYER_POSITION3D_CMD_SET_VEL)

It accepts new positions and/or velocities for the robot's motors
(drivers may support position control, speed control, or both).  */
typedef struct player_position3d_cmd_vel
{
  /** (x, y, z, roll, pitch, yaw) velocity [m, m, m, rad, rad, rad] */
  player_pose3d_t vel;
  /** Motor state (FALSE is either off or locked, depending on the driver). */
  uint8_t state;
} player_position3d_cmd_vel_t;

/** @brief Request/reply: Query geometry.

To request robot geometry, send a null @ref PLAYER_POSITION3D_GET_GEOM request. */
typedef struct player_position3d_geom
{
  /** Pose of the robot base, in the robot cs (m, m, m, rad, rad, rad).*/
  player_pose3d_t pose;
  /** Dimensions of the base (m, m, m). */
  player_bbox3d_t size;
} player_position3d_geom_t;

/** @brief Request/reply: Motor power.

On some robots, the motor power can be turned on and off from software.
To do so, send a @ref PLAYER_POSITION3D_REQ_MOTOR_POWER request with the format
given below, and with the appropriate @p state (zero for motors off
and non-zero for motors on).  Null response.

Be VERY careful with this command!  You are very likely to start the
robot running across the room at high speed with the battery charger
still attached.  */
typedef struct player_position3d_power_config
{
  /** FALSE for off, TRUE for on */
  uint8_t state;
} player_position3d_power_config_t;

/** @brief Request/reply: Change position control.

To change control mode, send a @ref PLAYER_POSITION3D_POSITION_MODE request.
Null response.
*/
typedef struct player_position3d_position_mode_req
{
  /** 0 for velocity mode, 1 for position mode */
  uint32_t value;
} player_position3d_position_mode_req_t;

/** @brief Request/reply: Change velocity control.

Some robots offer different velocity control modes.  It can be changed by
sending a @ref PLAYER_POSITION3D_VELOCITY_MODE request with the format given
below, including the appropriate mode.  No matter which mode is used, the
external client interface to the @p position3d device remains the same.
Null response. */
typedef struct player_position3d_velocity_mode_config
{
  /** driver-specific */
  uint32_t value;
} player_position3d_velocity_mode_config_t;

/** @brief Request/reply: Set odometry.

To set the robot's odometry to a particular state, send a
@ref PLAYER_POSITION3D_SET_ODOM request.  Null response. */
typedef struct player_position3d_set_odom_req
{
  /** (x, y, z, roll, pitch, yaw) position [m, m, m, rad, rad, rad] */
  player_pose3d_t pos;
} player_position3d_set_odom_req_t;

/** @brief Request/reply: Reset odometry.

To reset the robot's odometry to @f$(x,y,\theta) = (0,0,0)@f$,
send a @ref PLAYER_POSITION3D_RESET_ODOM request.  Null response. */

/** @brief Request/reply: Set velocity PID parameters.
 *
 * To set velocity PID parameters, send a @ref PLAYER_POSITION3D_SPEED_PID
 * request.  Null response. */
typedef struct player_position3d_speed_pid_req
{
  /** PID parameters */
  float kp;
  /** PID parameters */
  float ki;
  /** PID parameters */
  float kd;
} player_position3d_speed_pid_req_t;

/** @brief Request/reply: Set position PID parameters.
 *
 * To set position PID parameters, send a @ref PLAYER_POSITION3D_POSITION_PID
 * request.  Null response. */
typedef struct player_position3d_position_pid_req
{
  /** PID parameters */
  float kp;
  /** PID parameters */
  float ki;
  /** PID parameters */
  float kd;
} player_position3d_position_pid_req_t;

/** @brief Request/reply: Set speed profile parameters.
 *
 * To set speed profile parameters, send a @ref PLAYER_POSITION3D_SPEED_PROF
 * request.  Null response. */
typedef struct player_position3d_speed_prof_req
{
  /** max speed [rad/s] */
  float speed;
  /** max acceleration [rad/s^2] */
  float acc;
} player_position3d_speed_prof_req_t;

