Ask Your Question

Revision history [back]

when I compile that on my computer for an arduino uno I get

Sketch uses 22,598 bytes (70%) of program storage space. Maximum is 32,256 bytes. Global variables use 1,746 bytes (85%) of dynamic memory, leaving 302 bytes for local variables. Maximum is 2,048 bytes. Low memory available, stability problems may occur.

I would suspect that is your issue. If you code works without the ROS code in you could try removing all references to Serial to free up memory as the code runs, or try using a board with more memory on it.

when I compile that on my computer for an arduino uno I get

Sketch uses 22,598 bytes (70%) of program storage space. Maximum is 32,256 bytes.
Global variables use 1,746 bytes (85%) of dynamic memory, leaving 302 bytes for local variables. Maximum is 2,048 bytes.
Low memory available, stability problems may occur.

occur.

I would suspect that is your issue. If you code works without the ROS code in you could try removing all references to Serial to free up memory as the code runs, or try using a board with more memory on it.

when I compile that on my computer for an arduino uno I get

Sketch uses 22,598 bytes (70%) of program storage space. Maximum is 32,256 bytes.
Global variables use 1,746 bytes (85%) of dynamic memory, leaving 302 bytes for local variables. Maximum is 2,048 bytes.
Low memory available, stability problems may occur.

I would suspect that is your issue. If you your code works without the ROS code in you could try removing all references to Serial to free up memory as the code runs, or try using a board with more memory on it.

when I compile that on my computer for an arduino uno I get

Sketch uses 22,598 bytes (70%) of program storage space. Maximum is 32,256 bytes.
Global variables use 1,746 bytes (85%) of dynamic memory, leaving 302 bytes for local variables. Maximum is 2,048 bytes.
Low memory available, stability problems may occur.

I would suspect that is your issue. If your code works without the ROS code in you could try removing all references to Serial to free up memory as the code runs, or try using a board with more memory on it.

When I compile it for Teensy 3.1 I get

Sketch uses 17,668 bytes (6%) of program storage space. Maximum is 262,144 bytes.
Global variables use 4,868 bytes (7%) of dynamic memory, leaving 60,668 bytes for local variables. Maximum is 65,536 bytes.

I haven't got you IMU so can't test whether that is the case.

when I compile that on my computer for an arduino uno I get

Sketch uses 22,598 bytes (70%) of program storage space. Maximum is 32,256 bytes.
Global variables use 1,746 bytes (85%) of dynamic memory, leaving 302 bytes for local variables. Maximum is 2,048 bytes.
Low memory available, stability problems may occur.

I would suspect that is your issue. If your code works without the ROS code in you could try removing all references to Serial to free up memory as the code runs, or try using a board with more memory on it.

When I compile it for Teensy 3.1 a mega board I get

Sketch uses 17,668 23,604 bytes (6%) (9%) of program storage space. Maximum is 262,144 253,952 bytes.
Global variables use 4,868 2,222 bytes (7%) (27%) of dynamic memory, leaving 60,668 5,970 bytes for local variables. Maximum is 65,536 8,192 bytes.

I haven't got you IMU so can't test whether that is the case.

when I compile that on my computer for an arduino uno I get

Sketch uses 22,598 bytes (70%) of program storage space. Maximum is 32,256 bytes.
Global variables use 1,746 bytes (85%) of dynamic memory, leaving 302 bytes for local variables. Maximum is 2,048 bytes.
Low memory available, stability problems may occur.

I would suspect that is your issue. If your code works without the ROS code in you could try removing all references to Serial to free up memory as the code runs, or try using a board with more memory on it.

When I compile it for a mega board I get

Sketch uses 23,604 bytes (9%) of program storage space. Maximum is 253,952 bytes.
Global variables use 2,222 bytes (27%) of dynamic memory, leaving 5,970 bytes for local variables. Maximum is 8,192 bytes.

I haven't got you IMU so can't test whether that is the case.

Running it on an arduino uno without the imu I get

Initializing I2C devices...
Testing device connections...
MPU6050 connection failed

Send any character to begin DMP programming and demo:

I just had a face palm moment too. You need to remove all the Serial prints you have anyway, as they will interfere with the node trying to make sense of the messages that are being sent to it by the ROS library over the serial port

when I compile that on my computer for an arduino uno I get

Sketch uses 22,598 bytes (70%) of program storage space. Maximum is 32,256 bytes.
Global variables use 1,746 bytes (85%) of dynamic memory, leaving 302 bytes for local variables. Maximum is 2,048 bytes.
Low memory available, stability problems may occur.

I would suspect that is your issue. If your code works without the ROS code in you could try removing all references to Serial to free up memory as the code runs, or try using a board with more memory on it.

When I compile it for a mega board I get

Sketch uses 23,604 bytes (9%) of program storage space. Maximum is 253,952 bytes.
Global variables use 2,222 bytes (27%) of dynamic memory, leaving 5,970 bytes for local variables. Maximum is 8,192 bytes.

I haven't got you IMU so can't test whether that is the case.

Running it on an arduino uno without the imu I get

Initializing I2C devices...
Testing device connections...
MPU6050 connection failed

Send any character to begin DMP programming and demo:

I just had a face palm moment too. You need to remove all the Serial prints you have anyway, as they will interfere with the node trying to make sense of the messages that are being sent to it by the ROS library over the serial port

You also have

ros::NodeHandle nh;

twice - inside setup, and outside between setup and loop.

You need to have it once, with global scope so put that up near the top like the examples they provide