I have written a urdf file for my differential drive mobile robot an want to make it move on rviz. I'm doing the tutorials on the book "Learning ROS for Robotic Programming" and used the codes and examples there, modifying them for myself.
So here is the urdf code;
This is the broadcaster code:
#include
#include
#include
int main(int argc, char** argv) {
ros::init(argc, argv, "tf_broadcaster");
ros::NodeHandle n;
tf::TransformBroadcaster broadcaster;
ros::Rate loop_rate(30);
double angle= 0;
// message declarations
geometry_msgs::TransformStamped odom_trans;
odom_trans.header.frame_id = "odom";
odom_trans.child_frame_id = "base_link";
while (ros::ok()) {
// (moving in a circle with radius 1)
odom_trans.header.stamp = ros::Time::now();
odom_trans.transform.translation.x = cos(angle);
odom_trans.transform.translation.y = sin(angle);
odom_trans.transform.translation.z = 0.0;
odom_trans.transform.rotation = tf::createQuaternionMsgFromYaw(angle);
//send transform
broadcaster.sendTransform(odom_trans);
loop_rate.sleep();
}
return 0;
}
I launch the urdf on rviz and the node, but I get the problem as;
No transform from [wheel_1] to [/base_link]
No transform from [wheel_2] to [/base_link]
I'm not very experienced on ROS and TF and couldn't figure out why there is no transform between two links, isn't urdf is for that?
↧