Project

General

Profile

Revision dd5d7f53

IDdd5d7f53f35da669816c1c93b173eed3bfa0e962
Parent 3f5aa522
Child 071e2c1c

Added by tahm over 10 years ago

Converted back to msgs, before pushing to roboclub VCS

View differences:

turtlesim_ref/tutorials/mimic.cpp
1 1
#include <ros/ros.h>
2
#include <turtlesim/Pose.h>
3
#include <turtlesim/Velocity.h>
2
#include <turtlesim_ref/Pose.h>
3
#include <turtlesim_ref/Velocity.h>
4 4

  
5 5
class Mimic
6 6
{
......
8 8
  Mimic();
9 9

  
10 10
private:
11
  void poseCallback(const turtlesim::PoseConstPtr& pose);
11
  void poseCallback(const turtlesim_ref::PoseConstPtr& pose);
12 12

  
13 13
  ros::Publisher vel_pub_;
14 14
  ros::Subscriber pose_sub_;
......
18 18
{
19 19
  ros::NodeHandle input_nh("input");
20 20
  ros::NodeHandle output_nh("output");
21
  vel_pub_ = output_nh.advertise<turtlesim::Velocity>("command_velocity", 1);
22
  pose_sub_ = input_nh.subscribe<turtlesim::Pose>("pose", 1, &Mimic::poseCallback, this);
21
  vel_pub_ = output_nh.advertise<turtlesim_ref::Velocity>("command_velocity", 1);
22
  pose_sub_ = input_nh.subscribe<turtlesim_ref::Pose>("pose", 1, &Mimic::poseCallback, this);
23 23
}
24 24

  
25
void Mimic::poseCallback(const turtlesim::PoseConstPtr& pose)
25
void Mimic::poseCallback(const turtlesim_ref::PoseConstPtr& pose)
26 26
{
27
  turtlesim::Velocity vel;
27
  turtlesim_ref::Velocity vel;
28 28
  vel.angular = pose->angular_velocity;
29 29
  vel.linear = pose->linear_velocity;
30 30
  vel_pub_.publish(vel);

Also available in: Unified diff