28 #include <sr_utilities/sr_math_utils.hpp> 32 #define TACTILE_DATA_LENGTH_BYTES TACTILE_DATA_LENGTH_BYTES_v1 37 template <
class StatusType,
class CommandType>
40 template <
class StatusType,
class CommandType>
43 template<
class StatusType,
class CommandType>
45 std::vector<generic_updater::UpdateConfig> update_configs_vector,
47 :
GenericTactiles<StatusType, CommandType>(nh, device_id, update_configs_vector, update_state)
49 init(update_configs_vector, update_state);
52 template<
class StatusType,
class CommandType>
54 std::vector<generic_updater::UpdateConfig> update_configs_vector,
57 :
GenericTactiles<StatusType, CommandType>(nh, device_id, update_configs_vector, update_state)
59 init(update_configs_vector, update_state);
60 for (
unsigned int i = 0; i < this->
nb_tactiles; i++)
62 BiotacData tmp_biotac(init_tactiles_vector->at(i));
69 template<
class StatusType,
class CommandType>
75 new std::vector<AllTactileData>(this->
nb_tactiles));
83 template<
class StatusType,
class CommandType>
86 int tactile_mask =
static_cast<int16u>(status_data->tactile_data_valid);
88 for (
unsigned int id_sensor = 0; id_sensor < this->
nb_tactiles; ++id_sensor)
95 this->
all_tactile_data->at(id_sensor).biotac.pac_buffer_.push_back(static_cast<int>(tactile_data->
Pac[0]));
96 this->
all_tactile_data->at(id_sensor).biotac.pac_buffer_.push_back(static_cast<int>(tactile_data->
Pac[1]));
99 switch (static_cast<int32u>(status_data->tactile_data_type))
103 ROS_WARN(
"received invalid tactile type");
209 this->
all_tactile_data->at(id_sensor).biotac.electrodes[9] =
static_cast<int>(
214 this->
all_tactile_data->at(id_sensor).biotac.electrodes[10] =
static_cast<int>(
227 this->
all_tactile_data->at(id_sensor).biotac.electrodes[11] =
static_cast<int>(
232 this->
all_tactile_data->at(id_sensor).biotac.electrodes[12] =
static_cast<int>(
245 this->
all_tactile_data->at(id_sensor).biotac.electrodes[13] =
static_cast<int>(
250 this->
all_tactile_data->at(id_sensor).biotac.electrodes[14] =
static_cast<int>(
263 this->
all_tactile_data->at(id_sensor).biotac.electrodes[15] =
static_cast<int>(
268 this->
all_tactile_data->at(id_sensor).biotac.electrodes[16] =
static_cast<int>(
281 this->
all_tactile_data->at(id_sensor).biotac.electrodes[17] =
static_cast<int>(
286 this->
all_tactile_data->at(id_sensor).biotac.electrodes[18] =
static_cast<int>(
299 this->
all_tactile_data->at(id_sensor).biotac.electrodes[19] =
static_cast<int>(
304 this->
all_tactile_data->at(id_sensor).biotac.electrodes[20] =
static_cast<int>(
312 this->
all_tactile_data->at(id_sensor).biotac.electrodes[21] =
static_cast<int>(
317 this->
all_tactile_data->at(id_sensor).biotac.electrodes[22] =
static_cast<int>(
325 this->
all_tactile_data->at(id_sensor).biotac.electrodes[23] =
static_cast<int>(
336 if (sr_math_utils::is_bit_mask_index_true(tactile_mask, id_sensor))
339 static_cast<unsigned int>(
static_cast<int16u>(status_data->tactile[id_sensor].word[0]));
344 if (sr_math_utils::is_bit_mask_index_true(tactile_mask, id_sensor))
352 if (sr_math_utils::is_bit_mask_index_true(tactile_mask, id_sensor))
360 if (sr_math_utils::is_bit_mask_index_true(tactile_mask, id_sensor))
362 this->
all_tactile_data->at(id_sensor).biotac.set_software_version(status_data->tactile[id_sensor].string);
367 if (sr_math_utils::is_bit_mask_index_true(tactile_mask, id_sensor))
382 if (this->
sensor_updater->initialization_configs_vector.size() == 0)
389 template<
class StatusType,
class CommandType>
395 template <
class StatusType,
class CommandType>
399 for (
unsigned int id_tact = 0; id_tact < this->
nb_tactiles; ++id_tact)
401 std::stringstream ss;
404 ss << prefix <<
"Tactile " << id_tact + 1;
406 d.name = ss.str().c_str();
412 d.
addf(
"Serial Number",
"%s", this->
all_tactile_data->at(id_tact).biotac.serial_number.c_str());
414 d.
addf(
"Software Version",
"%s", this->
all_tactile_data->at(id_tact).biotac.get_software_version().c_str());
421 template<
class StatusType,
class CommandType>
427 template <
class StatusType,
class CommandType>
435 if (this->
all_tactile_data->at(i).biotac.serial_number.find(
"BTSP") != std::string::npos ||
436 this->
all_tactile_data->at(i).biotac.serial_number.find(
"BTTB") != std::string::npos)
448 std::vector<generic_updater::UpdateConfig>::iterator it =
450 while (it != this->
sensor_updater->important_update_configs_vector.end())
452 if (it->what_to_update ==
data)
454 it = this->
sensor_updater->important_update_configs_vector.erase(it);
464 for (
unsigned int id_tact = 0; id_tact < this->
nb_tactiles; ++id_tact)
TACTILE_SENSOR_TYPE_BIOTAC_ELECTRODE_20
virtual void add_diagnostics(std::vector< diagnostic_msgs::DiagnosticStatus > &vec, diagnostic_updater::DiagnosticStatusWrapper &d)
TACTILE_SENSOR_TYPE_SOFTWARE_VERSION
void init(std::vector< generic_updater::UpdateConfig > update_configs_vector, operation_mode::device_update_state::DeviceUpdateState update_state)
TACTILE_SENSOR_TYPE_BIOTAC_ELECTRODE_4
static const size_t nb_electrodes_v1_
TACTILE_SENSOR_TYPE_BIOTAC_TDC
#define TACTILE_DATA_LENGTH_BYTES
void summary(unsigned char lvl, const std::string s)
TACTILE_SENSOR_TYPE_BIOTAC_ELECTRODE_22
TACTILE_SENSOR_TYPE_MANUFACTURER
TACTILE_SENSOR_TYPE_BIOTAC_ELECTRODE_18
TACTILE_SENSOR_TYPE_BIOTAC_PDC
static const unsigned int nb_tactiles
Number of tactile sensors (TODO: should probably be defined in the protocol)
TACTILE_SENSOR_TYPE_BIOTAC_ELECTRODE_10
void addf(const std::string &key, const char *format,...)
boost::shared_ptr< generic_updater::SensorUpdater< CommandType > > sensor_updater
virtual void update(StatusType *status_data)
TACTILE_SENSOR_TYPE_BIOTAC_ELECTRODE_8
TACTILE_SENSOR_TYPE_SERIAL_NUMBER
TACTILE_SENSOR_TYPE_BIOTAC_ELECTRODE_6
TACTILE_SENSOR_TYPE_BIOTAC_INVALID
void set_version_specific_details()
static const size_t nb_electrodes_v2_
Biotac(ros::NodeHandle nh, std::string device_id, std::vector< generic_updater::UpdateConfig > update_configs_vector, operation_mode::device_update_state::DeviceUpdateState update_state)
TACTILE_SENSOR_TYPE_PCB_VERSION
void process_received_data_type(int32u data)
TACTILE_SENSOR_TYPE_BIOTAC_ELECTRODE_14
TACTILE_SENSOR_TYPE_BIOTAC_ELECTRODE_24
TACTILE_SENSOR_TYPE_SAMPLE_FREQUENCY_HZ
virtual std::vector< AllTactileData > * get_tactile_data()
boost::shared_ptr< std::vector< AllTactileData > > all_tactile_data
std::string sanitise_string(const char *raw_string, const unsigned int str_size)
TACTILE_SENSOR_TYPE_BIOTAC_ELECTRODE_12
TACTILE_SENSOR_TYPE_BIOTAC_ELECTRODE_2
struct TACTILE_SENSOR_BIOTAC_DATA_CONTENTS::@5 data_valid
TACTILE_SENSOR_TYPE_BIOTAC_ELECTRODE_16