Unit6 : total_distance calculation from grader bot

Hello @girishkumar.kannan , @bayodesegun

I am getting a feedback from gradebot for chapter 6 as below.
The total distance calcualted is not correct.

I am using odometry callbacks as below. Can you please tell me where i could look more for this item ? Thanks for your time in adv.

void odometry_callback(const nav_msgs::msg::Odometry::SharedPtr msg) {
double current_x = msg->pose.pose.position.x;
double current_y = msg->pose.pose.position.y;

if (last_x_ == 0.0 && last_y_ == 0.0) {
    last_x_ = current_x;
    last_y_ = current_y;
    return; 
}

double delta_x = current_x - last_x_;
double delta_y = current_y - last_y_;

double delta_distance = std::sqrt(delta_x * delta_x + delta_y * delta_y);

total_distance_ += delta_distance;

last_x_ = current_x;
last_y_ = current_y;
}

I am having a simulation loading issue with Unit 6 which is why it gives 0 for distance.
Unit 5 simulation gives me numbers correctly - please check the video below !!

Thanks,
Venkat

Hello @vadhrivenkat ,

Your code looks correct, and from the video you shared, it seems to be working as intended. Therefore, I believe the issue lies with the simulation. I tested the Unit simulation, and it appears to be working fine on my end. It’s possible that you encountered an isolated issue while trying to correct your quiz. I recommend resubmitting your quiz for revision and ensuring that the simulation is functioning as expected beforehand.

Best,

@vadhrivenkat
Adding to @albertoezquerro’s post above,

I have just changed the simulation to a faster one (the same one used in unit 5). Please try submitting again on unit 6, after the simulation has loaded.

Hello @albertoezquerro @bayodesegun
I can load the simulation now,
The bot is put into motion with the keyboard. ( or its equivalent by the grader bot ). The client submitted only submits the goal. is that the right understanding ? when i run the grader bot i dont see the robot moving in the background ( i got 8 pts - i crossed section - but just to keep you posted. )

Running independently in the console ( without grader bot ) - looks fine.

can you please confirm ?

Thanks,
Venkat

The robot only moves when checking distance calculation, and the robot position is reset afterward. Therefore, you may not have noticed the movement (I did check keenly and noticed it).

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.