Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The end of the if-else condition for GAZEBO_MAJOR_VERSION >= 8 #1

Open
tmihiret opened this issue Aug 11, 2023 · 0 comments
Open

The end of the if-else condition for GAZEBO_MAJOR_VERSION >= 8 #1

tmihiret opened this issue Aug 11, 2023 · 0 comments

Comments

@tmihiret
Copy link

The if-else condition for evaluating expressions based on the Gazebo version ended before including the expression that needs to be conditioned based on the Gazebo version in the gazebo_ros_model_velocity.cpp file. The #endif on line 390 should be added after the expression that uses the math::Vector3 class. Below is the code snippet from the file.

...
#if (GAZEBO_MAJOR_VERSION >= 8)
      ignition::math::Pose3d pose = parent_->RelativePose();
      double yaw = pose.Rot().Yaw();
#else
      math::Pose pose = parent_->GetRelativePose();
      double yaw = pose.rot.GetYaw();
#endif
      double x_vel_cmd = cmd.linear.x * cos(yaw) + cmd.linear.y * sin(yaw);
      double y_vel_cmd = cmd.linear.x * sin(yaw) - cmd.linear.y * cos(yaw);

      parent_->SetLinearVel(math::Vector3(x_vel_cmd, y_vel_cmd, 0.0));
      parent_->SetAngularVel(math::Vector3(0.0, 0.0, cmd.angular.z));

      output_vel_pub_.publish(cmd);
      last_velocity_update_time_ = tnow;
    }
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant