O'Reilly logo

Robot Operating System Cookbook by Kumar Bipin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Getting ready

Like we did in the previous section, we can create each example program in the ROS packages in our workspace individually in the robot_description/src folder with the names mobile_state_publisher.cpp and arm_state_publisher.cpp, or copy them from the chapter6_tutorials packages on GitHub.

The mobile_state_publisher.cpp package should include the following code:

#include <string> #include <ros/ros.h> #include <sensor_msgs/JointState.h> #include <tf/transform_broadcaster.h> int main(int argc, char** argv) { ros::init(argc, argv, "mobile_state_publisher"); ros::NodeHandle n; tf::TransformBroadcaster broadcaster; ros::Publisher joint_pub = n.advertise<sensor_msgs::JointState>("joint_states", 1); ros::Rate loop_rate(30); const double ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required