ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
the Problem is the oder of the instrucktions.
if you change your loop to `void loop() {
if (sensor.changed() || force_sensors) {
bool_msg.data = sensor.get();
sensor_publisher.publish(&bool_msg);
force_sensors = false;
}
nh.spinOnce();
delay(1);
}`
or
`void loop() {
if (sensor.changed() || force_sensors) {
bool_msg.data = sensor.get();
sensor_publisher.publish(&bool_msg);
}
force_sensors = false;
nh.spinOnce();
delay(1);
}`
the Reson is that the var force_sensors is updatet in nh.spinOnce() and just after that you resett it
2 | No.2 Revision |
the Problem is the oder of the instrucktions.
if you change your loop to `void loop() {
if (sensor.changed() || force_sensors) {
bool_msg.data = sensor.get();
sensor_publisher.publish(&bool_msg);
force_sensors = false;
}
nh.spinOnce();
delay(1);
}
}`
or
`void loop() {
if (sensor.changed() || force_sensors) {
bool_msg.data = sensor.get();
sensor_publisher.publish(&bool_msg);
}
force_sensors = false;
nh.spinOnce();
delay(1);
}
}`
the Reson is that the var force_sensors is updatet in nh.spinOnce() and just after that you resett it