45 overlap = (aabbMin1.
getX() > point.
getX() || aabbMax1.
getX() < point.
getX()) ?
false : overlap;
46 overlap = (aabbMin1.
getZ() > point.
getZ() || aabbMax1.
getZ() < point.
getZ()) ?
false : overlap;
47 overlap = (aabbMin1.
getY() > point.
getY() || aabbMax1.
getY() < point.
getY()) ?
false : overlap;
57 std::vector<tf::Vector3>& points ) :
70 const visualization_msgs::InteractiveMarkerFeedbackConstPtr &feedback )
73 << feedback->pose.position.x <<
", " << feedback->pose.position.y
74 <<
", " << feedback->pose.position.z );
76 if ( feedback->marker_name ==
"min_x" )
min_sel_.
setX( feedback->pose.position.x );
77 if ( feedback->marker_name ==
"max_x" )
max_sel_.
setX( feedback->pose.position.x );
78 if ( feedback->marker_name ==
"min_y" )
min_sel_.
setY( feedback->pose.position.y );
79 if ( feedback->marker_name ==
"max_y" )
max_sel_.
setY( feedback->pose.position.y );
80 if ( feedback->marker_name ==
"min_z" )
min_sel_.
setZ( feedback->pose.position.z );
81 if ( feedback->marker_name ==
"max_z" )
max_sel_.
setZ( feedback->pose.position.z );
86 if ( feedback->event_type == visualization_msgs::InteractiveMarkerFeedback::MOUSE_UP )
94 vm::Marker
makeBox( vm::InteractiveMarker &msg,
99 marker.type = vm::Marker::CUBE;
100 marker.scale.x = max_bound.
x() - min_bound.
x();
101 marker.scale.y = max_bound.
y() - min_bound.
y();
102 marker.scale.z = max_bound.
z() - min_bound.
z();
103 marker.pose.position.x = 0.5 * ( max_bound.
x() + min_bound.
x() );
104 marker.pose.position.y = 0.5 * ( max_bound.
y() + min_bound.
y() );
105 marker.pose.position.z = 0.5 * ( max_bound.
z() + min_bound.
z() );
106 marker.color.r = 0.5;
107 marker.color.g = 0.5;
108 marker.color.b = 0.5;
109 marker.color.a = 0.5;
116 vm::InteractiveMarker msg;
117 msg.header.frame_id =
"base_link";
119 vm::InteractiveMarkerControl control;
120 control.always_visible =
false;
122 msg.controls.push_back( control );
131 int_marker.header.frame_id =
"base_link";
132 int_marker.name =
name;
135 vm::Marker points_marker;
136 points_marker.type = vm::Marker::SPHERE_LIST;
137 points_marker.scale.x = 0.05;
138 points_marker.scale.y = 0.05;
139 points_marker.scale.z = 0.05;
140 points_marker.color = color;
142 for (
unsigned i=0; i<points.size(); i++ )
144 geometry_msgs::Point p;
148 points_marker.points.push_back( p );
152 vm::InteractiveMarkerControl points_control;
153 points_control.always_visible =
true;
154 points_control.interaction_mode = vm::InteractiveMarkerControl::NONE;
155 points_control.markers.push_back( points_marker );
158 int_marker.controls.push_back( points_control );
165 std::vector<tf::Vector3> points_in, points_out;
166 points_in.reserve(
points_.size() );
167 points_out.reserve(
points_.size() );
170 for (
unsigned i=0; i<
points_.size(); i++ )
174 points_in.push_back(
points_[i] );
178 points_out.push_back(
points_[i] );
182 std_msgs::ColorRGBA in_color;
188 std_msgs::ColorRGBA out_color;
200 for (
int axis=0; axis<3; axis++ )
202 for (
int sign=-1; sign<=1; sign+=2 )
205 int_marker.header.frame_id =
"base_link";
206 int_marker.scale = 1.0;
208 vm::InteractiveMarkerControl control;
209 control.interaction_mode = vm::InteractiveMarkerControl::MOVE_AXIS;
210 control.orientation_mode = vm::InteractiveMarkerControl::INHERIT;
211 control.always_visible =
false;
218 int_marker.name = sign>0 ?
"max_x" :
"min_x";
227 int_marker.name = sign>0 ?
"max_y" :
"min_y";
236 int_marker.name = sign>0 ?
"max_z" :
"min_z";
248 int_marker.controls.push_back( control );
256 for (
int axis=0; axis<3; axis++ )
258 for (
int sign=-1; sign<=1; sign+=2 )
261 geometry_msgs::Pose pose;
266 name = sign>0 ?
"max_x" :
"min_x";
272 name = sign>0 ?
"max_y" :
"min_y";
278 name = sign>0 ?
"max_z" :
"min_z";
285 server_->setPose( name, pose );
303 double rand(
double min,
double max )
305 double t = (double)
rand() / (double)RAND_MAX;
306 return min + t*(max-min);
310 void makePoints( std::vector<tf::Vector3>& points_out,
int num_points )
314 points_out.resize(num_points);
315 for(
int i = 0; i < num_points; i++ )
317 points_out[i].setX( scale *
rand( -radius, radius ) );
318 points_out[i].setY( scale *
rand( -radius, radius ) );
319 points_out[i].setZ( scale * radius * 0.2 * ( sin( 10.0 / radius * points_out[i].x() ) + cos( 10.0 / radius * points_out[i].y() ) ) );
324 int main(
int argc,
char** argv)
332 std::vector<tf::Vector3> points;
338 server->applyChanges();
void updatePointCloud(std::string name, std_msgs::ColorRGBA color, std::vector< tf::Vector3 > &points)
TFSIMD_FORCE_INLINE void setX(tfScalar x)
TFSIMD_FORCE_INLINE void setY(tfScalar y)
bool testPointAgainstAabb2(const tf::Vector3 &aabbMin1, const tf::Vector3 &aabbMax1, const tf::Vector3 &point)
vm::InteractiveMarker unsel_points_marker_
void makePoints(std::vector< tf::Vector3 > &points_out, int num_points)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
TFSIMD_FORCE_INLINE void setZ(tfScalar z)
TFSIMD_FORCE_INLINE const tfScalar & getY() const
vm::InteractiveMarker sel_points_marker_
vm::Marker makeBox(vm::InteractiveMarker &msg, tf::Vector3 min_bound, tf::Vector3 max_bound)
TFSIMD_FORCE_INLINE const tfScalar & getZ() const
int main(int argc, char **argv)
ROSCPP_DECL void spin(Spinner &spinner)
TFSIMD_FORCE_INLINE const tfScalar & x() const
double rand(double min, double max)
TFSIMD_FORCE_INLINE const tfScalar & z() const
PointCouldSelector(boost::shared_ptr< interactive_markers::InteractiveMarkerServer > server, std::vector< tf::Vector3 > &points)
static void quaternionTFToMsg(const Quaternion &bt, geometry_msgs::Quaternion &msg)
TFSIMD_FORCE_INLINE const tfScalar & y() const
boost::shared_ptr< interactive_markers::InteractiveMarkerServer > server_
#define ROS_INFO_STREAM(args)
TFSIMD_FORCE_INLINE const tfScalar & getX() const
INTERACTIVE_MARKERS_PUBLIC void makeArrow(const visualization_msgs::InteractiveMarker &msg, visualization_msgs::InteractiveMarkerControl &control, float pos)
std::vector< tf::Vector3 > points_
void processAxisFeedback(const visualization_msgs::InteractiveMarkerFeedbackConstPtr &feedback)