36 #define BOOST_PARAMETER_MAX_ARITY 7 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;
55 initial_pos.push_back(0);
56 initial_pos.push_back(0);
57 initial_pos.push_back(0);
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())));
136 polygons.push_back(plane);
140 pcl::KdTreeFLANN<pcl::PointXYZ> tree;
141 tree.setInputCloud(cloud);
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;
220 marker.scale.x = p.
dx;
221 marker.scale.y = p.
dy;
222 marker.scale.z = p.
dz;
223 marker.pose.orientation.w = 1.0;
224 marker.color.r = 0.5;
225 marker.color.g = 0.5;
226 marker.color.b = 0.5;
227 marker.color.a = 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);
InteractiveCuboidLikelihoodConfig Config
void publish(const boost::shared_ptr< M > &message) const
virtual void processFeedback(const visualization_msgs::InteractiveMarkerFeedback::ConstPtr &feedback)
void poseEigenToMsg(const Eigen::Affine3d &e, geometry_msgs::Pose &m)
virtual visualization_msgs::Marker particleToMarker(const Particle &p)
void poseMsgToEigen(const geometry_msgs::Pose &m, Eigen::Affine3d &e)
tf::StampedTransform lookupTransformWithDuration(tf::TransformListener *listener, const std::string &to_frame, const std::string &from_frame, const ros::Time &stamp, ros::Duration duration)
virtual visualization_msgs::InteractiveMarker particleToInteractiveMarker(const Particle &p)
const std::string & getName() const
void fromROSMsg(const sensor_msgs::PointCloud2 &cloud, pcl::PointCloud< T > &pcl_cloud)
Eigen::Affine3f toEigenMatrix() const
boost::shared_ptr< interactive_markers::InteractiveMarkerServer > plane_server_
virtual void processPlaneFeedback(const visualization_msgs::InteractiveMarkerFeedback::ConstPtr &feedback)
Eigen::Affine3f plane_pose_
tf::TransformListener * tf_
virtual visualization_msgs::InteractiveMarker planeInteractiveMarker()
PLUGINLIB_EXPORT_CLASS(jsk_pcl_ros::InteractiveCuboidLikelihood, nodelet::Nodelet)
void fromEigen(const Eigen::Affine3f &pose)
std::string sensor_frame_
std::vector< Eigen::Vector3f, Eigen::aligned_allocator< Eigen::Vector3f > > Vertices
void vectorTFToEigen(const tf::Vector3 &t, Eigen::Vector3d &e)
virtual void likelihood(const sensor_msgs::PointCloud2::ConstPtr &msg)
#define NODELET_INFO(...)
double computeLikelihood(const pcl::tracking::ParticleCuboid &p, pcl::PointCloud< pcl::PointXYZ >::ConstPtr cloud, pcl::KdTreeFLANN< pcl::PointXYZ > &tree, const Eigen::Vector3f &viewpoint, const std::vector< Polygon::Ptr > &polygons, const std::vector< float > &polygon_likelihood, const Config &config)
virtual void unsubscribe()
virtual void configCallback(Config &config, uint32_t level)
boost::shared_ptr< dynamic_reconfigure::Server< Config > > srv_
static tf::TransformListener * getInstance()
boost::shared_ptr< interactive_markers::InteractiveMarkerServer > server_