Open HomelyRollout opened 1 year ago
Never mind. Was able to resolve the issue by following the steps on issue #768
It seems I was getting too ahead of myself. I am once again dealing with this same error again. I will paste the program I am running in this comment. I am trying to use a light sensor with my tb3 but I am having difficulties with accurately displaying the amount of light in the atmosphere.
/***
Setup function ***/ void setup() { DEBUG_SERIAL.begin(57600);
// Initialize ROS node handle, advertise and subscribe the topics nh.initNode(); nh.getHardware()->setBaud(115200);
nh.subscribe(cmd_vel_sub); nh.subscribe(sound_sub); nh.subscribe(motor_power_sub); nh.subscribe(reset_sub); nh.subscribe(Illuminance_sub);
nh.advertise(sensor_state_pub);
nh.advertise(version_info_pub);
nh.advertise(imu_pub);
nh.advertise(cmd_vel_rc100_pub);
nh.advertise(odom_pub);
nh.advertise(joint_states_pub);
nh.advertise(battery_state_pub);
nh.advertise(mag_pub);
nh.advertise(Illuminance_pub);
tf_broadcaster.init(nh);
// Setting for Dynamixel motors motor_driver.init(NAME);
// Setting for IMU sensors.init();
// Init diagnosis diagnosis.init();
// Setting for ROBOTIS RC100 remote controller and cmd_vel controllers.init(MAX_LINEAR_VELOCITY, MAX_ANGULAR_VELOCITY);
// Setting for SLAM and navigation (odometry, joint states, TF) initOdom();
initJointStates();
prev_update_time = millis();
pinMode(LED_WORKING_CHECK, OUTPUT);
Serial.begin(9600); pinMode(BDPIN_LED_USER_1, OUTPUT); pinMode(BDPIN_LED_USER_2, OUTPUT); pinMode(BDPIN_LED_USER_3, OUTPUT);
setup_end = true; }
/***
Loop function ***/ void loop() { uint32_t t = millis(); updateTime(); updateVariable(nh.connected()); updateTFPrefix(nh.connected());
if ((t-tTime[0]) >= (1000 / CONTROL_MOTOR_SPEED_FREQUENCY)) if(analogRead(0)<200) { digitalWrite(BDPIN_LED_USER_1, LOW); digitalWrite(BDPIN_LED_USER_2, LOW); digitalWrite(BDPIN_LED_USER_3, LOW); } else if(analogRead(0)>200 && analogRead(0)<300) { digitalWrite(BDPIN_LED_USER_1, HIGH); digitalWrite(BDPIN_LED_USER_2, LOW); digitalWrite(BDPIN_LED_USER_3, LOW); } else if(analogRead(0)>300 && analogRead(0)<400) { digitalWrite(BDPIN_LED_USER_1, HIGH); digitalWrite(BDPIN_LED_USER_2, HIGH); digitalWrite(BDPIN_LED_USER_3, LOW); } else if(analogRead(0)>400 && analogRead(0)<500) { digitalWrite(BDPIN_LED_USER_1, HIGH); digitalWrite(BDPIN_LED_USER_2, HIGH); digitalWrite(BDPIN_LED_USER_3, HIGH); } Serial.println(analogRead(0), DEC); delay(100); { updateGoalVelocity(); if ((t-tTime[6]) > CONTROL_MOTOR_TIMEOUT) { motor_driver.controlMotor(WHEEL_RADIUS, WHEEL_SEPARATION, zero_velocity); } else { motor_driver.controlMotor(WHEEL_RADIUS, WHEEL_SEPARATION, goal_velocity); } tTime[0] = t; }
if ((t-tTime[1]) >= (1000 / CMD_VEL_PUBLISH_FREQUENCY)) { publishCmdVelFromRC100Msg(); tTime[1] = t; }
if ((t-tTime[2]) >= (1000 / DRIVE_INFORMATION_PUBLISH_FREQUENCY)) {
publishSensorStateMsg(); publishBatteryStateMsg(); publishDriveInformation(); tTime[2] = t; }
if ((t-tTime[3]) >= (1000 / IMU_PUBLISH_FREQUENCY)) { publishImuMsg(); publishMagMsg(); tTime[3] = t; }
if ((t-tTime[4]) >= (1000 / VERSION_INFORMATION_PUBLISH_FREQUENCY)) { publishVersionInfoMsg(); tTime[4] = t; }
if ((t-tTime[5]) >= (1000 / DEBUG_LOG_FREQUENCY)) { sendDebuglog(); tTime[5] = t; }
// Send log message after ROS connection sendLogMsg();
// Receive data from RC100
bool clicked_state = controllers.getRCdata(goal_velocity_from_rc100);
if (clicked_state == true)
tTime[6] = millis();
// Check push button pressed for simple test drive driveTest(diagnosis.getButtonPress(3000));
// Update the IMU unit sensors.updateIMU();
// TODO // Update sonar data // sensors.updateSonar(t);
// Start Gyro Calibration after ROS connection updateGyroCali(nh.connected());
// Show LED status diagnosis.showLedStatus(nh.connected());
// Update Voltage battery_state = diagnosis.updateVoltageCheck(setup_end);
// Update Illuminance with new data illum_msg.header.stamp = nh.now(); illum_msg.illuminance = int(&illum_msg);
// Call all the callbacks waiting to be called at that point in time nh.spinOnce();
// Wait the serial link time to process waitForSerialLink(nh.connected()); }
/***
Callback function for cmd_vel msg ***/ void commandVelocityCallback(const geometry_msgs::Twist& cmd_vel_msg) { goal_velocity_from_cmd[LINEAR] = cmd_vel_msg.linear.x; goal_velocity_from_cmd[ANGULAR] = cmd_vel_msg.angular.z;
goal_velocity_from_cmd[LINEAR] = constrain(goal_velocity_from_cmd[LINEAR], MIN_LINEAR_VELOCITY, MAX_LINEAR_VELOCITY); goal_velocity_from_cmd[ANGULAR] = constrain(goal_velocity_from_cmd[ANGULAR], MIN_ANGULAR_VELOCITY, MAX_ANGULAR_VELOCITY); tTime[6] = millis(); }
/***
/***
Callback function for motor_power msg ***/ void motorPowerCallback(const std_msgs::Bool& power_msg) { bool dxl_power = power_msg.data;
motor_driver.setTorque(dxl_power); }
/***
Callback function for reset msg ***/ void resetCallback(const std_msgs::Empty& reset_msg) { char log_msg[50];
(void)(reset_msg);
sprintf(log_msg, "Start Calibration of Gyro"); nh.loginfo(log_msg);
sensors.calibrationGyro();
sprintf(log_msg, "Calibration End"); nh.loginfo(log_msg);
initOdom();
sprintf(log_msg, "Reset Odometry");
nh.loginfo(log_msg);
}
/***
Publish msgs (CMD Velocity data from RC100 : angular velocity, linear velocity) ***/ void publishCmdVelFromRC100Msg(void) { cmd_vel_rc100_msg.linear.x = goal_velocity_from_rc100[LINEAR]; cmd_vel_rc100_msg.angular.z = goal_velocity_from_rc100[ANGULAR];
cmd_vel_rc100_pub.publish(&cmd_vel_rc100_msg); }
/***
Publish msgs (IMU data: angular velocity, linear acceleration, orientation) ***/ void publishImuMsg(void) { imu_msg = sensors.getIMU();
imu_msg.header.stamp = rosNow(); imu_msg.header.frame_id = imu_frame_id;
imu_pub.publish(&imu_msg); }
/***
Publish msgs (Magnetic data) ***/ void publishMagMsg(void) { mag_msg = sensors.getMag();
mag_msg.header.stamp = rosNow(); mag_msg.header.frame_id = mag_frame_id;
mag_pub.publish(&mag_msg); }
/***
Publish msgs (sensor_state: bumpers, cliffs, buttons, encoders, battery) ***/ void publishSensorStateMsg(void) { bool dxl_comm_result = false;
sensor_state_msg.header.stamp = rosNow(); sensor_state_msg.battery = sensors.checkVoltage();
dxl_comm_result = motor_driver.readEncoder(sensor_state_msg.left_encoder, sensor_state_msg.right_encoder);
if (dxl_comm_result == true) updateMotorInfo(sensor_state_msg.left_encoder, sensor_state_msg.right_encoder); else return;
sensor_state_msg.bumper = sensors.checkPushBumper();
sensor_state_msg.cliff = sensors.getIRsensorData();
// TODO // sensor_state_msg.sonar = sensors.getSonarData();
sensor_state_msg.illumination = sensors.getIlluminationData();
sensor_state_msg.button = sensors.checkPushButton();
sensor_state_msg.torque = motor_driver.getTorque();
sensor_state_pub.publish(&sensor_state_msg); }
/***
Publish msgs (version info) ***/ void publishVersionInfoMsg(void) { version_info_msg.hardware = "0.0.0"; version_info_msg.software = "0.0.0"; version_info_msg.firmware = FIRMWARE_VER;
version_info_pub.publish(&version_info_msg); }
/***
Publish msgs (battery_state) ***/ void publishBatteryStateMsg(void) { battery_state_msg.header.stamp = rosNow(); battery_state_msg.design_capacity = 1.8f; //Ah battery_state_msg.voltage = sensors.checkVoltage(); battery_state_msg.percentage = (float)(battery_state_msg.voltage / 11.1f);
if (battery_state == 0) battery_state_msg.present = false; else battery_state_msg.present = true;
battery_state_pub.publish(&battery_state_msg); }
/***
Publish msgs (odometry, joint states, tf) ***/ void publishDriveInformation(void) { unsigned long time_now = millis(); unsigned long step_time = time_now - prev_update_time;
prev_update_time = time_now; ros::Time stamp_now = rosNow();
// calculate odometry calcOdometry((double)(step_time * 0.001));
// odometry updateOdometry(); odom.header.stamp = stamp_now; odom_pub.publish(&odom);
// odometry tf updateTF(odom_tf); odom_tf.header.stamp = stamp_now; tf_broadcaster.sendTransform(odom_tf);
// joint states updateJointStates(); joint_states.header.stamp = stamp_now; joint_states_pub.publish(&joint_states); }
/***
Update TF Prefix ***/ void updateTFPrefix(bool isConnected) { static bool isChecked = false; char log_msg[50];
if (isConnected) { if (isChecked == false) { nh.getParam("~tf_prefix", &get_tf_prefix);
if (!strcmp(get_tf_prefix, "")) { sprintf(odom_header_frame_id, "odom"); sprintf(odom_child_frame_id, "base_footprint");
sprintf(imu_frame_id, "imu_link");
sprintf(mag_frame_id, "mag_link");
sprintf(joint_state_header_frame_id, "base_link");
} else { strcpy(odom_header_frame_id, get_tf_prefix); strcpy(odom_child_frame_id, get_tf_prefix);
strcpy(imu_frame_id, get_tf_prefix);
strcpy(mag_frame_id, get_tf_prefix);
strcpy(joint_state_header_frame_id, get_tf_prefix);
strcat(odom_header_frame_id, "/odom");
strcat(odom_child_frame_id, "/base_footprint");
strcat(imu_frame_id, "/imu_link");
strcat(mag_frame_id, "/mag_link");
strcat(joint_state_header_frame_id, "/base_link");
}
sprintf(log_msg, "Setup TF on Odometry [%s]", odom_header_frame_id); nh.loginfo(log_msg);
sprintf(log_msg, "Setup TF on IMU [%s]", imu_frame_id); nh.loginfo(log_msg);
sprintf(log_msg, "Setup TF on MagneticField [%s]", mag_frame_id); nh.loginfo(log_msg);
sprintf(log_msg, "Setup TF on JointState [%s]", joint_state_header_frame_id); nh.loginfo(log_msg);
isChecked = true; } } else { isChecked = false; } }
/***
Update the odometry ***/ void updateOdometry(void) { odom.header.frame_id = odom_header_frame_id; odom.child_frame_id = odom_child_frame_id;
odom.pose.pose.position.x = odom_pose[0]; odom.pose.pose.position.y = odom_pose[1]; odom.pose.pose.position.z = 0; odom.pose.pose.orientation = tf::createQuaternionFromYaw(odom_pose[2]);
odom.twist.twist.linear.x = odom_vel[0]; odom.twist.twist.angular.z = odom_vel[2]; }
/***
Update the joint states ***/ void updateJointStates(void) { static float joint_states_pos[WHEEL_NUM] = {0.0, 0.0}; static float joint_states_vel[WHEEL_NUM] = {0.0, 0.0}; //static float joint_states_eff[WHEEL_NUM] = {0.0, 0.0};
joint_states_pos[LEFT] = last_rad[LEFT]; joint_states_pos[RIGHT] = last_rad[RIGHT];
joint_states_vel[LEFT] = last_velocity[LEFT]; joint_states_vel[RIGHT] = last_velocity[RIGHT];
joint_states.position = joint_states_pos; joint_states.velocity = joint_states_vel; }
/***
/***
Update motor information ***/ void updateMotorInfo(int32_t left_tick, int32_t right_tick) { int32_t current_tick = 0; static int32_t last_tick[WHEEL_NUM] = {0, 0};
if (init_encoder) { for (int index = 0; index < WHEEL_NUM; index++) { last_diff_tick[index] = 0; last_tick[index] = 0; last_rad[index] = 0.0;
last_velocity[index] = 0.0; }
last_tick[LEFT] = left_tick; last_tick[RIGHT] = right_tick;
init_encoder = false; return; }
current_tick = left_tick;
last_diff_tick[LEFT] = current_tick - last_tick[LEFT]; last_tick[LEFT] = current_tick; last_rad[LEFT] += TICK2RAD * (double)last_diff_tick[LEFT];
current_tick = right_tick;
last_diff_tick[RIGHT] = current_tick - last_tick[RIGHT]; last_tick[RIGHT] = current_tick; last_rad[RIGHT] += TICK2RAD * (double)last_diff_tick[RIGHT]; }
/***
Calculate the odometry ***/ bool calcOdometry(double diff_time) { float* orientation; double wheel_l, wheel_r; // rotation value of wheel [rad] double delta_s, theta, delta_theta; static double last_theta = 0.0; double v, w; // v = translational velocity [m/s], w = rotational velocity [rad/s] double step_time;
wheel_l = wheel_r = 0.0; delta_s = delta_theta = theta = 0.0; v = w = 0.0; step_time = 0.0;
step_time = diff_time;
if (step_time == 0) return false;
wheel_l = TICK2RAD (double)last_diff_tick[LEFT]; wheel_r = TICK2RAD (double)last_diff_tick[RIGHT];
if (isnan(wheel_l)) wheel_l = 0.0;
if (isnan(wheel_r)) wheel_r = 0.0;
delta_s = WHEEL_RADIUS (wheel_r + wheel_l) / 2.0;
// theta = WHEEL_RADIUS (wheel_r - wheel_l) / WHEEL_SEPARATION;
orientation = sensors.getOrientation();
theta = atan2f(orientation[1]orientation[2] + orientation[0]orientation[3],
0.5f - orientation[2]orientation[2] - orientation[3]orientation[3]);
delta_theta = theta - last_theta;
// compute odometric pose odom_pose[0] += delta_s cos(odom_pose[2] + (delta_theta / 2.0)); odom_pose[1] += delta_s sin(odom_pose[2] + (delta_theta / 2.0)); odom_pose[2] += delta_theta;
// compute odometric instantaneouse velocity
v = delta_s / step_time; w = delta_theta / step_time;
odom_vel[0] = v; odom_vel[1] = 0.0; odom_vel[2] = w;
last_velocity[LEFT] = wheel_l / step_time; last_velocity[RIGHT] = wheel_r / step_time; last_theta = theta;
return true; }
/***
Turtlebot3 test drive using push buttons ***/ void driveTest(uint8_t buttons) { static bool move[2] = {false, false}; static int32_t saved_tick[2] = {0, 0}; static double diff_encoder = 0.0;
int32_t current_tick[2] = {0, 0};
motor_driver.readEncoder(current_tick[LEFT], current_tick[RIGHT]);
if (buttons & (1<<0))
{
move[LINEAR] = true;
saved_tick[RIGHT] = current_tick[RIGHT];
diff_encoder = TEST_DISTANCE / (0.207 / 4096); // (Circumference of Wheel) / (The number of tick per revolution) tTime[6] = millis(); } else if (buttons & (1<<1)) { move[ANGULAR] = true; saved_tick[RIGHT] = current_tick[RIGHT];
diff_encoder = (TEST_RADIAN * TURNING_RADIUS) / (0.207 / 4096); tTime[6] = millis(); }
if (move[LINEAR])
{
if (abs(saved_tick[RIGHT] - current_tick[RIGHT]) <= diff_encoder)
{
goal_velocity_from_button[LINEAR] = 0.05;
tTime[6] = millis();
}
else
{
goal_velocity_from_button[LINEAR] = 0.0;
move[LINEAR] = false;
}
}
else if (move[ANGULAR])
{
if (abs(saved_tick[RIGHT] - current_tick[RIGHT]) <= diff_encoder)
{
goal_velocity_from_button[ANGULAR]= -0.7;
tTime[6] = millis();
}
else
{
goal_velocity_from_button[ANGULAR] = 0.0;
move[ANGULAR] = false;
}
}
}
/***
Update variable (initialization) ***/ void updateVariable(bool isConnected) { static bool variable_flag = false;
if (isConnected)
{
if (variable_flag == false)
{
sensors.initIMU();
initOdom();
variable_flag = true; } } else { variable_flag = false; } }
/***
Wait for Serial Link ***/ void waitForSerialLink(bool isConnected) { static bool wait_flag = false;
if (isConnected)
{
if (wait_flag == false)
{
delay(10);
wait_flag = true; } } else { wait_flag = false; } }
/***
/***
/***
Time Interpolation function (deprecated) ***/ ros::Time addMicros(ros::Time & t, uint32_t _micros) { uint32_t sec, nsec;
sec = _micros / 1000 + t.sec; nsec = _micros % 1000000000 + t.nsec;
return ros::Time(sec, nsec); }
/***
Start Gyro Calibration ***/ void updateGyroCali(bool isConnected) { static bool isEnded = false; char log_msg[50];
(void)(isConnected);
if (nh.connected()) { if (isEnded == false) { sprintf(log_msg, "Start Calibration of Gyro"); nh.loginfo(log_msg);
sensors.calibrationGyro();
sprintf(log_msg, "Calibration End"); nh.loginfo(log_msg);
isEnded = true; } } else { isEnded = false; } }
/***
Send log message ***/ void sendLogMsg(void) { static bool log_flag = false; char log_msg[100];
String name = NAME; String firmware_version = FIRMWARE_VER; String bringup_log = "This core(v" + firmware_version + ") is compatible with TB3 " + name;
const char* init_log_data = bringup_log.c_str();
if (nh.connected())
{
if (log_flag == false)
{
sprintf(log_msg, "--------------------------");
nh.loginfo(log_msg);
sprintf(log_msg, "Connected to OpenCR board!"); nh.loginfo(log_msg);
sprintf(log_msg, init_log_data); nh.loginfo(log_msg);
sprintf(log_msg, "--------------------------"); nh.loginfo(log_msg);
log_flag = true; } } else { log_flag = false; } }
/***
Initialization odometry data ***/ void initOdom(void) { init_encoder = true;
for (int index = 0; index < 3; index++) { odom_pose[index] = 0.0; odom_vel[index] = 0.0; }
odom.pose.pose.position.x = 0.0; odom.pose.pose.position.y = 0.0; odom.pose.pose.position.z = 0.0;
odom.pose.pose.orientation.x = 0.0; odom.pose.pose.orientation.y = 0.0; odom.pose.pose.orientation.z = 0.0; odom.pose.pose.orientation.w = 0.0;
odom.twist.twist.linear.x = 0.0; odom.twist.twist.angular.z = 0.0; }
/***
Initialization joint states data ***/ void initJointStates(void) { static char joint_states_name[] = {(char)"wheel_left_joint", (char*)"wheel_right_joint"};
joint_states.header.frame_id = joint_state_header_frame_id; joint_states.name = joint_states_name;
joint_states.name_length = WHEEL_NUM; joint_states.position_length = WHEEL_NUM; joint_states.velocity_length = WHEEL_NUM; joint_states.effort_length = WHEEL_NUM; }
/***
Update Goal Velocity ***/ void updateGoalVelocity(void) { goal_velocity[LINEAR] = goal_velocity_from_button[LINEAR] + goal_velocity_from_cmd[LINEAR] + goal_velocity_from_rc100[LINEAR]; goal_velocity[ANGULAR] = goal_velocity_from_button[ANGULAR] + goal_velocity_from_cmd[ANGULAR] + goal_velocity_from_rc100[ANGULAR];
sensors.setLedPattern(goal_velocity[LINEAR], goal_velocity[ANGULAR]); }
/***
Send Debug data ***/ void sendDebuglog(void) { DEBUG_SERIAL.println("---------------------------------------"); DEBUG_SERIAL.println("EXTERNAL SENSORS"); DEBUG_SERIAL.println("---------------------------------------"); DEBUG_SERIAL.print("Bumper : "); DEBUG_SERIAL.println(sensors.checkPushBumper()); DEBUG_SERIAL.print("Cliff : "); DEBUG_SERIAL.println(sensors.getIRsensorData()); DEBUG_SERIAL.print("Sonar : "); DEBUG_SERIAL.println(sensors.getSonarData()); DEBUG_SERIAL.print("Illumination : "); DEBUG_SERIAL.println(sensors.getIlluminationData());
DEBUG_SERIAL.println("---------------------------------------"); DEBUG_SERIAL.println("OpenCR SENSORS"); DEBUG_SERIAL.println("---------------------------------------"); DEBUG_SERIAL.print("Battery : "); DEBUG_SERIAL.println(sensors.checkVoltage()); DEBUG_SERIAL.println("Button : " + String(sensors.checkPushButton()));
float* quat = sensors.getOrientation();
DEBUG_SERIAL.println("IMU : "); DEBUG_SERIAL.print(" w : "); DEBUG_SERIAL.println(quat[0]); DEBUG_SERIAL.print(" x : "); DEBUG_SERIAL.println(quat[1]); DEBUG_SERIAL.print(" y : "); DEBUG_SERIAL.println(quat[2]); DEBUG_SERIAL.print(" z : "); DEBUG_SERIAL.println(quat[3]);
DEBUG_SERIAL.println("---------------------------------------"); DEBUG_SERIAL.println("DYNAMIXELS"); DEBUG_SERIAL.println("---------------------------------------"); DEBUG_SERIAL.println("Torque : " + String(motor_driver.getTorque()));
int32_t encoder[WHEEL_NUM] = {0, 0}; motor_driver.readEncoder(encoder[LEFT], encoder[RIGHT]);
DEBUG_SERIAL.println("Encoder(left) : " + String(encoder[LEFT])); DEBUG_SERIAL.println("Encoder(right) : " + String(encoder[RIGHT]));
DEBUG_SERIAL.println("---------------------------------------");
DEBUG_SERIAL.println("TurtleBot3");
DEBUG_SERIAL.println("---------------------------------------");
DEBUG_SERIAL.println("Odometry : ");
DEBUG_SERIAL.print(" x : "); DEBUG_SERIAL.println(odom_pose[0]);
DEBUG_SERIAL.print(" y : "); DEBUG_SERIAL.println(odom_pose[1]);
DEBUG_SERIAL.print(" theta : "); DEBUG_SERIAL.println(odom_pose[2]);
}
Here is the "turtlebot3_core_config" program as well...
// #define NOETIC_SUPPORT //uncomment this if writing code for ROS1 Noetic
// #define DEBUG
// Callback function prototypes void commandVelocityCallback(const geometry_msgs::Twist& cmd_vel_msg); void soundCallback(const turtlebot3_msgs::Sound& sound_msg); void motorPowerCallback(const std_msgs::Bool& power_msg); void resetCallback(const std_msgs::Empty& reset_msg);
// Function prototypes void publishCmdVelFromRC100Msg(void); void publishImuMsg(void); void publishMagMsg(void); void publishSensorStateMsg(void); void publishVersionInfoMsg(void); void publishBatteryStateMsg(void); void publishDriveInformation(void); void publishIlluminanceMsg(void);
ros::Time rosNow(void); ros::Time addMicros(ros::Time & t, uint32_t _micros); // deprecated
void updateVariable(bool isConnected); void updateMotorInfo(int32_t left_tick, int32_t right_tick); void updateTime(void); void updateOdometry(void); void updateJoint(void); void updateTF(geometry_msgs::TransformStamped& odom_tf); void updateGyroCali(bool isConnected); void updateGoalVelocity(void); void updateTFPrefix(bool isConnected); void illumCallback(const sensor_msgs::Illuminance& illum_msg); void illuminanceCallback(const sensor_msgs::Illuminance& illuminance_msg);
void initOdom(void); void initJointStates(void);
bool calcOdometry(double diff_time);
void sendLogMsg(void); void waitForSerialLink(bool isConnected);
/***
/***
char odom_header_frame_id[30]; char odom_child_frame_id[30];
char imu_frame_id[30]; char mag_frame_id[30];
char joint_state_header_frame_id[30];
/***
ros::Subscriber
ros::Subscriber
ros::Subscriber
ros::Subscriber
/***
// Version information of Turtlebot3 turtlebot3_msgs::VersionInfo version_info_msg; ros::Publisher version_info_pub("firmware_version", &version_info_msg);
// IMU of Turtlebot3 sensor_msgs::Imu imu_msg; ros::Publisher imu_pub("imu", &imu_msg);
// Command velocity of Turtlebot3 using RC100 remote controller geometry_msgs::Twist cmd_vel_rc100_msg; ros::Publisher cmd_vel_rc100_pub("cmd_vel_rc100", &cmd_vel_rc100_msg);
// Odometry of Turtlebot3 nav_msgs::Odometry odom; ros::Publisher odom_pub("odom", &odom);
// Joint(Dynamixel) state of Turtlebot3 sensor_msgs::JointState joint_states; ros::Publisher joint_states_pub("joint_states", &joint_states);
// Battey state of Turtlebot3
sensor_msgs::BatteryStateNoetic battery_state_msg;
sensor_msgs::BatteryState battery_state_msg;
ros::Publisher battery_state_pub("battery_state", &battery_state_msg);
// Magnetic field sensor_msgs::MagneticField mag_msg; ros::Publisher mag_pub("magnetic_field", &mag_msg);
// Illuminance sensor_msgs::Illuminance illum_msg; ros::Publisher Illuminance_pub("sensor_msgs", &illum_msg); /***
/***
/***
/***
/***
/***
/***
/***
/***
/***
And here are the two error messages I have received when I ran these programs using the bringup section of the e-manual
[ERROR] [1684249611.399670]: Creation of publisher failed: Checksum does not match: 4ddae7f048e32fda22cac764685e3974,476f837fa6771f6e16e3bf4ef96f8770
[ERROR] [1684249614.437176]: Tried to publish before configured, topic id 131
Hey did you get a solution?
If Arduino OpenCR package version is not the latest, you may get the Checksum error. Make sure to update the OpenCR package to the latest (1.5.2) and see if this fixes the Checksum issue.
Sorry, I have the same error. Where is the latest OpenCR-Binaries package for turtlebot3 ROS1. I used this one, https://github.com/ROBOTIS-GIT/OpenCR-Binaries/raw/master/turtlebot3/ROS1/latest/opencr_update.tar.bz2
update: My error because of I use: $ export OPENCR_MODEL=waffle But if I use (the same with tutorials) it solve the error: $ export OPENCR_MODEL=waffle_noetic
ISSUE TEMPLATE ver. 0.4.0
Which TurtleBot3 platform do you use?
Which ROS is working with TurtleBot3?
Which SBC(Single Board Computer) is working on TurtleBot3?
Which OS you installed on SBC?
Which OS you installed on Remote PC?
Specify the software and firmware version(Can be found from Bringup messages)
Specify the commands or instructions to reproduce the issue.
Copy and Paste the error messages on terminal.
SUMMARY PARAMETERS
/rosdistro: noetic /rosversion: 1.15.11 /turtlebot3_core/baud: 115200 /turtlebot3_core/port: /dev/ttyACM0 /turtlebot3_core/tf_prefix: /turtlebot3_lds/frame_id: base_scan NODES / turtlebot3_core (rosserial_python/serial_node.py) turtlebot3_diagnostics (turtlebot3_bringup/turtlebot3_diagnostics) turtlebot3_lds (ld08_driver/ld08_driver)
ROS_MASTER_URI=http://192.168.0.196:11311/
process[turtlebot3_core-1]: started with pid [2244] process[turtlebot3_lds-2]: started with pid [2245] process[turtlebot3_diagnostics-3]: started with pid [2246] /dev/ttyACM0 OpenCR Virtual ComPort in FS Mode /dev/ttyUSB0 CP2102 USB to UART Bridge Controller FOUND LiDAR_LD08 @port :/dev/ttyUSB0 [INFO] [1683900507.010733]: ROS Serial Python Node [INFO] [1683900507.050099]: Connecting to /dev/ttyACM0 at 115200 baud [INFO] [1683900509.170383]: Requesting topics… [INFO] [1683900509.360679]: Note: publish buffer size is 1024 bytes [INFO] [1683900509.368741]: Setup publisher on sensor_state [turtlebot3_msgs/SensorState] [INFO] [1683900509.386934]: Setup publisher on firmware_version [turtlebot3_msgs/VersionInfo] [INFO] [1683900509.769946]: Setup publisher on imu [sensor_msgs/Imu] [INFO] [1683900509.788884]: Setup publisher on cmd_vel_rc100 [geometry_msgs/Twist] [INFO] [1683900509.928308]: Setup publisher on odom [nav_msgs/Odometry] [INFO] [1683900509.947655]: Setup publisher on joint_states [sensor_msgs/JointState] [ERROR] [1683900509.959059]: Creation of publisher failed: Checksum does not match: 4ddae7f048e32fda22cac764685e3974,476f837fa6771f6e16e3bf4ef96f8770 [INFO] [1683900509.976326]: Setup publisher on magnetic_field [sensor_msgs/MagneticField] [INFO] [1683900509.994108]: Setup publisher on illuminance [sensor_msgs/Illuminance] [INFO] [1683900510.575230]: Setup publisher on /tf [tf/tfMessage] [INFO] [1683900510.600442]: Note: subscribe buffer size is 1024 bytes [INFO] [1683900510.608574]: Setup subscriber on cmd_vel [geometry_msgs/Twist] [INFO] [1683900510.632532]: Setup subscriber on sound [turtlebot3_msgs/Sound] [INFO] [1683900510.657214]: Setup subscriber on motor_power [std_msgs/Bool] [INFO] [1683900510.799895]: Setup subscriber on reset [std_msgs/Empty] [INFO] [1683900510.827401]: Setup subscriber on illuminance_topic [sensor_msgs/Illuminance] [INFO] [1683900512.516045]: Setup TF on Odometry [odom] [INFO] [1683900512.527190]: Setup TF on IMU [imu_link] [INFO] [1683900512.537803]: Setup TF on MagneticField [mag_link] [INFO] [1683900512.548656]: Setup TF on JointState [base_link] [ERROR] [1683900512.622545]: Tried to publish before configured, topic id 131 [INFO] [1683900512.630870]: Requesting topics… [INFO] [1683900515.182262]: Calibration End [INFO] [1683900515.281515]: Setup publisher on sensor_state [turtlebot3_msgs/SensorState] [INFO] [1683900515.293434]: Setup publisher on firmware_version [turtlebot3_msgs/VersionInfo] [INFO] [1683900515.304815]: Setup publisher on imu [sensor_msgs/Imu] [INFO] [1683900515.315969]: Setup publisher on cmd_vel_rc100 [geometry_msgs/Twist] [INFO] [1683900515.327994]: Setup publisher on odom [nav_msgs/Odometry] [INFO] [1683900515.339780]: Setup publisher on joint_states [sensor_msgs/JointState] [ERROR] [1683900515.351288]: Creation of publisher failed: Checksum does not match: 4ddae7f048e32fda22cac764685e3974,476f837fa6771f6e16e3bf4ef96f8770 [INFO] [1683900515.362460]: Setup publisher on magnetic_field [sensor_msgs/MagneticField] [INFO] [1683900515.373108]: Setup publisher on illuminance [sensor_msgs/Illuminance] [INFO] [1683900515.388594]: Setup publisher on /tf [tf/tfMessage] [ERROR] [1683900515.414794]: Tried to publish before configured, topic id 131 [INFO] [1683900515.423299]: Requesting topics… [ERROR] [1683900515.500528]: Tried to publish before configured, topic id 131 [INFO] [1683900515.508704]: Requesting topics… [ERROR] [1683900515.606293]: Tried to publish before configured, topic id 131 [INFO] [1683900515.614474]: Requesting topics… [ERROR] [1683900515.712783]: Tried to publish before configured, topic id 131 [INFO] [1683900515.721219]: Requesting topics… [ERROR] [1683900515.817456]: Tried to publish before configured, topic id 131 [INFO] [1683900515.826375]: Requesting topics… [ERROR] [1683900515.924927]: Tried to publish before configured, topic id 131 [INFO] [1683900515.933353]: Requesting topics… [ERROR] [1683900516.029583]: Tried to publish before configured, topic id 131 [INFO] [1683900516.038178]: Requesting topics… [ERROR] [1683900516.136255]: Tried to publish before configured, topic id 131 [INFO] [1683900516.144432]: Requesting topics… [ERROR] [1683900516.242981]: Tried to publish before configured, topic id 131 [INFO] [1683900516.255962]: Requesting topics… [ERROR] [1683900516.349010]: Tried to publish before configured, topic id 131 [INFO] [1683900516.359220]: Requesting topics… [ERROR] [1683900516.454101]: Tried to publish before configured, topic id 131 [INFO] [1683900516.462500]: Requesting topics… [ERROR] [1683900516.560683]: Tried to publish before configured, topic id 131 [INFO] [1683900516.569119]: Requesting topics… [ERROR] [1683900516.666463]: Tried to publish before configured, topic id 131 [INFO] [1683900516.675929]: Requesting topics… [ERROR] [1683900516.772262]: Tried to publish before configured, topic id 131 [INFO] [1683900516.780741]: Requesting topics… [ERROR] [1683900516.878323]: Tried to publish before configured, topic id 131 [INFO] [1683900516.886464]: Requesting topics… [ERROR] [1683900516.983977]: Tried to publish before configured, topic id 131 [INFO] [1683900516.992582]: Requesting topics… [ERROR] [1683900517.090626]: Tried to publish before configured, topic id 131 [INFO] [1683900517.099993]: Requesting topics… [ERROR] [1683900517.195957]: Tried to publish before configured, topic id 131 [INFO] [1683900517.204731]: Requesting topics… [ERROR] [1683900517.302357]: Tried to publish before configured, topic id 131 [INFO] [1683900517.311394]: Requesting topics… [ERROR] [1683900517.409309]: Tried to publish before configured, topic id 131 [INFO] [1683900517.417980]: Requesting topics… [ERROR] [1683900517.514630]: Tried to publish before configured, topic id 131 [INFO] [1683900517.522785]: Requesting topics… [ERROR] [1683900517.620395]: Tried to publish before configured, topic id 131 [INFO] [1683900517.628755]: Requesting topics… [ERROR] [1683900517.726996]: Tried to publish before configured, topic id 131 [INFO] [1683900517.736757]: Requesting topics… [ERROR] [1683900517.832256]: Tried to publish before configured, topic id 131 [INFO] [1683900517.841942]: Requesting topics… [ERROR] [1683900517.938394]: Tried to publish before configured, topic id 131 [INFO] [1683900517.946741]: Requesting topics… [ERROR] [1683900518.044103]: Tried to publish before configured, topic id 131 [INFO] [1683900518.052497]: Requesting topics… [ERROR] [1683900518.150921]: Tried to publish before configured, topic id 131 [INFO] [1683900518.159199]: Requesting topics… [ERROR] [1683900518.256355]: Tried to publish before configured, topic id 131 [INFO] [1683900518.268796]: Requesting topics… [ERROR] [1683900518.363236]: Tried to publish before configured, topic id 131 [INFO] [1683900518.372053]: Requesting topics… [ERROR] [1683900518.468915]: Tried to publish before configured, topic id 131 [INFO] [1683900518.477276]: Requesting topics… [ERROR] [1683900518.575635]: Tried to publish before configured, topic id 131 [INFO] [1683900518.583779]: Requesting topics… [ERROR] [1683900518.681004]: Tried to publish before configured, topic id 131 [INFO] [1683900518.688285]: Requesting topics… [ERROR] [1683900518.788034]: Tried to publish before configured, topic id 131 [INFO] [1683900518.796459]: Requesting topics… [ERROR] [1683900518.892877]: Tried to publish before configured, topic id 131 [INFO] [1683900518.901203]: Requesting topics… [ERROR] [1683900518.999357]: Tried to publish before configured, topic id 131 [INFO] [1683900519.007996]: Requesting topics… [ERROR] [1683900519.105942]: Tried to publish before configured, topic id 131 [INFO] [1683900519.114193]: Requesting topics… [ERROR] [1683900519.210918]: Tried to publish before configured, topic id 131 [INFO] [1683900519.219976]: Requesting topics… [ERROR] [1683900519.317809]: Tried to publish before configured, topic id 131 [INFO] [1683900519.325730]: Requesting topics… [ERROR] [1683900519.423393]: Tried to publish before configured, topic id 131 [INFO] [1683900519.431180]: Requesting topics… [ERROR] [1683900519.528815]: Tried to publish before configured, topic id 131 [INFO] [1683900519.537341]: Requesting topics… [ERROR] [1683900519.635484]: Tried to publish before configured, topic id 131 [INFO] [1683900519.643493]: Requesting topics… [ERROR] [1683900519.741331]: Tried to publish before configured, topic id 131 [INFO] [1683900519.750513]: Requesting topics… [ERROR] [1683900519.847476]: Tried to publish before configured, topic id 131 [INFO] [1683900519.856041]: Requesting topics… [ERROR] [1683900519.953346]: Tried to publish before configured, topic id 131 [INFO] [1683900519.961526]: Requesting topics… [ERROR] [1683900520.059836]: Tried to publish before configured, topic id 131 [INFO] [1683900520.068238]: Requesting topics… [ERROR] [1683900520.166660]: Tried to publish before configured, topic id 131 [INFO] [1683900520.175626]: Requesting topics… [ERROR] [1683900520.271887]: Tried to publish before configured, topic id 131 [INFO] [1683900520.280701]: Requesting topics… [ERROR] [1683900520.378589]: Tried to publish before configured, topic id 131 [INFO] [1683900520.387222]: Requesting topics… [ERROR] [1683900520.484359]: Tried to publish before configured, topic id 131 [INFO] [1683900520.493086]: Requesting topics… [ERROR] [1683900520.590338]: Tried to publish before configured, topic id 131 [INFO] [1683900520.601810]: Requesting topics… [ERROR] [1683900520.696205]: Tried to publish before configured, topic id 131 [INFO] [1683900520.707582]: Requesting topics… [ERROR] [1683900520.803065]: Tried to publish before configured, topic id 131 [INFO] [1683900520.811908]: Requesting topics… [ERROR] [1683900520.908197]: Tried to publish before configured, topic id 131 [INFO] [1683900520.916443]: Requesting topics… [ERROR] [1683900521.014306]: Tried to publish before configured, topic id 131 [INFO] [1683900521.022191]: Requesting topics… [ERROR] [1683900521.121219]: Tried to publish before configured, topic id 131 [INFO] [1683900521.129365]: Requesting topics… [ERROR] [1683900521.227399]: Tried to publish before configured, topic id 131 [INFO] [1683900521.235855]: Requesting topics… [ERROR] [1683900521.333848]: Tried to publish before configured, topic id 131 [INFO] [1683900521.341993]: Requesting topics… [ERROR] [1683900521.439842]: Tried to publish before configured, topic id 131 [INFO] [1683900521.448417]: Requesting topics… [ERROR] [1683900521.546689]: Tried to publish before configured, topic id 131 [INFO] [1683900521.556238]: Requesting topics… [ERROR] [1683900521.651885]: Tried to publish before configured, topic id 131 [INFO] [1683900521.660089]: Requesting topics… [ERROR] [1683900521.758190]: Tried to publish before configured, topic id 131 [INFO] [1683900521.766633]: Requesting topics… [ERROR] [1683900521.863825]: Tried to publish before configured, topic id 131 [INFO] [1683900521.872302]: Requesting topics… [ERROR] [1683900521.970611]: Tried to publish before configured, topic id 131 [INFO] [1683900521.979039]: Requesting topics… [ERROR] [1683900522.075222]: Tried to publish before configured, topic id 131 [INFO] [1683900522.085348]: Requesting topics… [ERROR] [1683900522.182034]: Tried to publish before configured, topic id 131 [INFO] [1683900522.191419]: Requesting topics… [ERROR] [1683900522.287741]: Tried to publish before configured, topic id 131 [INFO] [1683900522.296138]: Requesting topics… ^C[turtlebot3_diagnostics-3] killing on exit [turtlebot3_lds-2] killing on exit [turtlebot3_core-1] killing on exit [INFO] [1683900522.375562]: Sending tx stop request [INFO] [1683900522.383736]: shutdown hook activated ^C[turtlebot3_lds-2] escalating to SIGTERM
I am currently unable to use the Roslaunch command with the current turtlebot_core program that I have. Is there any way I could fix this issue? I was thinking it may have something to do with the program itself, but I am not too sure...