Skip to content

Commit

Permalink
Cleanup old code and uncommented tf odom publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
VincidaB committed Apr 26, 2024
1 parent abcbf40 commit 5ffa0d4
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 17 deletions.
1 change: 0 additions & 1 deletion src/ezbot_robot/config/omnidirectional_controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ omnidirectional_controller:

robot_radius: 0.25
wheel_radius: 0.06
gamma: 30.0 # angle between body fixed y axis and the normal of wheel3

publish_rate: 50.0
odom_frame_id: odom
Expand Down
4 changes: 2 additions & 2 deletions src/ezbot_simulation/launch/launch_sim.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,6 @@ def generate_launch_description():
spawn_entity,
rsp2,
spawn_entity2,
gazebo,
joystick
gazebo
#joystick
])
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,6 @@ class OmnidirectionalController : public controller_interface::ControllerInterfa
void velocityCommandStampedCallback(const geometry_msgs::msg::TwistStamped::SharedPtr cmd_vel);
void velocityCommandUnstampedCallback(const geometry_msgs::msg::Twist::SharedPtr cmd_vel);
geometry_msgs::msg::TwistStamped::SharedPtr cmd_vel_;
double cos_gamma{0};
double sin_gamma{0};

std::shared_ptr<rclcpp_lifecycle::LifecycleNode> node_;
};
Expand Down
26 changes: 14 additions & 12 deletions src/omnidirectional_controllers/src/omnidirectional_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ CallbackReturn OmnidirectionalController::on_init() {

auto_declare<double>("robot_radius", robot_params_.robot_radius);
auto_declare<double>("wheel_radius", robot_params_.wheel_radius);
auto_declare<double>("gamma", robot_params_.gamma);

auto_declare<std::string>("odom_frame_id", odom_params_.odom_frame_id);
auto_declare<std::string>("base_frame_id", odom_params_.base_frame_id);
Expand Down Expand Up @@ -130,8 +129,7 @@ CallbackReturn OmnidirectionalController::on_configure(

robot_params_.robot_radius = node_->get_parameter("robot_radius").as_double();
robot_params_.wheel_radius = node_->get_parameter("wheel_radius").as_double();
robot_params_.gamma = node_->get_parameter("gamma").as_double();
robot_params_.gamma = DEG2RAD(robot_params_.gamma);


omni_robot_kinematics_.setRobotParams(robot_params_);
odometry_.setRobotParams(robot_params_);
Expand Down Expand Up @@ -477,15 +475,19 @@ controller_interface::return_type OmnidirectionalController::update(
odometry_publisher_->publish(odometry_message_);
}

// if (odom_params_.enable_odom_tf) {
// odometry_transform_message_.header.stamp = current_time;
// odometry_transform_message_.transform.translation.x = odometry_.getPose().x;
// odometry_transform_message_.transform.translation.y = odometry_.getPose().y;
// odometry_transform_message_.transform.rotation.x = orientation.x();
// odometry_transform_message_.transform.rotation.y = orientation.y();
// odometry_transform_message_.transform.rotation.z = orientation.z();
// odometry_transform_message_.transform.rotation.w = orientation.w();
// }
if (odom_params_.enable_odom_tf) {

auto & transform = odometry_transform_message_.transforms.front();
transform.header.stamp = current_time;
transform.transform.translation.x = odometry_.getPose().x;
transform.transform.translation.y = odometry_.getPose().y;
transform.transform.rotation.x = orientation.x();
transform.transform.rotation.y = orientation.y();
transform.transform.rotation.z = orientation.z();
transform.transform.rotation.w = orientation.w();

odometry_transform_publisher_->publish(odometry_transform_message_);
}

auto & last_command = previous_commands_.back().twist;
auto & second_to_last_command = previous_commands_.front().twist;
Expand Down

0 comments on commit 5ffa0d4

Please sign in to comment.