54 wxBitmap* imageLeft =
new wxBitmap(wxImage(640, 480));
58 wxBitmap* imageRight =
new wxBitmap(wxImage(640, 480));
80 int panBase = 0, panSpeed = 0, panUpper = 0, panAccel = 0;
81 int tiltBase = 0, tiltSpeed = 0, tiltUpper = 0, tiltAccel = 0;
82 int panHold = 0, panMove = 0;
83 int tiltHold = 0, tiltMove = 0;
84 double panMin = 0, panMax = 0;
85 double tiltMin = 0, tiltMax = 0;
87 ptu.
getParam(
"asr_flir_ptu_driver/pan_min_angle", panMin);
88 ptu.
getParam(
"asr_flir_ptu_driver/pan_max_angle", panMax);
89 ptu.
getParam(
"asr_flir_ptu_driver/pan_base_speed", panBase);
90 ptu.
getParam(
"asr_flir_ptu_driver/pan_target_speed", panSpeed);
91 ptu.
getParam(
"asr_flir_ptu_driver/pan_upper_speed", panUpper);
92 ptu.
getParam(
"asr_flir_ptu_driver/pan_accel", panAccel);
93 ptu.
getParam(
"asr_flir_ptu_driver/pan_hold", panHold);
94 ptu.
getParam(
"asr_flir_ptu_driver/pan_move", panMove);
95 ptu.
getParam(
"asr_flir_ptu_driver/tilt_min_angle", tiltMin);
96 ptu.
getParam(
"asr_flir_ptu_driver/tilt_max_angle", tiltMax);
97 ptu.
getParam(
"asr_flir_ptu_driver/tilt_base_speed", tiltBase);
98 ptu.
getParam(
"asr_flir_ptu_driver/tilt_target_speed", tiltSpeed);
99 ptu.
getParam(
"asr_flir_ptu_driver/tilt_upper_speed", tiltUpper);
100 ptu.
getParam(
"asr_flir_ptu_driver/tilt_accel", tiltAccel);
101 ptu.
getParam(
"asr_flir_ptu_driver/tilt_hold", tiltHold);
102 ptu.
getParam(
"asr_flir_ptu_driver/tilt_move", tiltMove);
104 pan_min->SetValue((
int) panMin);
105 pan_max->SetValue((
int) panMax);
127 ros::master::V_TopicInfo::iterator it = topics.begin();
128 ros::master::V_TopicInfo::iterator end = topics.end();
132 for (; it != end; ++it) {
135 if (strcmp(ti.
datatype.c_str(),
"sensor_msgs/Image") == 0) {
139 }
else if (strcmp(ti.
datatype.c_str(),
"asr_flir_ptu_driver/State") == 0 &&
140 ti.
name.find(
"state") != std::string::npos) {
141 wxString entryName = wxString::FromUTF8(ti.
name.substr(0, ti.
name.find(
"state")).c_str());
147 for (
long int i = 0; i < topicCount; i++) {
154 for (
long int i = 0; i < topicCount; i++) {
170 std::string str = std::string(
leftImageTopic->GetStringSelection().mb_str());
176 std::string str = std::string(
rightImageTopic->GetStringSelection().mb_str());
181 std::string new_ptu_name = std::string(
ptuChoice->GetStringSelection().mb_str());
182 if (new_ptu_name.size() == 0)
return;
240 std_srvs::Empty empty;
248 sensor_msgs::JointState joint_state;
249 asr_flir_ptu_driver::State msg;
251 asr_flir_ptu_driver::Predict end_point_prediction;
252 end_point_prediction.request.pan =
panSlider->GetValue();
253 end_point_prediction.request.tilt =
tiltSlider->GetValue();
255 joint_state =
createJointCommand(end_point_prediction.response.new_pan, end_point_prediction.response.new_tilt, 0, 0);
256 msg.no_check_forbidden_area =
true;
260 msg.no_check_forbidden_area =
false;
262 msg.state = joint_state;
282 asr_flir_ptu_driver::State msg;
283 msg.state = joint_state;
299 int sizeMod = msg->width / 640;
300 wxImage img(msg->width / sizeMod, msg->height / sizeMod);
301 int bpp = msg->step / msg->width;
303 for (
int i = 0; i < img.GetHeight(); i++) {
304 for (
int j = 0; j < img.GetWidth(); j++) {
306 msg->data[sizeMod * i * msg->width * bpp + sizeMod * bpp * j + 2],
307 msg->data[sizeMod * i * msg->width * bpp + sizeMod * bpp * j + 1],
308 msg->data[sizeMod * i * msg->width * bpp + sizeMod * bpp * j]);
312 wxBitmap* image =
new wxBitmap(img);
327 sensor_msgs::JointState joint_state;
329 joint_state.name.push_back(
"pan");
330 joint_state.position.push_back(pan);
331 joint_state.velocity.push_back(panSpeed);
332 joint_state.name.push_back(
"tilt");
333 joint_state.position.push_back(tilt);
334 joint_state.velocity.push_back(tiltSpeed);
void OnTiltSpinText(wxCommandEvent &event)
ServiceClient serviceClient(const std::string &service_name, bool persistent=false, const M_string &header_values=M_string())
wxImagePanel * rightPanel
ros::ServiceClient predict_client
ros::ServiceClient updater
void publish(const boost::shared_ptr< M > &message) const
void OnPanScroll(wxScrollEvent &event)
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
void onLeftImage(const sensor_msgs::Image::ConstPtr &msg)
bool call(MReq &req, MRes &res)
PTU_GUI(wxWindow *parent)
void OnPanSpinText(wxCommandEvent &event)
ROSCPP_DECL bool getTopics(V_TopicInfo &topics)
void OnTiltScroll(wxScrollEvent &event)
void OnListenChecked(wxCommandEvent &event)
void OnLeftTopicChoice(wxCommandEvent &event)
std::vector< TopicInfo > V_TopicInfo
#define DEFAULT_PREFFEREDRIGHT
ros::Subscriber jointStateSubscriber
void onRightImage(const sensor_msgs::Image::ConstPtr &msg)
void OnPanSpin(wxSpinEvent &event)
#define DEFAULT_PREFFEREDLEFT
ros::Subscriber rightImageSubscriber
ros::Subscriber leftImageSubscriber
void onStateCommand(const asr_flir_ptu_driver::State::ConstPtr &msg)
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
void setImage(wxBitmap *image)
wxBitmap * createBitmap(const sensor_msgs::Image::ConstPtr &msg)
void OnTiltSpin(wxSpinEvent &event)
sensor_msgs::JointState createJointCommand(double pan, double tilt, double panSpeed, double tiltSpeed)
void OnImmChecked(wxCommandEvent &event)
ros::Publisher jointStatePublisher
bool getParam(const std::string &key, std::string &s) const
void OnRightTopicChoice(wxCommandEvent &event)
wxComboBox * leftImageTopic
void OnPTUChoice(wxCommandEvent &event)
void OnDialogClose(wxCloseEvent &event)
void OnUpdateClicked(wxCommandEvent &event)
wxComboBox * rightImageTopic
void onUpdate(wxTimerEvent &evt)
ROSCPP_DECL void spinOnce()
void updateSlidersFromParamServer()
void setParam(const std::string &key, const XmlRpc::XmlRpcValue &v) const