36 #define BOOST_PARAMETER_MAX_ARITY 7
39 #include <jsk_topic_tools/rosparam_utils.h>
45 DiagnosticNodelet::onInit();
47 pub_ = pnh_->advertise<std_msgs::Float32>(
"output", 1);
48 srv_ = boost::make_shared <dynamic_reconfigure::Server<Config> > (*pnh_);
49 pnh_->param(
"frame_id",
frame_id_, std::string(
"odom"));
50 pnh_->param(
"sensor_frame",
sensor_frame_, std::string(
"odom"));
52 std::vector<double> initial_pos;
53 std::vector<double> initial_rot;
54 if (!jsk_topic_tools::readVectorParameter(*pnh_,
"initial_pos", initial_pos)) {
55 initial_pos.push_back(0);
56 initial_pos.push_back(0);
57 initial_pos.push_back(0);
59 if (!jsk_topic_tools::readVectorParameter(*pnh_,
"initial_rot", initial_rot)) {
60 initial_rot.push_back(0);
61 initial_rot.push_back(0);
62 initial_rot.push_back(0);
70 typename dynamic_reconfigure::Server<Config>::CallbackType
f =
72 srv_->setCallback (
f);
100 const visualization_msgs::InteractiveMarkerFeedback::ConstPtr& feedback)
103 Eigen::Affine3f
pose;
109 const visualization_msgs::InteractiveMarkerFeedback::ConstPtr& feedback)
116 const sensor_msgs::PointCloud2::ConstPtr&
msg)
119 pcl::PointCloud<pcl::PointXYZ>::Ptr
cloud(
new pcl::PointCloud<pcl::PointXYZ>);
128 vertices.push_back(Eigen::Vector3f(
plane_pose_ * (Eigen::Vector3f::UnitX() + Eigen::Vector3f::UnitY())));
129 vertices.push_back(Eigen::Vector3f(
plane_pose_ * (- Eigen::Vector3f::UnitX() + Eigen::Vector3f::UnitY())));
130 vertices.push_back(Eigen::Vector3f(
plane_pose_ * (- Eigen::Vector3f::UnitX() - Eigen::Vector3f::UnitY())));
131 vertices.push_back(Eigen::Vector3f(
plane_pose_ * (Eigen::Vector3f::UnitX() - Eigen::Vector3f::UnitY())));
140 pcl::KdTreeFLANN<pcl::PointXYZ>
tree;
142 std::vector<float> polygon_likelihood(1, 1.0);
145 std_msgs::Float32 float_msg;
151 Config& config, uint32_t level)
165 visualization_msgs::InteractiveMarker
168 visualization_msgs::InteractiveMarker int_marker;
171 int_marker.name =
getName() +
"_plane";
172 visualization_msgs::InteractiveMarkerControl control;
173 control.orientation.w = 1;
174 control.orientation.x = 1;
175 control.orientation.y = 0;
176 control.orientation.z = 0;
177 control.interaction_mode = visualization_msgs::InteractiveMarkerControl::ROTATE_AXIS;
178 int_marker.controls.push_back(control);
179 control.interaction_mode = visualization_msgs::InteractiveMarkerControl::MOVE_AXIS;
180 int_marker.controls.push_back(control);
182 control.orientation.w = 1;
183 control.orientation.x = 0;
184 control.orientation.y = 1;
185 control.orientation.z = 0;
186 control.interaction_mode = visualization_msgs::InteractiveMarkerControl::ROTATE_AXIS;
187 int_marker.controls.push_back(control);
188 control.interaction_mode = visualization_msgs::InteractiveMarkerControl::MOVE_AXIS;
189 int_marker.controls.push_back(control);
191 control.orientation.w = 1;
192 control.orientation.x = 0;
193 control.orientation.y = 0;
194 control.orientation.z = 1;
195 control.interaction_mode = visualization_msgs::InteractiveMarkerControl::ROTATE_AXIS;
196 int_marker.controls.push_back(control);
197 control.interaction_mode = visualization_msgs::InteractiveMarkerControl::MOVE_AXIS;
198 int_marker.controls.push_back(control);
199 visualization_msgs::InteractiveMarkerControl box_control;
200 box_control.always_visible =
true;
201 visualization_msgs::Marker plane_marker;
202 plane_marker.type = visualization_msgs::Marker::CUBE;
203 plane_marker.scale.x = 1.0;
204 plane_marker.scale.y = 1.0;
205 plane_marker.scale.z = 0.01;
206 plane_marker.color.r = 1.0;
207 plane_marker.color.a = 1.0;
208 plane_marker.pose.orientation.w = 1.0;
209 box_control.markers.push_back(plane_marker);
210 int_marker.controls.push_back(box_control);
214 visualization_msgs::Marker
218 visualization_msgs::Marker
marker;
219 marker.type = visualization_msgs::Marker::CUBE;
223 marker.pose.orientation.w = 1.0;
233 visualization_msgs::InteractiveMarker int_marker;
240 visualization_msgs::InteractiveMarkerControl control;
241 control.orientation.w = 1;
242 control.orientation.x = 1;
243 control.orientation.y = 0;
244 control.orientation.z = 0;
245 control.interaction_mode = visualization_msgs::InteractiveMarkerControl::ROTATE_AXIS;
246 int_marker.controls.push_back(control);
247 control.interaction_mode = visualization_msgs::InteractiveMarkerControl::MOVE_AXIS;
248 int_marker.controls.push_back(control);
250 control.orientation.w = 1;
251 control.orientation.x = 0;
252 control.orientation.y = 1;
253 control.orientation.z = 0;
254 control.interaction_mode = visualization_msgs::InteractiveMarkerControl::ROTATE_AXIS;
255 int_marker.controls.push_back(control);
256 control.interaction_mode = visualization_msgs::InteractiveMarkerControl::MOVE_AXIS;
257 int_marker.controls.push_back(control);
259 control.orientation.w = 1;
260 control.orientation.x = 0;
261 control.orientation.y = 0;
262 control.orientation.z = 1;
263 control.interaction_mode = visualization_msgs::InteractiveMarkerControl::ROTATE_AXIS;
264 int_marker.controls.push_back(control);
265 control.interaction_mode = visualization_msgs::InteractiveMarkerControl::MOVE_AXIS;
266 int_marker.controls.push_back(control);
267 visualization_msgs::InteractiveMarkerControl box_control;
268 box_control.always_visible =
true;
270 int_marker.controls.push_back(box_control);