ros / common_tutorials

ROS common_tutorials stack migrated from https://code.ros.org/svn/ros-pkg/stacks/common_tutorials/branches/common_tutorials-0.1/
62 stars 59 forks source link

Ubuntu package ros-indigo-turtle-actionlib is based on a non-working shape_server.cpp source #10

Closed MartienLagerweij closed 9 years ago

MartienLagerweij commented 10 years ago

The ros-indigo-turtle-actionlib ubuntu package is built with the shape_server.cpp source of the master branch. That source however results in a non-working tutorial. Using a proper source from another branch will fix this. Here is the diff of my own patch:

--- shape_server.cpp.master 2014-04-16 02:13:10.000000000 +0200
+++ shape_server.cpp    2014-10-12 22:03:45.462655224 +0200
@@ -5,7 +5,7 @@
 #include <math.h>
 #include <angles/angles.h>

-#include <turtle_actionlib/Velocity.h>
+#include <geometry_msgs/Twist.h>
 #include <turtle_actionlib/ShapeAction.h>

 // This class computes the command_velocities of the turtle to draw regular polygons 
@@ -22,7 +22,7 @@

     //subscribe to the data topic of interest
     sub_ = nh_.subscribe("/turtle1/pose", 1, &ShapeAction::controlCB, this);
-    pub_ = nh_.advertise<turtle_actionlib::Velocity>("/turtle1/command_velocity", 1);
+    pub_ = nh_.advertise<geometry_msgs::Twist>("/turtle1/cmd_vel", 1);

     as_.start();
   }
@@ -85,25 +85,25 @@

       if (dis_error_ > error_tol)
       {
-        command_.linear = l_scale*dis_error_;
-        command_.angular = 0;
+        command_.linear.x = l_scale*dis_error_;
+        command_.angular.z = 0;
       }
       else if (dis_error_ < error_tol && fabs(theta_error_)> error_tol)
       { 
-        command_.linear = 0;
-        command_.angular = a_scale*theta_error_;
+        command_.linear.x = 0;
+        command_.angular.z = a_scale*theta_error_;
       }
       else if (dis_error_ < error_tol && fabs(theta_error_)< error_tol)
       {
-        command_.linear = 0;
-        command_.angular = 0;
+        command_.linear.x = 0;
+        command_.angular.z = 0;
         start_edge_ = true;
         edge_progress_++;
       }  
       else
       {
-        command_.linear = l_scale*dis_error_;
-        command_.angular = a_scale*theta_error_;
+        command_.linear.x = l_scale*dis_error_;
+        command_.angular.z = a_scale*theta_error_;
       } 
       // publish the velocity command
       pub_.publish(command_);
@@ -126,7 +126,7 @@
   double dis_error_, theta_error_;
   int edges_ , edge_progress_;
   bool start_edge_;
-  turtle_actionlib::Velocity command_;
+  geometry_msgs::Twist command_;
   turtle_actionlib::ShapeResult result_;
   ros::Subscriber sub_;
   ros::Publisher pub_;
wjwwood commented 10 years ago

Can you provide a link to the incorrect tutorial?

The master branch is out of date and shouldn't be used. I do not believe the debian for Indigo is being built from the master branch, I believe it based on the hydro-devel branch:

https://github.com/ros-gbp/common_tutorials-release/blob/master/tracks.yaml#L31

But should be built based on a version tag, right now it is this one:

https://github.com/ros/common_tutorials/tree/0.1.7

I think we will need some more details to know what problem you ran into and what the appropriate fix is to prevent others from running into.

MartienLagerweij commented 10 years ago

The tutorial is the one that this source belongs to: the turtle_actionlib. It is described here: http://wiki.ros.org/turtle_actionlib

When I started the tutorial. it didn't work. I then downloaded the source to my Ubuntu 14.04 PC (using the >apt-get source< command) and found that the source uses the wrong topic name (see the diff I provided, location @@ -22,7 +22,7 @@). The hydro-devel branch is indeed the one with the correct source, but it seems not being used for Ubuntu 14.04 at the moment.

The 0.1.7 tag you provided points to a source that also uses the wrong topic.

stonier commented 10 years ago

The 0.1.7 tag you provided points to a source that also uses the wrong topic.

The hydro-devel branch however does use the topic that you have in your diff.

The commit which matches your patch went in at 3d97b7be993943142ea0938d9323f23bbfa84532. This went in after 0.1.7.

Looks like it just needs a tagging and a re-release.

stonier commented 10 years ago

Indigo 0.1.8 release is in the pipeline.

wjwwood commented 9 years ago

I guess this was addressed? I'm going to close this issue, but if you still need help please comment here and I can reopen it.

stonier commented 9 years ago

:+1: