28 #include <sr_utilities/sr_math_utils.hpp> 37 #define TACTILE_DATA_LENGTH_BYTES TACTILE_DATA_LENGTH_BYTES_v1 41 template<
class StatusType,
class CommandType>
44 template<
class StatusType,
class CommandType>
45 GenericTactiles<StatusType,
47 std::vector<generic_updater::UpdateConfig> update_configs_vector,
66 GenericTactileData tmp_pst;
71 template<
class StatusType,
class CommandType>
74 int tactile_mask =
static_cast<int16u>(status_data->tactile_data_valid);
76 for (
unsigned int id_sensor = 0; id_sensor <
nb_tactiles; ++id_sensor)
78 ROS_DEBUG_STREAM(
" received: " << static_cast<int32u>(status_data->tactile_data_type));
80 switch (static_cast<int32u>(status_data->tactile_data_type))
84 if (sr_math_utils::is_bit_mask_index_true(tactile_mask, id_sensor))
89 static_cast<unsigned int>(
static_cast<int16u>(status_data->tactile[id_sensor].word[0]));
96 if (sr_math_utils::is_bit_mask_index_true(tactile_mask, id_sensor))
101 static_cast<unsigned int>(
static_cast<int16u>(status_data->tactile[id_sensor].word[0]));
108 if (sr_math_utils::is_bit_mask_index_true(tactile_mask, id_sensor))
118 if (sr_math_utils::is_bit_mask_index_true(tactile_mask, id_sensor))
127 if (sr_math_utils::is_bit_mask_index_true(tactile_mask, id_sensor))
131 tactiles_vector->at(id_sensor).set_software_version(status_data->tactile[id_sensor].string);
137 if (sr_math_utils::is_bit_mask_index_true(tactile_mask, id_sensor))
162 template<
class StatusType,
class CommandType>
166 for (i = 0; i <
sensor_updater->initialization_configs_vector.size(); i++)
168 if (
sensor_updater->initialization_configs_vector[i].what_to_update == data)
173 if (i < sensor_updater->initialization_configs_vector.size())
179 template<
class StatusType,
class CommandType>
185 template<
class StatusType,
class CommandType>
200 template<
class StatusType,
class CommandType>
202 std_srvs::Empty::Response &response)
209 template<
class StatusType,
class CommandType>
211 const unsigned int str_size)
213 std::string sanitised_string =
"";
214 for (
unsigned int i = 0; i < str_size; ++i)
216 char tmp =
static_cast<char>(raw_string[i]);
219 if (tmp >=
'\x20' && tmp <=
'\x7E')
221 sanitised_string +=
static_cast<char>(raw_string[i]);
225 sanitised_string +=
'?';
233 return sanitised_string;
236 template<
class StatusType,
class CommandType>
TACTILE_SENSOR_TYPE_SOFTWARE_VERSION
bool reset(std_srvs::Empty::Request &request, std_srvs::Empty::Response &response)
TACTILE_SENSOR_TYPE_MANUFACTURER
static const unsigned int nb_tactiles
Number of tactile sensors (TODO: should probably be defined in the protocol)
ServiceServer advertiseService(const std::string &service, bool(T::*srv_func)(MReq &, MRes &), T *obj)
virtual void update(StatusType *status_data)
boost::shared_ptr< generic_updater::SensorUpdater< CommandType > > sensor_updater
boost::shared_ptr< std::vector< GenericTactileData > > tactiles_vector
the vector containing the data for the tactiles.
TACTILE_SENSOR_TYPE_SERIAL_NUMBER
virtual std::vector< AllTactileData > * get_tactile_data()
TACTILE_SENSOR_TYPE_PCB_VERSION
#define ROS_DEBUG_STREAM(args)
void process_received_data_type(int32u data)
virtual void add_diagnostics(std::vector< diagnostic_msgs::DiagnosticStatus > &vec, diagnostic_updater::DiagnosticStatusWrapper &d)
TACTILE_SENSOR_TYPE_WHICH_SENSORS
TACTILE_SENSOR_TYPE_SAMPLE_FREQUENCY_HZ
#define ROS_INFO_STREAM(args)
#define TACTILE_DATA_LENGTH_BYTES
boost::shared_ptr< std::vector< AllTactileData > > all_tactile_data
std::string sanitise_string(const char *raw_string, const unsigned int str_size)
ros::ServiceServer reset_service_client_
ros::NodeHandle nodehandle_