Hi, seem to be getting an error message a with regards to storage when i compile my arduino, the error i get is ''Low memory available, stability problems may occur"
code:`#include "torquemeter.h"
#include "motor.h"
#include "brake.h"
#define roboclawRxPin1 9
#define roboclawTxPin1 8
#define roboclawRxPin2 11
#define roboclawTxPin2 10
ros::NodeHandle nh;
std_msgs::Float32 torque_msg1;
std_msgs::Float32 torque_msg2;
ros::Publisher pub_torque1("pub_torque1", &torque_msg1);
ros::Publisher pub_torque2("pub_torque2", &torque_msg2);
int sensorPin0 = A0;
int sensorPin1 = A1;
float torqueValueR1 = 0.0;
float torqueValueR2 = 0.0;
torqueread myTrqRead1(sensorPin0);
torqueread myTrqRead2(sensorPin1);
Motor *myMotor1;
Motor *myMotor2;
Brake *myBrake1;
Brake *myBrake2;
void torqueCallback1(const std_msgs::Float32& msg) {
torqueValueR1 = msg.data;
}
void torqueCallback2(const std_msgs::Float32& msg) {
torqueValueR2 = msg.data;
}
ros::Subscriber<std_msgs::Float32> sub_torque1("torque_values_1", &torqueCallback1);
ros::Subscriber<std_msgs::Float32> sub_torque2("torque_values_2", &torqueCallback2);
void setup() {
Serial.begin(115200);
nh.getHardware()->setBaud(9600);
nh.initNode();
nh.advertise(pub_torque1);
nh.advertise(pub_torque2);
nh.subscribe(sub_torque1);
nh.subscribe(sub_torque2);
myMotor1 = new Motor(roboclawRxPin1, roboclawTxPin1);
myMotor2 = new Motor(roboclawRxPin2, roboclawTxPin2);
myBrake1 = new Brake(roboclawRxPin1, roboclawTxPin1);
myBrake2 = new Brake(roboclawRxPin2, roboclawTxPin2);
// Initialize your hardware, motors, and brakes here
// Start motors at a specific speed (example: 50)
myMotor1->MotorSpeed(50);
myMotor2->MotorSpeed(50);
// Apply brakes if needed
myBrake1->applyBrake(0); // Example: 0 for no brake
myBrake2->applyBrake(0); // Example: 0 for no brake
}
void loop() {
torqueR1();
torque_msg1.data = torqueValueR1;
pub_torque1.publish(&torque_msg1);
delay(1000);
torqueR2();
torque_msg2.data = torqueValueR2;
pub_torque2.publish(&torque_msg2);
delay(1000);
// Your original loop code here
nh.spinOnce();
}
void torqueR1() {
torqueValueR1 = myTrqRead1.Read();
}
void torqueR2() {
torqueValueR2 = myTrqRead2.Read();
}
`