ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Commander Data's profile - activity

2018-02-09 23:57:19 -0500 received badge  Student (source)
2016-07-29 21:19:04 -0500 received badge  Famous Question (source)
2016-07-29 21:19:04 -0500 received badge  Notable Question (source)
2016-02-21 10:28:41 -0500 received badge  Notable Question (source)
2016-02-02 06:43:04 -0500 commented answer working with Markers

the x coordinate is NOT constant!

2016-02-02 04:09:37 -0500 received badge  Famous Question (source)
2016-02-02 03:33:46 -0500 received badge  Supporter (source)
2016-01-21 22:01:44 -0500 received badge  Notable Question (source)
2016-01-21 15:58:01 -0500 answered a question working with Markers

Hi Jorge,

actually, I would like to receive what the programme "points_and_lines.cpp" (from the mentioned tutorial) publishes.

As you can see in the source code of this programme, the coordinates are changing. Here is the section, which explains the change of the coordinates:

// Create the vertices for the points and lines
for (uint32_t i = 0; i < 100; ++i)
{
  float y = 5 * sin(f + i / 100.0f * 2 * M_PI);
  float z = 5 * cos(f + i / 100.0f * 2 * M_PI);

  geometry_msgs::Point p;
  p.x = (int32_t)i - 50;
  p.y = y;
  p.z = z;

  points.points.push_back(p);
  line_strip.points.push_back(p);

  // The line list needs two points for each line
  line_list.points.push_back(p);
  p.z += 1.0;
  line_list.points.push_back(p);
}

For the moment, let us try to receive only the x-coordinate.

The printout should be like this:

I received: -50
I received: -49
I received: -48
..... and so on .....

When I try your code, I get, as you described, only the same message over and over again:

I received: 49
I received: 49
I received: 49
I received: 49

Therefore, I tried this line of code, instead of yours:

std::cout << "I received: " << msg->points[0] << std::endl;

But then I receive:

I received: x: -50
y: 4.11811
z: 2.83569

I received: x: -50
y: 4.11811
z: 2.83569

I received: x: -50
y: 4.22832
z: 2.66858

I received: x: -50
y: 4.22832
z: 2.66858

I cannot explain, why I am getting the same value of x and why y and z are getting printed on the terminal at all. This is absolutely not what I want. I only want to work with the different x-coordinates.

Has somebody an idea, how to receive the different x-coordinates?

With best regards Commander Data

2016-01-21 10:30:16 -0500 received badge  Popular Question (source)
2016-01-21 05:38:24 -0500 received badge  Editor (source)
2016-01-20 12:06:47 -0500 asked a question working with Markers

The solution of my problem is beneath.

Hi guys,

before I posted this question, I did this tutorial about markers: http://wiki.ros.org/rviz/Tutorials/Ma... (Thank you for this tutorial!)

It worked pretty well! I understood how to change the value of the coordinates x,y, and z and how to publish points. Publishing points is no problem anymore.

Now, I would like to program a "listener", which receives exactly these points and print them out.

Unfortunately, I "only" found this tutorial: http://wiki.ros.org/ROS/Tutorials/Wri...

Therefore, I began with writing this "listener":

#include "ros/ros.h"
#include "std_msgs/String.h"
#include "std_msgs/Int8.h"

#include <algorithm>
#include <iostream> 
#include <string> 
#include <unistd.h>  
#include <termios.h>
#include <cmath>

#include <visualization_msgs/Marker.h>


void chatterCallback(const visualization_msgs::Marker::ConstPtr& msg)
{
   std::cout << "I received: " << msg->p.x << std::endl;
}

int main(int argc, char **argv)
{

  ros::init(argc, argv, "listener");
  ros::NodeHandle n;
  ros::Subscriber sub = n.subscribe("visualization_marker", 1000, chatterCallback); 

  ros::spin();   


  return 0;
}

Unfortunately, it didn't work out at all.

Can someone please help me solving the problem?

I would like to know how I can receive the coordinates and work with them. For instance:

sum = x+y+z;
ROS_INFO("The sum of a point with the coordinates x: [%d], y: [%d] and z: [%d] is : [%d]", p.x, p.y, p.z, sum);

With best regards Commander Data

SOLUTION:

The chatterCallback function needs to look like this:

void chatterCallback(const visualization_msgs::Marker::ConstPtr& msg)
{
    for (int i = 0; i <= number_of_points; i=i+1) {
         std::cout << "I received: " << msg->points[i].x << std::endl;
    }
}

Moreover, I changed in points_and_lines.cpp the line 93 for (uint32_t i = 0; i < 100; ++i) to for (int i = 0; i < 100; ++i).

I hope that this will help some researches in receiving points!

For everyone, who participate in finding the solution: THANK YOU A LOT!!!

With best regards, Commander Data

2015-11-03 16:38:17 -0500 received badge  Popular Question (source)
2015-11-03 16:38:17 -0500 received badge  Popular Question (source)
2015-10-26 17:11:57 -0500 received badge  Popular Question (source)
2015-10-04 13:51:52 -0500 asked a question problem at modifiying a map

Hello,

at the moment I am trying to get through the turtlebot tutorial. http://wiki.ros.org/turtlebot_stage/T... Unfortunately, I am stuck at this point:

Now simply start the simulator and rviz up with following line:

roslaunch turtlebot_stage stage_tutorial.launch map_file:="~/stageTutorial/tutorial.yaml" world_file:="~/stageTutorial/tutorial.world"

I entered:

roslaunch turtlebot_stage stage_tutorial.launch map_file:="/home/myusername/stageTutorial/tutorial.yaml" world_file:="/home/myusername/stageTutorial/tutorial.world"

and I received this:

[stage_tutorial.launch] is neither a launch file in package [turtlebot_stage] nor is [turtlebot_stage] a launch file name The traceback for the exception was written to the log file

The files are in the folder: /home/myusername/stageTutorial

With roslaunch turtlebot_stage turtlebot_in_stage.launch the simulator appears.

Can you please help me to rviz up the files?

With best regards

2015-10-03 10:32:52 -0500 asked a question turtlebot packages could't be found

Hello,

I would like to install turtlebot on my Ubuntu 14.04.3 LTS. After installing ROS, I entered the following code into the terminal:

sudo apt-get install ros-indigo-turtlebot ros-indigo-turtlebot-apps ros-indigo-turtlebot-interactions ros-indigo-turtlebot-simulator ros-indigo-kobuki-ftdi ros-indigo-rocon-remocon ros-indigo-rocon-qt-library ros-indigo-ar-track-alvar-msgs

And I received this reply:

E: package ros-indigo-turtlebot could't be found.
E: package ros-indigo-turtlebot-apps could't be found.
E: package ros-indigo-turtlebot-interactions could't be found.
E: package ros-indigo-turtlebot-simulator could't be found.
E: package ros-indigo-kobuki-ftdi could't be found.
E: package ros-indigo-rocon-remocon could't be found.
E: package ros-indigo-rocon-qt-library could't be found.
E: package ros-indigo-ar-track-alvar-msgs could't be found.

What do I need to do to install turtlebot?

With best regards

2015-10-03 10:32:51 -0500 asked a question Unable to install turtlebot

Hello,

I would like to install turtlebot on my Ubuntu 14.04.3 LTS. After installing ROS, I entered the following code into the terminal:

sudo apt-get install ros-indigo-turtlebot ros-indigo-turtlebot-apps ros-indigo-turtlebot-interactions ros-indigo-turtlebot-simulator ros-indigo-kobuki-ftdi ros-indigo-rocon-remocon ros-indigo-rocon-qt-library ros-indigo-ar-track-alvar-msgs

And I get this reply:

E: package ros-indigo-turtlebot could't be found. E: package ros-indigo-turtlebot-apps could't be found. E: package ros-indigo-turtlebot-interactions could't be found. E: package ros-indigo-turtlebot-simulator could't be found. E: package ros-indigo-kobuki-ftdi could't be found. E: package ros-indigo-rocon-remocon could't be found. E: package ros-indigo-rocon-qt-library could't be found. E: package ros-indigo-ar-track-alvar-msgs could't be found.

What do I need to do to install turtlebot?

With best regards