1 #include <boost/thread.hpp> 8 #include <QSignalMapper> 11 #include "jog_msgs/JogFrame.h" 17 :
rviz::Panel(parent), jog_value_(0), ori_jog_value_(0)
34 QHBoxLayout* enable_layout =
new QHBoxLayout;
35 enable_layout->addWidget(
new QLabel(
"Jog Enable:" ), 1);
37 jog_button_->setStyleSheet(
"QPushButton:checked { background-color: red; }\n");
42 QHBoxLayout* group_layout =
new QHBoxLayout;
43 group_layout->addWidget(
new QLabel(
"Group:" ), 1);
48 QHBoxLayout* frame_layout =
new QHBoxLayout;
49 frame_layout->addWidget(
new QLabel(
"Frame:" ), 1);
53 QHBoxLayout* target_layout =
new QHBoxLayout;
54 target_layout->addWidget(
new QLabel(
"Target:" ), 1);
58 QHBoxLayout* axis_layout =
new QHBoxLayout;
59 axis_layout->addWidget(
new QLabel(
"Pos Axis:" ), 1);
63 QHBoxLayout* pos_jog_layout =
new QHBoxLayout;
64 pos_jog_layout->addWidget(
new QLabel(
"Pos Jog:" ), 1);
76 "border: 3px solid black;" 81 "background: rgb(164, 192, 2);" 84 "background: rgb(223, 70, 70);" 88 QHBoxLayout* pos_x_layout =
new QHBoxLayout;
89 pos_x_layout->addWidget(
new QLabel(
"Pos X:" ), 1);
93 QHBoxLayout* pos_y_layout =
new QHBoxLayout;
94 pos_y_layout->addWidget(
new QLabel(
"Pos Y:" ), 1);
98 QHBoxLayout* pos_z_layout =
new QHBoxLayout;
99 pos_z_layout->addWidget(
new QLabel(
"Pos Z:" ), 1);
103 QHBoxLayout* ori_axis_layout =
new QHBoxLayout;
104 ori_axis_layout->addWidget(
new QLabel(
"Rot Axis:" ), 1);
108 QHBoxLayout* ori_jog_layout =
new QHBoxLayout;
109 ori_jog_layout->addWidget(
new QLabel(
"Rot Jog:" ), 1);
121 "border: 3px solid black;" 125 "QSlider::sub-page {" 126 "background: rgb(164, 192, 2);" 128 "QSlider::add-page {" 129 "background: rgb(223, 70, 70);" 133 QHBoxLayout* rot_x_layout =
new QHBoxLayout;
134 rot_x_layout->addWidget(
new QLabel(
"Roll:" ), 1);
138 QHBoxLayout* rot_y_layout =
new QHBoxLayout;
139 rot_y_layout->addWidget(
new QLabel(
"Pitch:" ), 1);
143 QHBoxLayout* rot_z_layout =
new QHBoxLayout;
144 rot_z_layout->addWidget(
new QLabel(
"Yaw:" ), 1);
148 QVBoxLayout* layout =
new QVBoxLayout;
149 layout->addLayout(enable_layout);
150 layout->addLayout(group_layout);
151 layout->addLayout(frame_layout);
152 layout->addLayout(target_layout);
153 layout->addLayout(axis_layout);
154 layout->addLayout(pos_jog_layout);
155 layout->addLayout(ori_axis_layout);
156 layout->addLayout(ori_jog_layout);
157 layout->addLayout(pos_x_layout);
158 layout->addLayout(pos_y_layout);
159 layout->addLayout(pos_z_layout);
160 layout->addLayout(rot_x_layout);
161 layout->addLayout(rot_y_layout);
162 layout->addLayout(rot_z_layout);
178 QTimer* output_timer =
new QTimer(
this );
179 connect( output_timer, SIGNAL( timeout() ),
this, SLOT(
publish() ));
180 output_timer->start(100);
209 double roll, pitch, yaw;
210 m.
getRPY(roll, pitch, yaw);
221 const std::string& group = *it;
233 typedef std::vector<std::string>
V_string;
236 std::sort(frames.begin(), frames.end());
238 for (V_string::iterator it = frames.begin(); it != frames.end(); ++it )
240 const std::string& frame = *it;
265 boost::mutex::scoped_lock lock(
mutex_);
268 jog_msgs::JogFrame
msg;
271 msg.group_name =
group_cbox_->currentText().toStdString();
305 if (msg.linear_delta.x != 0 || msg.linear_delta.y != 0 || msg.linear_delta.z != 0 ||
306 msg.angular_delta.x != 0 || msg.angular_delta.y != 0 || msg.angular_delta.z != 0)
327 boost::mutex::scoped_lock lock(
mutex_);
334 boost::mutex::scoped_lock lock(
mutex_);
341 boost::mutex::scoped_lock lock(
mutex_);
348 boost::mutex::scoped_lock lock(
mutex_);
355 boost::mutex::scoped_lock lock(
mutex_);
366 boost::mutex::scoped_lock lock(
mutex_);
405 QLineEdit* label =
new QLineEdit;
406 label->setReadOnly(
true );
412 label->setText( QString::number( value,
'f', 4 ));
QComboBox * ori_axis_cbox_
void respondEnable(bool checked)
QSlider * ori_jog_slider_
void respondTargetLink(int index)
void respondFrame(int index)
void respondOrientationSliderReleased()
QComboBox * target_link_cbox_
VisualizationManager * vis_manager_
void publish(const boost::shared_ptr< M > &message) const
std::vector< std::string > link_names_
void respondSliderReleased()
tf::TransformListener * getTFClient() const
virtual void onInitialize()
std::string target_link_id_
PLUGINLIB_EXPORT_CLASS(test_moveit_controller_manager::TestMoveItControllerManager, moveit_controller_manager::MoveItControllerManager)
TFSIMD_FORCE_INLINE const tfScalar & x() const
void respondOrientationSliderChanged(int value)
std::vector< std::string > V_string
virtual void save(rviz::Config config) const
TFSIMD_FORCE_INLINE const tfScalar & z() const
void getRPY(tfScalar &roll, tfScalar &pitch, tfScalar &yaw, unsigned int solution_number=1) const
virtual void load(const rviz::Config &config)
std::vector< std::string > group_names_
TFSIMD_FORCE_INLINE const tfScalar & y() const
void fillNumericLabel(QLineEdit *label, double value)
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
QPushButton * jog_button_
JogFramePanel(QWidget *parent=0)
#define ROS_INFO_STREAM(args)
void respondAxis(int index)
ros::Publisher jog_frame_pub_
bool getParam(const std::string &key, std::string &s) const
void initOrientationAxisComboBox()
virtual void save(Config config) const
QLineEdit * makeNumericLabel()
virtual void load(const Config &config)
void respondSliderChanged(int value)
void respondOrientationAxis(int index)