11 nh_private_(nh_private),
27 ROS_INFO(
"Waiting for IK %d to be attached...", serial_num);
32 CPhidget_getErrorDescription(result, &err);
33 ROS_FATAL(
"Problem waiting for IK attachment: %s", err);
42 for (
int i = 0; i <
n_in; i++) {
43 char topicname[] =
"digital_input00";
44 snprintf(topicname,
sizeof(topicname),
"digital_input%02d", i);
47 for (
int i = 0; i <
n_out; i++) {
48 char topicname[] =
"digital_output00";
49 snprintf(topicname,
sizeof(topicname),
"digital_output%02d", i);
56 char topicname[] =
"analog_input00";
57 snprintf(topicname,
sizeof(topicname),
"analog_input%02d", i);
68 CPhidgetInterfaceKit_getSensorRawValue(
ik_handle_, index, &rawval);
69 std_msgs::Float32 msg;
70 msg.data =
VREF*float(rawval)/4095.0f;
79 msg.data = inputValue != 0;
86 phidgets_ik::SetDigitalOutput::Response &res)
88 ROS_INFO(
"Setting output %d to %d", req.index, req.state);
89 res.success = !CPhidgetInterfaceKit_setOutputState(
ik_handle_, req.index, req.state);
95 ROS_INFO(
"Setting output %d to %d", index, msg->data);
96 CPhidgetInterfaceKit_setOutputState(
ik_handle_, index, msg->data);
std::vector< ros::Publisher > sensor_pubs_
bool set_srv_callback(phidgets_ik::SetDigitalOutput::Request &req, phidgets_ik::SetDigitalOutput::Response &res)
IKRosI(ros::NodeHandle nh, ros::NodeHandle nh_private)
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
ServiceServer advertiseService(const std::string &service, bool(T::*srv_func)(MReq &, MRes &), T *obj)
int open(int serial_number)
OutputSetter(CPhidgetInterfaceKitHandle ik_handle, int index)
std::vector< ros::Publisher > in_pubs_
int waitForAttachment(int timeout)
std::vector< boost::shared_ptr< OutputSetter > > out_subs_
virtual void set_msg_callback(const std_msgs::Bool::ConstPtr &msg)
ros::ServiceServer out_srv_
void sensorHandler(int index, int sensorValue)
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
ros::NodeHandle nh_private_
void inputHandler(int index, int inputValue)
CPhidgetInterfaceKitHandle ik_handle_
bool getParam(const std::string &key, std::string &s) const
ROSCPP_DECL void shutdown()