Closed GoogleCodeExporter closed 9 years ago
Perhaps this is helpful:
The generated source looks like:
package sensor_msgs;
public interface NavSatFix extends org.ros.internal.message.Message {
static final java.lang.String _TYPE = "sensor_msgs/NavSatFix";
static final java.lang.String _DEFINITION = "# Navigation Satellite fix for any Global Navigation Satellite System\n#\n# Specified using the WGS 84 reference ellipsoid\n\n# Header specifies ROS time and frame $
static final byte COVARIANCE_TYPE_UNKNOWN = 0;
static final byte COVARIANCE_TYPE_APPROXIMATED = 1;
static final byte COVARIANCE_TYPE_DIAGONAL_KNOWN = 2;
static final byte COVARIANCE_TYPE_KNOWN = 3;
std_msgs.Header getHeader();
void setHeader(std_msgs.Header value);
sensor_msgs.NavSatStatus getStatus();
void setStatus(sensor_msgs.NavSatStatus value);
double getLatitude();
void setLatitude(double value);
double getLongitude();
void setLongitude(double value);
double getAltitude();
void setAltitude(double value);
double[] getPositionCovariance();
void setPositionCovariance(double[] value);
byte getPositionCovarianceType();
void setPositionCovarianceType(byte value);
}
The message definition of sensor_msgs/NavSatFix is
uint8 COVARIANCE_TYPE_UNKNOWN=0
uint8 COVARIANCE_TYPE_APPROXIMATED=1
uint8 COVARIANCE_TYPE_DIAGONAL_KNOWN=2
uint8 COVARIANCE_TYPE_KNOWN=3
Header header
uint32 seq
time stamp
string frame_id
NavSatStatus status
int8 STATUS_NO_FIX=-1
int8 STATUS_FIX=0
int8 STATUS_SBAS_FIX=1
int8 STATUS_GBAS_FIX=2
uint16 SERVICE_GPS=1
uint16 SERVICE_GLONASS=2
uint16 SERVICE_COMPASS=4
uint16 SERVICE_GALILEO=8
int8 status
uint16 service
float64 latitude
float64 longitude
float64 altitude
float64[9] position_covariance
uint8 position_covariance_type
Original comment by lord.kil...@googlemail.com
on 18 Jun 2012 at 8:29
A standard message (rostopic echo /fix):
---
header:
seq: 4478
stamp:
secs: 1340008262
nsecs: 233342741
frame_id: ''
status:
status: 0
service: 1
latitude: 37.86106
longitude: 9.877675
altitude: 191.7
position_covariance: [16.677, 0.0, 0.0, 0.0, 20.312, 0.0, 0.0, 0.0, 37.521]
position_covariance_type: 2
---
Original comment by lord.kil...@googlemail.com
on 18 Jun 2012 at 8:32
The problematic field is the position covariance (DoubleArrayField<FLOAT64,
position_covariance>) :
public void deserialize(ByteBuffer buffer) {
int size = buffer.getInt();
value = new double[size];
for (int i = 0; i < size; i++) {
value[i] = (Double) type.deserialize(buffer);
}
}
size (== buffer.getInt() varies, is very big: 584115552 (as example),
1065151889
if it is too big, it causes a heap space error.
i also found negative sizes:
-1236950581
So what could be the problem? The message is not as expected?
Original comment by lord.kil...@googlemail.com
on 18 Jun 2012 at 8:51
buffer.getInt() should return 9 ?
Original comment by lord.kil...@googlemail.com
on 18 Jun 2012 at 8:53
Same here. I have the exact problem except while trying to receive the
nav_msgs.Odometry message type. My code is essentially the same as OP, with the
different message types.
Original comment by blairgag...@gmail.com
on 21 Jun 2012 at 12:00
Original comment by damonkoh...@google.com
on 5 Jul 2012 at 8:24
Original issue reported on code.google.com by
lord.kil...@googlemail.com
on 18 Jun 2012 at 7:55