mytest2.cpp
Go to the documentation of this file.
1 /**************************************************************************************************
2  Software License Agreement (BSD License)
3 
4  Copyright (c) 2011-2013, LAR toolkit developers - University of Aveiro - http://lars.mec.ua.pt
5  All rights reserved.
6 
7  Redistribution and use in source and binary forms, with or without modification, are permitted
8  provided that the following conditions are met:
9 
10  *Redistributions of source code must retain the above copyright notice, this list of
11  conditions and the following disclaimer.
12  *Redistributions in binary form must reproduce the above copyright notice, this list of
13  conditions and the following disclaimer in the documentation and/or other materials provided
14  with the distribution.
15  *Neither the name of the University of Aveiro nor the names of its contributors may be used to
16  endorse or promote products derived from this software without specific prior written permission.
17 
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
19  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20  FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
21  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
24  IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 ***************************************************************************************************/
33 #include <ros/ros.h>
34 #include <visualization_msgs/Marker.h>
35 
37 #define PFLN {printf("DEBUG PRINT FILE %s LINE %d\n",__FILE__,__LINE__);}
38 
39 
40 
41 
42 int main(int argc, char* argv[]) {
43 
44 
45  //daeElement* bindVertexInput = instanceMaterial->add("bind_vertex_input");
46  //bindVertexInput->setAttribute("semantic", "uv0");
47  //bindVertexInput->setAttribute("input_semantic", "TEXCOORD");
48  //bindVertexInput->setAttribute("input_set", "0");
49 
50 
51 
52  //MAIN CYCLE
53  ros::init(argc, argv, "point_cloud_publisher"); // Initialize ROS coms
54  ros::NodeHandle n; //The node handle
55  ros::Rate r(0.1);
56  visualization_msgs::Marker marker;
57  ros::Publisher marker_pub = n.advertise<visualization_msgs::Marker>("/wrapper_collada", 1);
58  marker.id = 1;
59  marker.header.stamp = ros::Time::now();
60  marker.type = visualization_msgs::Marker::MESH_RESOURCE;
61  marker.action = visualization_msgs::Marker::ADD;
62  marker.ns = "ns";
63  //marker.mesh_resource = "package://wrapper_collada/bin/polygons1.dae";
64  marker.mesh_use_embedded_materials = 1;
65  marker.header.frame_id = "/atc/vehicle/ground";
66  //marker.scale.x = 2.54/100;
67  //marker.scale.y = 2.54/100;
68  //marker.scale.z = 2.54/100;
69  marker.scale.x = 1;
70  marker.scale.y = 1;
71  marker.scale.z = 1;
72  marker.color.r = 0.2;
73  marker.color.g = 0.3;
74  marker.color.b = 0.4;
75  marker.color.a = 1;
76 int a=0;
77  while(n.ok())
78 {
79  a++;
80  //char str[1024];
81  //sprintf(str, "mesh/polygons%d.dae",a);
82  //wrapper_collada wc(str);
83 
86  //std::string polygon_name("plg0");//the polygon name
87  //pcl::PointCloud<pcl::PointXYZ>::Ptr cloud; //the point cloud with the polygon vertices list
88  //cloud = pcl::PointCloud<pcl::PointXYZ>::Ptr(new pcl::PointCloud<pcl::PointXYZ>);
89  //cloud->points.push_back(pcl::PointXYZ(-1,-1, 0));
90  //cloud->points.push_back(pcl::PointXYZ(1,-1, 0));
91  //cloud->points.push_back(pcl::PointXYZ(1,1, 0));
92  //cloud->points.push_back(pcl::PointXYZ(-1,1, 0));
93 
94  //pcl::PointCloud<pcl::PointXYZ>::Ptr normal; //the point cloud with the polygon vertices list
95  //normal = pcl::PointCloud<pcl::PointXYZ>::Ptr(new pcl::PointCloud<pcl::PointXYZ>);
96  //normal->points.push_back(pcl::PointXYZ(0, 0, 1)); //the normal vector to the polygon
97 
98 
99  //wc.add_polygon_fixed_color(polygon_name, cloud, normal, 1,0,0,1);
100 
101  //wc.write_file();
102 
103  char str1[1024];
104  //sprintf(str1, "package://wrapper_collada/bin/%s",str);
105  //sprintf(str1, "package://wrapper_collada/models/car1.dae");
106  sprintf(str1, "package://wrapper_collada/models/decisive_woman.obj");
107  marker.mesh_resource = str1;
108  marker.header.stamp = ros::Time::now();
109  marker_pub.publish(marker);
110 
111  ros::Duration(0.4).sleep();
112  ros::spinOnce();
113 
114 }
115 
116 return 0;
117 }
The actual wrapper collada class definition.
int main(int argc, char *argv[])
Definition: mytest2.cpp:42


wrapper_collada
Author(s): Miguel Oliveira
autogenerated on Mon Mar 2 2015 01:33:01