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

Dio Eraclea's profile - activity

2018-04-12 07:32:48 -0500 received badge  Taxonomist
2018-03-01 12:10:29 -0500 received badge  Famous Question (source)
2018-03-01 12:10:29 -0500 received badge  Notable Question (source)
2018-03-01 12:10:29 -0500 received badge  Popular Question (source)
2018-02-15 09:17:10 -0500 marked best answer How to transfer numbers in messages?

Hi! I have a very simple problem, but I just cannot understand how to solve it. I need to transfer three coordinates between two nodes. One node is talker, which defines the coordinates and send it to other node, which is listener. Listener waits for the coordinates, make some operations with them and send it to navigation stack, which operates the robot in stage. I have read the tutorial about simple publisher and subscriber, but there the string is used and I just do not know, how to change it to float without problems. I tried to use ros services, but they do not create a topic, while working, also I was unable to make it normal working too. It seems to me, that after receiving the message, the program stuck in a callback sub-program and the main part of the program just cannot receive the data. I can be mistaken, as my knowledge in programming is too small. Below is the code of my node that I want to make the listener. Now I enter the coordinates when the node is started, but it is not convenient. I just want to know what I should add (and where) to make this none subscribed to some topic (for example "coordinates"), and being able to receive X, Y and Theta coordinates. The part of publisher node also would be useful for me. I would like to understand the principle. Help me please!


 #include "ros/ros.h"
 #include "move_base_msgs/MoveBaseAction.h"
 #include "actionlib/client/simple_action_client.h"
 #include "tf/transform_datatypes.h"

typedef actionlib::SimpleActionClient<move_base_msgs::movebaseaction> MoveBaseClient;

using namespace std;

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

if (argc < 2) {
    ROS_ERROR("You must specify leader robot id.");
    return -1;
}

if (argc < 3) {
    ROS_ERROR("You must specify X coordinate.");
    return -1;
}

if (argc < 4) {
    ROS_ERROR("You must specify Y coordinate.");
    return -1;
}

    //ROS_INFO(argv[2]);

char *robot_id = argv[1];

ros::init(argc, argv, "test_goals");
ros::NodeHandle nh;

    double goal_x, goal_y, goal_theta;
    if (!nh.getParam("goal_x", goal_x)){
    char *x = argv[2];
    goal_x = atof(x);}
if (!nh.getParam("goal_y", goal_y)){
    char *y = argv[3];
    goal_y = atof(y);}
if (!nh.getParam("goal_theta", goal_theta))
    goal_theta = 0;


// Create the string "robot_X/move_base"
string move_base_str = "/robot_";
move_base_str += robot_id;
move_base_str += "/move_base";

// create the action client
MoveBaseClient ac(move_base_str, true);

// Wait for the action server to become available
ROS_INFO("Waiting for the move_base action server");
ac.waitForServer(ros::Duration(5));

ROS_INFO("Connected to move base server");

// Send a goal to move_base
move_base_msgs::MoveBaseGoal goal;
goal.target_pose.header.frame_id = "map";
goal.target_pose.header.stamp = ros::Time::now();

goal.target_pose.pose.position.x = goal_x;//
goal.target_pose.pose.position.y = goal_y;//

// Convert the Euler angle to quaternion
double radians = goal_theta * (M_PI/180);//
tf::Quaternion quaternion;
quaternion = tf::createQuaternionFromYaw(radians);

geometry_msgs::Quaternion qMsg;
tf::quaternionTFToMsg(quaternion, qMsg);
goal.target_pose.pose.orientation = qMsg;

ROS_INFO("Sending goal to robot no. %s: x = %f, y = %f, theta = 0", robot_id, goal_x, goal_y);
ac.sendGoal(goal);

// Wait for the action to return
ac.waitForResult();

if (ac.getState() == actionlib::SimpleClientGoalState::SUCCEEDED)
    ROS_INFO("Robot ...
(more)
2017-09-04 07:30:49 -0500 received badge  Student (source)
2016-06-10 07:20:38 -0500 received badge  Famous Question (source)
2016-02-12 11:17:10 -0500 received badge  Popular Question (source)
2015-11-02 01:45:49 -0500 marked best answer [rospack] Error: stack/package stage_ros not found; in ROS Fuerte, Ubuntu 12.04

Hi, all. I am very new to ROS and Ubuntu. I am working under Ubuntu 12.04 with ROS Fuerte. I was trying to make teleop_base tutorial with stage (Simulating one robot). After the teleop_base installation I tried to run:

$ rosrun stage_ros stageros $(rospack find stage_ros)/world/willow-erratic.world

And I have got this error:

[rospack] Error: stack/package stage_ros not found [rospack] Error: stack/package stage_ros not found

I was trying to find out how solve it in the internet (I assume, that I need to install stage_ros), but I did not find anything useful. At least anything that I can understand and use (as I am newbie). Please help me!

2015-10-23 15:08:39 -0500 received badge  Famous Question (source)
2015-10-23 15:08:39 -0500 received badge  Popular Question (source)
2015-10-23 15:08:39 -0500 received badge  Notable Question (source)
2015-10-21 05:39:15 -0500 received badge  Famous Question (source)
2015-09-29 01:38:59 -0500 commented answer There is no move_base node in move_base package

Actually, I do not remember exactly what I did. After that problem I reinstalled Ubuntu several times on different machines and I never got this problem again. I think, that you should look at setting catkin workspace tutorial on roswiki

2015-09-29 01:38:59 -0500 received badge  Commentator
2015-06-29 07:15:42 -0500 received badge  Famous Question (source)
2015-06-29 07:15:42 -0500 received badge  Popular Question (source)
2015-06-29 07:15:42 -0500 received badge  Notable Question (source)
2015-06-21 03:00:22 -0500 marked best answer Can I move built package frome one machine to other?

Hi! I have a problem with working in a virtual machine of ROS Electric, which is running on Ubuntu 10.04. It does not want to compile any nodes, written in C++ code. So I wonder if I can create the nodes in some other virtual machine where there are no problems in C++ compilation and then just move it back to Electric?

2015-06-21 02:55:21 -0500 received badge  Notable Question (source)
2015-06-21 02:52:53 -0500 marked best answer There is no move_base node in move_base package

Hi! I am trying to launch move_base, but I am getting such messages:

  1. when launching it through launch file:
    ERROR: cannot launch node of type [move_base/move_base]: can't locate node [move_base] in package [move_base]
  2. when launching it by rosrun:
    [rosrun] Couldn't find executable named move_base below /opt/ros/indigo/share/move_base [rosrun] Found the following, but they're either not files, [rosrun] or not executable: [rosrun] /opt/ros/indigo/share/move_base The system sees the package move_base, but there is no nodes in it. Other packages and nodes of navigation stack work fine. I use Ubuntu 14.04 virtual machine with ROS Indigo. I installed navigation stack with sudo apt-get install ros-indigo-navigation. My ROS_PACKAGE_PATH is /home/viki/catkin_ws/src:/opt/ros/indigo/share:/opt/ros/indigo/stacks I am very new to ROS, so I have no idea what caused the problem. Please, help me!
2015-06-20 06:52:43 -0500 received badge  Famous Question (source)
2015-06-10 12:21:31 -0500 commented answer Navigation with real robot

Yes, I want my robot to move through a map.

2015-06-10 03:07:59 -0500 commented answer Navigation with real robot

As I understand, my mistake is trying to use fake_localization for real robot. This package can only be used for simulation. I know that for real robots, amcl package is used. But if I understand it correctly, amcl needs laser for work, and I do not have it. What should I use?

2015-06-10 03:03:58 -0500 commented answer Navigation with real robot

I have already understood that my problem is with localization. I figured out that if I run stage_ros and fake_localization with simulation settings, my navigation will run with the robot. The problem is that it thinks, that robot is not moving (if you will not move it manually in stage_ros).

2015-06-10 02:57:23 -0500 received badge  Notable Question (source)
2015-06-05 13:34:11 -0500 received badge  Famous Question (source)
2015-06-05 06:26:44 -0500 commented question Navigation with real robot

Sorry, I tried it in different way, by using several launch files and now it is really giving me errors. Something like Waiting on transform from gripper/base to map to become available before running costmap, tf error;

2015-06-05 04:21:36 -0500 commented question Navigation with real robot

Actually, there is no reaction at all. I am trying to send simple goal to /gripper/move_base_node and I have no reaction in the terminal. Though, I can see that the goal is really sent through rqt_graph

2015-06-04 21:01:59 -0500 received badge  Popular Question (source)
2015-06-04 05:41:21 -0500 asked a question Navigation with real robot

Hi,

I am trying to move from stage simulation to real robot. In simulation all things were working quite good, but when I replaced stage_ros node with the robot package, it failed. I want to use Lego Mindstorms NXT 2 robot. I simulated it in stage without laser, using only odometry for localisation (I used fake_localisation node). You can see the difference in graphs. Here is the simulation graph:

image description

And here is the connection to real robot:

image description

As you can see /map_server lost connection to move_base, there are no move_base/action_topics, also /base_pose_ground_truth became hidden, because it connects only to fake_localisation. Goal_giver is the same as listengoal node, it is for sending coordinates of goal to move_base.

Does anyone have some ideas how to fix that?

Update

I got some results when I launched the simulation together with my real robot package. The tf errors were eliminated, and the planning worked. The problem remained that move_base was thinking that robot in stage_ros was my real robot, and it was trying to move it. Of course it did not move, as it was not receiving cmd_vel messages, but the real robot was trying to implement move_base commands. I tried to solve this localization problem, but the only thing I could do is to retranslate messages from /gripper/cmd_vel to /cmd_vel. Here is the graph:

image description

The robot really seemed to be moving, but it works awful. I understand why, of course. I should remove simulation part and set up normal localization package. But now I do not know what package should I use. Fake_localization, as I read, is suitable only for simulation, and amcl needs laser for work. What package can I use for localization only with odometry?

2015-05-26 06:53:26 -0500 commented question Navigation: Tuning Parameters

Have you solved your problem? I have the same one.

2015-05-25 06:55:10 -0500 asked a question Navigation in Stage simulation without using laser

Hi!

I want to simulate a robot in stage_ros with only odometry information and without using laser scanner for localization. I want to use navigation stack with Lego Mindstorms in the future (they have no laser scanner). I read some information about how to exclude laser from the simulation and so I deleted it from observation_sources.

image description

According to the graph, navigation really stopped using base_laser, but unexpected problem appeared - the robot started to hit the obstacles. The map is very simple - just the rectangular of 8 x 4 meters with the two walls in the middle.

image description

The robot should pass through the gap between the walls. Without the walls navigation is perfect, so it is not the localisation error, probably. I tried to watch what is happening in Rviz. It shows that global plan is almost good, and in the beginning robot starts moving according to it. But shortly after that, the robot is going like through the short cut - through the wall.

Here is base_local_planner_params.yaml:

TrajectoryPlannerROS:
  #Set the acceleration limits of the robot
  acc_lim_th: 3.2 
  acc_lim_x: 2.5
  acc_lim_y: 2.5
  #Set the velocity limits of the robot
  max_vel_x: 0.65
  min_vel_x: 0.1
  max_rotational_vel: 1.0
  min_in_place_rotational_vel: 0.4
  #The velocity the robot will command when trying to escape from a stuck situation
  escape_vel: -0.1
  #For this example, we'll use a holonomic robot
  holonomic_robot: true
  #Since we're using a holonomic robot, we'll set the set of y velocities it will sample
  y_vels: [-0.3, -0.1, 0.1, -0.3]
  #Set the tolerance on achieving a goal
  xy_goal_tolerance: 0.1
  yaw_goal_tolerance: 0.05
  #We'll configure how long and with what granularity we'll forward simulate trajectories
  sim_time: 1.7
  sim_granularity: 0.025
  vx_samples: 3
  vtheta_samples: 20
  #Parameters for scoring trajectories
  goal_distance_bias: 0.8
  path_distance_bias: 0.6
  occdist_scale: 0.01
  heading_lookahead: 0.325
  #We'll use the Dynamic Window Approach to control instead of Trajectory Rollout for this example
  dwa: true
  #How far the robot must travel before oscillation flags are reset
  oscillation_reset_dist: 0.05
  #Eat up the plan as the robot moves along it
  prune_plan: true

Here is costmap_common_params.yaml:

#For this example we'll configure the costmap in voxel-grid mode
map_type: voxel #Voxel grid specific parameters
origin_z: 0.0
z_resolution: 0.2
z_voxels: 10
unknown_threshold: 9
mark_threshold: 0
transform_tolerance: 0.3 #Set the tolerance we're willing to have for tf transforms
obstacle_range: 2.5 #Obstacle marking parameters // in wiki - global filtering parameters
max_obstacle_height: 2.0
raytrace_range: 3.0
footprint: [[-0.325, -0.325], [-0.325, 0.325], [0.325, 0.325], [0.46, 0.0], [0.325, -0.325]]#The footprint of the robot and associated padding
footprint_padding: 0.01
inflation_radius: 0.35 #Cost function parameters
cost_scaling_factor: 10.0
lethal_cost_threshold: 100 #The cost at which a cell is considered an obstacle when a map is read from the map_server

Here is global_costmap_params.yaml

global_costmap:
  #Set the global and robot frames for the costmap
  global_frame: /map
  robot_base_frame: base_link
  #Set the ...
(more)
2015-05-25 05:16:55 -0500 received badge  Popular Question (source)
2015-05-25 05:16:55 -0500 received badge  Notable Question (source)
2015-05-19 03:05:11 -0500 received badge  Notable Question (source)
2015-04-30 21:42:41 -0500 received badge  Notable Question (source)