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

nadal11's profile - activity

2017-07-13 00:34:26 -0500 received badge  Famous Question (source)
2015-03-26 19:30:16 -0500 received badge  Notable Question (source)
2015-03-26 19:30:16 -0500 received badge  Popular Question (source)
2014-10-21 04:14:37 -0500 answered a question Problem with IR Sensor

That the problem as well. They have been published in the message on the same frame_id as well. Here is the code from roomba_560 for irsensor part.

rooomba_500_series::RoombaIR irbumper;
irbumper.header.stamp = current_time;

irbumper.header.frame_id = "base_irbumper_left";
irbumper.state = roomba->ir_bumper_[LEFT];
irbumper.signal = roomba->ir_bumper_signal_[LEFT];
irbumper_pub.publish(irbumper);

irbumper.header.frame_id = "base_irbumper_front_left";
irbumper.state = roomba->ir_bumper_[FRONT_LEFT];
irbumper.signal = roomba->ir_bumper_signal_[FRONT_LEFT];
irbumper_pub.publish(irbumper);

irbumper.header.frame_id = "base_irbumper_center_left";
irbumper.state = roomba->ir_bumper_[CENTER_LEFT];
irbumper.signal = roomba->ir_bumper_signal_[CENTER_LEFT];
irbumper_pub.publish(irbumper);

irbumper.header.frame_id = "base_irbumper_centre_right";
irbumper.state = roomba->ir_bumper_[CENTER_RIGHT];
irbumper.signal = roomba->ir_bumper_signal_[CENTER_RIGHT];
irbumper_pub.publish(irbumper);

irbumper.header.frame_id = "base_irbumper_front_right";
irbumper.state = roomba->ir_bumper_[FRONT_RIGHT];
irbumper.signal = roomba->ir_bumper_signal_[FRONT_RIGHT];
irbumper_pub.publish(irbumper);

irbumper.header.frame_id = "base_irbumper_right";
irbumper.state = roomba->ir_bumper_[RIGHT];
irbumper.signal = roomba->ir_bumper_signal_[RIGHT];
irbumper_pub.publish(irbumper);

and the turtlebot only slow down if there is any change of ir reading from ir_bumper_[RIGHT]

2014-10-19 05:55:55 -0500 received badge  Famous Question (source)
2014-10-17 09:13:37 -0500 commented question Problem with IR Sensor

yes, each sensor reading published as a separate message. And yes, the sensor reading from very right is the last sensor reading published and only this sensor reading is being used. that's why I wonder how I could make sure all other sensor reading are being used as well.

2014-10-15 05:10:40 -0500 commented question Problem with IR Sensor

Yes I am sure. Because IR readings display all readings from all sensors. However, the turtlebot only slow down if the IR reading from very right side is less than 100. Any idea?

2014-10-14 15:58:32 -0500 received badge  Notable Question (source)
2014-10-14 05:05:52 -0500 received badge  Popular Question (source)
2014-09-15 10:51:51 -0500 asked a question Problem with IR Sensor

Hi everybody,

I have a problem here. I try to control the turtlebot speed based on the IR sensors reading. Unfortunately, the turtlebot only slow down the object is at it's very right side. However, the IR sensors shows all reading without any problem. Here is my code:

#include <ros/ros.h>
#include <roomba_500_series/RoombaIR.h>
#include <geometry_msgs/Twist.h>
#include <ros/rate.h>
#include <iostream>

using namespace std;   

ros::Publisher pub_vel;
geometry_msgs::Twist cmdvel;

int reading, condition;
double speed;

//define the irsensorCallback function
void irsensorCallback(const roomba_500_series::RoombaIR::ConstPtr& msg)
{
  reading = msg->signal;
  condition = msg->state;
  cout<<"IR State = "<<reading<<endl;
  cout<<"IR Signal = "<<condition<<endl;

 if(condition!=0 || reading=>100)
   {
      cmdvel.linear.x=0.08;
      cmdvel.amgular.z=0.0;
   }
 else
   {
      cmdvel.linear.x=0.2;
      cmdvel.amgular.z=0.0;
   }
pub_vel.publish(cmdvel);
} 

//ROS node entry point 
int main(int argc, char **argv)
{
   ros::init(argc, argv, "turtlebot_test");
   ros::NodeHandle n;

   ros::Subscriber irsensorSubscriber = n.subscribe("/ir_bumper", 1000, irsensorCallback);
   ros::Publisher velocityPublisher = n.advertise<geometry_msgs::Twist>("cmd_vel", 1000);

  cmdvel.linear.x = 0.0;
  cmdvel.angular.z = 0.0;

   ros::spin();
   return 0;
}

Hopefully somebody could advise me on this. Thank you.

2014-06-11 05:01:07 -0500 asked a question Sequence movement with delay

Hi there,

I am trying to put a delay between a movement of turtlebot so that I can execute the movement step by step. However, the behavior of the turtlebot is different from what I expected. It's only execute the first movement and skip the other command. Could anybody help me out here? Here I attached my sample of program. Thank you.

#include <ros/ros.h>
#include <stdlib.h>
#include <iostream.h>
#include <geometry_msgs/Twist.h>
#include <geometry_msgs/Pose.h>
#include <numeric>

using namespace std;

ros::Publisher pub_vel;
geometry_msgs::Twist cmdvel;
geometry_msgs::Pose Curr_Loc;

void odomCB(const nav_msgs::Odometry::ConstPtr& msg)
{
    Curr_Loc = msg->pose.pose;
    double x=msg->pose.pose.position.x;
    double y=msg->pose.pose.position.y;
    double Z=msg->pose.pose.orientation.z;
    double W=msg->pose.pose.orientation.w;

    cout<<"Current location: "<<x<<", "<<y<<"  Orientation  "<<Z<<", "<<W<<endl;

    cmdvel.angular.z=0.0;
    cmdvel.linear.x=0.2;
    usleep(300000); //delay
    cmdvel.angular.z=-0.2;
    cmdvel.linear.x=0.0;
    usleep(300000); //delay

pub_vel.publish(cmdvel);
}

int main(int argc, char** argv)
{
    ros::init(argc, argv, "sequence move");
    ros::NodeHandle n;

    pub_vel=n.advertise<geometry_msgs::Twist>("cmd_vel",1);
    pub_vel.publish(cmdvel);

    ros::Subscriber Sub_Odom=n.subscribe("odom",1,odomCB);  //subcribe
    ros::spin();
    return 0;
}
2014-05-16 00:17:13 -0500 answered a question Turtlebot 1 Bumper and IR Sensor Problem

I have figure it out. Instead of subscribe to turtlebot_node, I subscribe to roomba_500_series. Here is my modified code and it is working for me. Note that, turtlebot needs to connect to roomba in order to receive sensors data from bumper. roomba_500_series also publish sensors data from ir_bumper. The code is:

#include <ros/ros.h>
#include <roomba_500_series/Bumper.h>
#include <geometry_msgs/Twist.h>
#include <ros/rate.h>
#include <iostream>
#include <stdio.h>                        

using namespace std;    
bool left_bumper, right_bumper;

//define the bumperCallback function
void bumperCallback(const roomba_500_series::Bumper::ConstPtr& msg)
{
     cout<<"Check point 11111111111111111"<<endl;
     left_bumper = msg->left.state;
     right_bumper = msg->right.state;
     cout<<"left bumper been hitted. value = "<<left_bumper<<endl;
     cout<<"right bumper been hitted. value = "<<right_bumper<<endl;
}

//ROS node entry point 
int main(int argc, char **argv)
{
    ros::init(argc, argv, "turtlebot_test_node");
    ros::NodeHandle n;

    ros::Subscriber bumperSubscriber = n.subscribe("/bumper", 1000, bumperCallback);
    ros::Publisher velocityPublisher = n.advertise<geometry_msgs::Twist>("cmd_vel", 1);

    //create a Twist message to publish the velocity
    geometry_msgs::Twist velMessage;
    velMessage.linear.x = 0.0;
    velMessage.angular.z = 0.0;

    //publish the message
    velocityPublisher.publish(velMessage);

   ros::spin();

   return 0;
}
2014-05-15 01:15:42 -0500 received badge  Scholar (source)
2014-05-15 01:15:20 -0500 received badge  Supporter (source)
2014-05-15 01:12:16 -0500 received badge  Famous Question (source)
2014-05-15 01:08:11 -0500 commented answer turtlebot orientation and moving towards target

Thank you for both suggestion!

2014-05-15 01:06:15 -0500 commented answer Turtlebot 1 Bumper and IR Sensor Problem

Thanks mate. By make sure the turtlebot driver running, do you mean connect turtlebot to roomba? I have run the rostopic info and it shows that the topic has been subscribed but not publish. From there, what should I do?

2014-05-14 06:26:19 -0500 received badge  Famous Question (source)
2014-05-14 04:23:03 -0500 received badge  Teacher (source)
2014-05-14 04:23:03 -0500 received badge  Self-Learner (source)
2014-05-14 04:10:26 -0500 commented answer retrieve turtlebot orientation

thanks mate. I have sort this thing out actually. the one you suggest give the same output as the one i suggested.

2014-05-14 03:38:37 -0500 edited question turtlebot orientation and moving towards target

Hi everybody,

I am new to ROS and currently I am using turtlebot for my experiment. My aim is to rotate the turtlebot to face my target coordinate and move towards it. However, the turtlebot is not behaving as I expected. The turtlebot is keep rotating or keep moving forward. Here is my source code and kindly give me some advices.

for example destination is (1,-0.5)

curr_loc = msg->pose.pose;

double x=msg->pose.pose.position.x;
double y=msg->pose.pose.position.y;
double z=msg->pose.pose.orientation.z;
double w=msg->pose.pose.orientation.w;

curr_head=atan2(2*(x*y+w*z), w*w + x*x - y*y - z*z);

DestX=1; DestY=-0.5;

left_X=DestX-x;
left_Y=DestY-y;

left_dist=sqrt((left_X * left_X) + (left_Y*left_Y));

if(left_dist <= 0.05)
{
   reached=true;
}

if(!reached)
{
   heading=atan2(left_locY,left_locX);
}

n_head=curr_head-heading;

if (n_head<0.2 && n_head>-0.2)
   facing=true;
else
   facing=false;

if (!facing)
   cmdvel.linear.x=0.0;

if (n_head>-3.14)
   cmdvel.angular.z=-0.25;
else if (n_head>-1.6)
   cmdvel.angular.z=-0.10;
else if (n_head<3.14)
    cmdvel.angular.z=0.25;
else if (n_head>1.6)
    cmdvel.angular.z=0.10;
else if (n_head>3.14)
     cmdvel.angular.z=-0.10;
else if (n_head<-3.14)
     cmdvel.angular.z=0.10;

if (facing && !reached)
   {
     cmdvel.angular.z=0.0;
          if (left_dist>0.5)
           {
            cmdvel.linear.x=-0.2;
                usleep(1000000);
       }
          else if (left_dist>0.2)
          {
           cmdvel.linear.x=-0.15;
           usleep(1000000);
      } 
         else if (left_dist>0.08)
         {
          cmdvel.linear.x=-0.05;
          usleep(1000000);
     }
  }
 else if (reached)
 {
    cmdvel.linear.x=0.0;
    n_head=0.0;
    ROS_INFO("Turtlebot has reached the destination");
}

Hope anybody can help me out. Thank you!

2014-05-14 03:34:49 -0500 received badge  Notable Question (source)
2014-05-14 03:34:25 -0500 edited question retrieve turtlebot orientation

hi everybody,

kindly help me out to retrieve exact turtlebot's orientation. i have used yaw to determine the orientation but when the robot move the yaw become inaccurate. the yaw command the i used is as follows:

   yaw=atan2(2*(x*y+w*z), w*w + x*x - y*y - z*z);

kindly,give me an advice on how to retrieve the exact turtlebot's orientation. thank you.

2014-05-14 03:33:39 -0500 received badge  Famous Question (source)
2014-05-14 03:26:12 -0500 received badge  Notable Question (source)
2014-05-09 11:05:16 -0500 received badge  Popular Question (source)
2014-05-02 04:30:15 -0500 asked a question Turtlebot 1 Bumper and IR Sensor Problem

Hi everybody,

Kindly please help me out here. I am trying to access to Bumper and IR sensors on turtlebot1 (roomba500 series). Just would like to know whether I need a launch file to access this sensors? If so,could anybody please advise or give me an example of the launch file. I also put a check point in the call back function to check whether it goes into the loop but it didn't print anything on my screen as shown below. Follow is my source code that I used:

#include <ros/ros.h>
#include <turtlebot_node/TurtlebotSensorState.h>
#include <geometry_msgs/Twist.h>
#include <ros/rate.h>
#include <iostream>
#include <stdio.h>                        

using namespace std;    
uint8_t bumper;

//define the bumperCallback function
void bumperCallback(const turtlebot_node::TurtlebotSensorState::ConstPtr& msg)
 {
   cout<<"Check point 11111111111111111"<<endl;
   bumper = msg->bumps_wheeldrops;
   ROS_INFO("bumper hit. value = [%d]", bumper);
 }

//ROS node entry point 
int main(int argc, char **argv)
{
   ros::init(argc, argv, "turtlebot_test_node");
   ros::NodeHandle n;

   ros::Subscriber bumperSubscriber = n.subscribe("/turtlebot_node/sensor_state", 1000, bumperCallback);
   ros::Publisher velocityPublisher = n.advertise<geometry_msgs::Twist>("cmd_vel", 1);

   //create a Twist message to publish the velocity
   geometry_msgs::Twist velMessage;
   velMessage.linear.x = 0.0;
   velMessage.angular.z = 0.0;

   //publish the message
   velocityPublisher.publish(velMessage);

   ros::spin();

   return 0;
}

Many thanks!

2014-03-10 23:01:13 -0500 received badge  Enthusiast
2014-02-17 01:15:01 -0500 edited answer retrieve turtlebot orientation

i have figure the answer for this problem. the yaw can be retrieved from turtlebot using this equation:

yaw=atan2(2*orientation.w*orientation.z), orientation.w*orientation.w - orientation.z*orientation.z);

thank you to everybody.