24 #include <std_msgs/Bool.h> 25 #include <std_msgs/String.h> 26 #include <sensor_msgs/PointCloud2.h> 27 #include <sensor_msgs/JointState.h> 28 #include <laser_assembler/AssembleScans2.h> 29 #include <pcl/point_types.h> 30 #include <pcl/filters/statistical_outlier_removal.h> 52 laser_assembler::AssembleScans2 service;
53 service.request.begin = before_time;
54 service.request.end = end_time;
56 if (g_assemble_chest_laser_client.
call(service))
59 sensor_msgs::PointCloud2 assembler_output = service.response.cloud;
60 if (assembler_output.data.size() == 0)
68 g_point_cloud2_pub.
publish(assembler_output);
76 if (msg->data ==
"start")
78 g_lidar_move_start_time = now;
80 else if (msg->data ==
"end")
84 g_lidar_move_start_time = now;
88 int main(
int argc,
char** argv)
90 ros::init(argc, argv,
"thor_lidar_assembler");
95 g_point_cloud2_pub = nh.
advertise<sensor_msgs::PointCloud2>(
"/robotis/sensor/assembled_scan", 0);
96 g_assemble_chest_laser_client = nh.
serviceClient<laser_assembler::AssembleScans2>(
"/robotis/sensor/service/assemble_scans2");
ServiceClient serviceClient(const std::string &service_name, bool persistent=false, const M_string &header_values=M_string())
void publish(const boost::shared_ptr< M > &message) const
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
void assembleLaserScans(ros::Time before_time, ros::Time end_time)
void lidarTurnCallBack(const std_msgs::String::ConstPtr &msg)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
bool call(MReq &req, MRes &res)
ros::Subscriber g_lidar_turn_end_sub
ros::ServiceClient g_assemble_chest_laser_client
ROSCPP_DECL void spin(Spinner &spinner)
ros::Publisher g_point_cloud2_pub
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
ros::Subscriber g_lidar_turn_start_sub
int main(int argc, char **argv)
ros::Time g_lidar_move_start_time