// Command the gripper to retrieve
int playerc_gripper_retrieve_cmd (playerc_gripper_t *device)
{
  player_null_t cmd;

  memset (&cmd, 0, sizeof (cmd));
  return playerc_client_write (device->info.client, &device->info, PLAYER_GRIPPER_CMD_RETRIEVE, &cmd, NULL);
}
Exemple #2
0
/** @brief Command to set recording state */
int playerc_audio_wav_stream_rec_cmd(playerc_audio_t *device, uint8_t state)
{
    player_bool_t cmd;
    cmd.state = state;
    return playerc_client_write(device->info.client, &device->info,
                                PLAYER_AUDIO_CMD_WAV_STREAM_REC,
                                &cmd, NULL);
}
Exemple #3
0
/** @brief Command to play prestored sample */
int playerc_audio_sample_play_cmd(playerc_audio_t *device, int index)
{
    player_audio_sample_item_t cmd;
    cmd.index = index;
    return playerc_client_write(device->info.client, &device->info,
                                PLAYER_AUDIO_CMD_SAMPLE_PLAY,
                                &cmd, NULL);
}
int playerc_lightsensor_set_int_cmd(playerc_lightsensor_t *device, int v) {
	player_lightsensor_int_t cmd;

	memset(&cmd, 0, sizeof(cmd));
	cmd.i = v;

	return playerc_client_write(device->info.client, &device->info,
			PLAYER_LIGHTSENSOR_REQ_SET_COLOR, &cmd, NULL );
}
Exemple #5
0
// Command the end effector to stop immediatly
int playerc_limb_stop_cmd(playerc_limb_t *device)
{
    player_null_t cmd;

    memset(&cmd, 0, sizeof(cmd));

    return playerc_client_write(device->info.client, &device->info,
                                PLAYER_LIMB_CMD_STOP,
                                &cmd, NULL);
}
// Command a joint (or, if joint is -1, the whole array) to go to its home position
int playerc_actarray_home_cmd(playerc_actarray_t *device, int joint)
{
  player_actarray_home_cmd_t cmd;

  memset(&cmd, 0, sizeof(cmd));
  cmd.joint = joint;

  return playerc_client_write(device->info.client, &device->info,
                              PLAYER_ACTARRAY_CMD_HOME,
                              &cmd, NULL);
}
// Starts a scan
int playerc_micronsonar_scan(playerc_micronsonar_t *device, double startAngle, double endAngle)
{
  player_micronsonar_cmd_scan_t cmd;
  
  memset(&cmd, 0, sizeof(cmd));
  cmd.startAngle = startAngle;
  cmd.endAngle = endAngle;
    
  return playerc_client_write(device->info.client, 
                  &device->info, PLAYER_MICRONSONAR_CMD_SCAN, &cmd, NULL);
}
/* Set the output for the micron sonar device. */
int playerc_micronsonar_say(playerc_micronsonar_t *device, char *str)
{
  player_micronsonar_cmd_say_t cmd;
  
  memset(&cmd, 0, sizeof(cmd));
  cmd.string = str;
  cmd.string_count = strlen(str) + 1; 
    
  return playerc_client_write(device->info.client, 
                  &device->info, PLAYER_MICRONSONAR_CMD_SAY, &cmd, NULL);
}
/** Turn the light on and off (may not be visible when on depending on the color).*/
int playerc_blinkenlight_enable( playerc_blinkenlight_t *device, 
				 uint32_t enable )
{     
  player_blinkenlight_cmd_power_t cmd;
  memset( &cmd, 0, sizeof(cmd));
  cmd.enable = enable;
  
  return playerc_client_write( device->info.client, 
			       &device->info,
			       PLAYER_BLINKENLIGHT_CMD_POWER,
			       &cmd, NULL);
}
Exemple #10
0
int playerc_planner_set_cmd_pose(playerc_planner_t *device, double gx, double gy,
                                  double ga)
{
  player_planner_cmd_t cmd;

  memset(&cmd, 0, sizeof(cmd));
  cmd.gx = htonl((int) (gx * 1000.0));
  cmd.gy = htonl((int) (gy * 1000.0));
  cmd.ga = htonl((int) (ga * 180.0 / M_PI));

  return playerc_client_write(device->info.client, &device->info, &cmd, sizeof(cmd));
}
// Command a joint in the array to move with a specified current
int playerc_actarray_current_cmd(playerc_actarray_t *device, int joint, float current)
{
  player_actarray_current_cmd_t cmd;

  memset(&cmd, 0, sizeof(cmd));
  cmd.joint = joint;
  cmd.current = current;

  return playerc_client_write(device->info.client, &device->info,
                              PLAYER_ACTARRAY_CMD_CURRENT,
                              &cmd, NULL);
}
// Command all joints in the array to move with a specified current
int playerc_actarray_multi_current_cmd(playerc_actarray_t *device, float *currents, int currents_count)
{
  player_actarray_multi_current_cmd_t cmd;

  memset(&cmd, 0, sizeof(cmd));
  cmd.currents = currents;
  cmd.currents_count = currents_count;

  return playerc_client_write(device->info.client, &device->info,
                              PLAYER_ACTARRAY_CMD_MULTI_CURRENT,
                              &cmd, NULL);
}
// Command a joint in the array to move at a specified speed
int playerc_actarray_speed_cmd(playerc_actarray_t *device, int joint, float speed)
{
  player_actarray_speed_cmd_t cmd;

  memset(&cmd, 0, sizeof(cmd));
  cmd.joint = joint;
  cmd.speed = speed;

  return playerc_client_write(device->info.client, &device->info,
                              PLAYER_ACTARRAY_CMD_SPEED,
                              &cmd, NULL);
}
// Command all joints in the array to move with a specified current
int playerc_actarray_multi_position_cmd(playerc_actarray_t *device, float *positions, int positions_count)
{
  player_actarray_multi_position_cmd_t cmd;

  memset(&cmd, 0, sizeof(cmd));
  cmd.positions=positions;
  cmd.positions_count = positions_count;

  return playerc_client_write(device->info.client, &device->info,
                              PLAYER_ACTARRAY_CMD_MULTI_POS,
                              &cmd, NULL);
}
// Command a joint in the array to move to a specified position
int playerc_actarray_position_cmd(playerc_actarray_t *device, int joint, float position)
{
  player_actarray_position_cmd_t cmd;

  memset(&cmd, 0, sizeof(cmd));
  cmd.joint = joint;
  cmd.position = position;

  return playerc_client_write(device->info.client, &device->info,
                              PLAYER_ACTARRAY_CMD_POS,
                              &cmd, NULL);
}
Exemple #16
0
// Set the target pose
int playerc_motor_set_cmd_pose(playerc_motor_t *device, double gt, int state)
{
  player_motor_cmd_t cmd;

  memset(&cmd, 0, sizeof(cmd));
  cmd.theta = htonl((int) (gt * 1000.0));
  cmd.state = state;
  cmd.type = 1;

  return playerc_client_write(device->info.client,
                  &device->info, &cmd, sizeof(cmd));
}
// Command all joints in the array to move with a specified current
int playerc_actarray_multi_speed_cmd(playerc_actarray_t *device, float *speeds, int speeds_count)
{
  player_actarray_multi_speed_cmd_t cmd;

  memset(&cmd, 0, sizeof(cmd));
  cmd.speeds = speeds;
  cmd.speeds_count = speeds_count;

  return playerc_client_write(device->info.client, &device->info,
                              PLAYER_ACTARRAY_CMD_MULTI_SPEED,
                              &cmd, NULL);
}
Exemple #18
0
/** @brief Command to play an audio block */
int playerc_audio_wav_play_cmd(playerc_audio_t *device, uint32_t data_count, uint8_t data[], uint32_t format)
{
    player_audio_wav_t wave_data;
    memset (&wave_data, 0, sizeof (player_audio_wav_t));
    wave_data.data_count = data_count;
    // Use passed in array, as it will be copied by pack function - saves us having to malloc and free ourselves
    wave_data.data = data;
    wave_data.format = format;

    return playerc_client_write(device->info.client, &device->info,
                                PLAYER_AUDIO_CMD_WAV_PLAY,
                                &wave_data, NULL);
}
Exemple #19
0
/** @brief Command to set a single mixer level */
int playerc_audio_mixer_channel_cmd(playerc_audio_t *device, uint32_t index, float amplitude, uint8_t active)
{
    player_audio_mixer_channel_list_t cmd;
    memset (&cmd, 0, sizeof (player_audio_mixer_channel_list_t));
    cmd.channels_count = 1;
    cmd.channels[0].amplitude = amplitude;
    cmd.channels[0].active.state = active;
    cmd.channels[0].index = index;

    return playerc_client_write(device->info.client, &device->info,
                                PLAYER_AUDIO_CMD_MIXER_CHANNEL,
                                &cmd, NULL);
}
Exemple #20
0
// Command the end effector to move to a specified position
int playerc_limb_setposition_cmd(playerc_limb_t *device, float pX, float pY, float pZ)
{
    player_limb_setposition_cmd_t cmd;

    memset(&cmd, 0, sizeof(cmd));
    cmd.position.px = pX;
    cmd.position.py = pY;
    cmd.position.pz = pZ;

    return playerc_client_write(device->info.client, &device->info,
                                PLAYER_LIMB_CMD_SETPOSITION,
                                &cmd, NULL);
}
Exemple #21
0
// Command the end effector to move along the provided vector from
int playerc_limb_vecmove_cmd(playerc_limb_t *device, float x, float y, float z, float length)
{
    player_limb_vecmove_cmd_t cmd;

    memset(&cmd, 0, sizeof(cmd));
    cmd.direction.px = x;
    cmd.direction.py = y;
    cmd.direction.pz = z;
    cmd.length = length;

    return playerc_client_write(device->info.client, &device->info,
                                PLAYER_LIMB_CMD_VECMOVE,
                                &cmd, NULL);
}
// Set the robot speed
int
playerc_position1d_set_cmd_vel(playerc_position1d_t *device,
                               double vel, int state)
{
  player_position1d_cmd_vel_t cmd;

  memset(&cmd, 0, sizeof(cmd));
  cmd.vel = vel;
  cmd.state = state;

  return playerc_client_write(device->info.client, &device->info,
                              PLAYER_POSITION1D_CMD_VEL,
                              &cmd, NULL);
}
Exemple #23
0
int
playerc_planner_set_cmd_pose(playerc_planner_t *device,
                             double gx, double gy, double ga)
{
    player_planner_cmd_t cmd;

    cmd.goal.px = gx;
    cmd.goal.py = gy;
    cmd.goal.pa = ga;

    return playerc_client_write(device->info.client, &device->info,
                                PLAYER_PLANNER_CMD_GOAL,
                                &cmd, NULL);
}
Exemple #24
0
// Set the target pose
int
playerc_motor_set_cmd_pose(playerc_motor_t *device,
                           double gt, int state)
{
  player_motor_cmd_t cmd;

  memset(&cmd, 0, sizeof(cmd));
  cmd.pos = gt;
  cmd.state = state;
  cmd.type = 1;

  return playerc_client_write(device->info.client, &device->info,
                              PLAYER_MOTOR_CMD_STATE,
                              &cmd, NULL);
}
/** Set the light flashing by specifying the period in seconds and the
    mark/space ratio (0.0 to 1.0) */
int playerc_blinkenlight_blink( playerc_blinkenlight_t *device, 
				uint32_t id,
				float period,
				float duty_cycle )
{     
  player_blinkenlight_cmd_flash_t cmd;
  memset( &cmd, 0, sizeof(cmd));  
  cmd.id = id;
  cmd.period = period;
  cmd.dutycycle = duty_cycle;
  
  return playerc_client_write( device->info.client, 
			       &device->info,
			       PLAYER_BLINKENLIGHT_CMD_FLASH,
			       &cmd, NULL);
}
Exemple #26
0
// Set the device state.
int
playerc_wsn_set_devstate(playerc_wsn_t *device, int node_id, int group_id,
                         int devnr, int state)
{
  player_wsn_cmd_t cmd;

  memset(&cmd, 0, sizeof(cmd));
  cmd.node_id  = node_id;
  cmd.group_id = group_id;
  cmd.device   = devnr;
  cmd.enable   = state;

  return playerc_client_write(device->info.client, &device->info,
                              PLAYER_WSN_CMD_DEVSTATE,
                              &cmd, NULL);
}
Exemple #27
0
/* Set the output for the aio device. */
int playerc_aio_set_output(playerc_aio_t *device,
                           uint8_t id,
                           float volt)
{
  player_aio_cmd_t cmd;

  memset(&cmd, 0, sizeof(cmd));

  cmd.id = id;
  cmd.voltage = volt;

  return playerc_client_write(device->info.client,
                              &device->info,
                              PLAYER_AIO_CMD_STATE,
                              &cmd,
                              NULL);
}
// Set the target pose (pos,vel)
int
playerc_position3d_set_pose_with_vel(playerc_position3d_t *device,
                                     player_pose3d_t pos,
                                     player_pose3d_t vel)
{
  player_position3d_cmd_pos_t cmd;

  memset(&cmd, 0, sizeof(cmd));

  cmd.pos = pos;
  cmd.vel = vel;

  return playerc_client_write(device->info.client,
                              &device->info,
                              PLAYER_POSITION3D_CMD_SET_POS,
                              &cmd,
                              NULL);
}
/** Set the light color. The light should probably also be enabled before you see it.*/
int playerc_blinkenlight_color( playerc_blinkenlight_t *device, 
				uint32_t id,
				uint8_t red,
				uint8_t green,
				uint8_t blue )
{     
  player_blinkenlight_cmd_color_t cmd;
  memset( &cmd, 0, sizeof(cmd));
  cmd.id = id;
  cmd.color.red = red;
  cmd.color.green = green;
  cmd.color.blue = blue;
  
  return playerc_client_write( device->info.client, 
			       &device->info,
			       PLAYER_BLINKENLIGHT_CMD_COLOR,
			       &cmd, NULL);
}
Exemple #30
0
// Command the end effector to move to a specified pose
int playerc_limb_setpose_cmd(playerc_limb_t *device, float pX, float pY, float pZ, float aX, float aY, float aZ, float oX, float oY, float oZ)
{
    player_limb_setpose_cmd_t cmd;

    memset(&cmd, 0, sizeof(cmd));
    cmd.position.px = pX;
    cmd.position.py = pY;
    cmd.position.pz = pZ;
    cmd.approach.px = aX;
    cmd.approach.py = aY;
    cmd.approach.pz = aZ;
    cmd.orientation.px = oX;
    cmd.orientation.py = oY;
    cmd.orientation.pz = oZ;

    return playerc_client_write(device->info.client, &device->info,
                                PLAYER_LIMB_CMD_SETPOSE,
                                &cmd, NULL);
}