Revision dd5d7f53
Converted back to msgs, before pushing to roboclub VCS
turtlesim_ref/tutorials/draw_square.cpp | ||
---|---|---|
1 | 1 |
#include <boost/bind.hpp> |
2 | 2 |
#include <ros/ros.h> |
3 |
#include <turtlesim/Pose.h> |
|
4 |
#include <turtlesim/Velocity.h> |
|
3 |
#include <turtlesim_ref/Pose.h>
|
|
4 |
#include <turtlesim_ref/Velocity.h>
|
|
5 | 5 |
#include <std_srvs/Empty.h> |
6 | 6 |
|
7 |
turtlesim::PoseConstPtr g_pose; |
|
8 |
turtlesim::Pose g_goal; |
|
7 |
turtlesim_ref::PoseConstPtr g_pose;
|
|
8 |
turtlesim_ref::Pose g_goal;
|
|
9 | 9 |
|
10 | 10 |
enum State |
11 | 11 |
{ |
... | ... | |
21 | 21 |
|
22 | 22 |
#define PI 3.141592 |
23 | 23 |
|
24 |
void poseCallback(const turtlesim::PoseConstPtr& pose) |
|
24 |
void poseCallback(const turtlesim_ref::PoseConstPtr& pose)
|
|
25 | 25 |
{ |
26 | 26 |
g_pose = pose; |
27 | 27 |
} |
... | ... | |
43 | 43 |
|
44 | 44 |
void commandTurtle(ros::Publisher vel_pub, float linear, float angular) |
45 | 45 |
{ |
46 |
turtlesim::Velocity vel; |
|
46 |
turtlesim_ref::Velocity vel;
|
|
47 | 47 |
vel.linear = linear; |
48 | 48 |
vel.angular = angular; |
49 | 49 |
vel_pub.publish(vel); |
... | ... | |
150 | 150 |
ros::init(argc, argv, "draw_square"); |
151 | 151 |
ros::NodeHandle nh; |
152 | 152 |
ros::Subscriber pose_sub = nh.subscribe("turtle1/pose", 1, poseCallback); |
153 |
ros::Publisher vel_pub = nh.advertise<turtlesim::Velocity>("turtle1/command_velocity", 1); |
|
153 |
ros::Publisher vel_pub = nh.advertise<turtlesim_ref::Velocity>("turtle1/command_velocity", 1);
|
|
154 | 154 |
ros::ServiceClient reset = nh.serviceClient<std_srvs::Empty>("reset"); |
155 | 155 |
ros::Timer timer = nh.createTimer(ros::Duration(0.016), boost::bind(timerCallback, _1, vel_pub)); |
156 | 156 |
|
Also available in: Unified diff