Thanks fixed. Also changing #define resolution to res fixed problem as well. Sent from my iPhone On 14/07/2011, at 11:28 PM, Ivan Dryanovski wrote: > This is mostly a shot in the dark, but have you tried removing the > #defines and using const doubles? > > Ivan > > On Thu, Jul 14, 2011 at 4:49 AM, Steven Martin wrote: >> Hi Guys, >> >> I am just trying to set the resolution in my Occupancy Grid message. >> >> nav_msgs::OccupancyGrid costmap; >> costmap.info.resolution = 1.0; >> >> but I get this compile error >> >> /src/costmap.cpp: In function ‘void chatterCallback(const sensor_msgs::LaserScan_ >::ConstPtr&)’: >> /src/costmap.cpp:19:18: error: expected unqualified-id before numeric constant >> /src/costmap.cpp:19:18: error: expected ‘;’ before numeric constant >> >> >> Any ideas? One of the other students in the lab had a similar issue with setting "g" in a rgb colour message. "r" and "b" could set but "g" threw the same error. Interestingly both were Float32 message variables. >> >> >> Steve >> >> ----------------------------------- >> >> #include "ros/ros.h" >> #include "sensor_msgs/LaserScan.h" >> #include "nav_msgs/OccupancyGrid.h" >> #include "nav_msgs/MapMetaData.h" >> >> #include >> #include >> >> #define resolution 0.5 >> #define size 30 //+10m , -10m >> const int length = size/resolution; >> ros::Publisher costmap_pub; >> >> >> void chatterCallback(const sensor_msgs::LaserScan::ConstPtr& msg) >> { >> nav_msgs::OccupancyGrid costmap; >> costmap.data.resize(length*length,0); >> costmap.info.resolution = 1.0; >> costmap.info.width = length; >> costmap.info.height = length; >> costmap.header.stamp = ros::Time::now(); >> >> float angle = msg->angle_min; >> int points = (int)(msg->angle_max - msg->angle_min)/msg->angle_increment; >> >> >> .... >> >> >> >> >> Steven Martin >> steven.martin@qut.edu.au >> >> PhD Student >> Queensland University of Technology >> Gardens Point, S1107 >> _______________________________________________ >> ros-users mailing list >> ros-users@code.ros.org >> https://code.ros.org/mailman/listinfo/ros-users >> > _______________________________________________ > ros-users mailing list > ros-users@code.ros.org > https://code.ros.org/mailman/listinfo/ros-users