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

shenki's profile - activity

2021-03-17 13:38:58 -0500 received badge  Famous Question (source)
2020-01-30 02:22:26 -0500 received badge  Famous Question (source)
2018-01-28 07:36:52 -0500 received badge  Famous Question (source)
2018-01-28 07:36:52 -0500 received badge  Notable Question (source)
2017-10-26 20:47:07 -0500 received badge  Notable Question (source)
2017-05-09 08:41:09 -0500 received badge  Notable Question (source)
2017-04-23 00:29:46 -0500 received badge  Popular Question (source)
2017-04-13 01:00:01 -0500 received badge  Popular Question (source)
2017-04-12 08:53:00 -0500 asked a question Problem to publish data

Hello,

I just want to initialize a publisher :

private: gazebo::transport::PublisherPtr topic_vitesse = node->Advertise<std_msgs::float64>("leader/vitesse");

private: gazebo::transport::PublisherPtr topic_teta = node->Advertise<std_msgs::float64>("leader/teta");

but I got this error when I want to compile :

error: cannot dynamic_cast ‘& msgtype’ (of type ‘struct std_msgs::Float64_<std::allocator<void> >’) to type ‘class google::protobuf::Message’ (source type is not polymorphic) msg = dynamic_cast<google::protobuf::message *="">(&msgtype);

I am using GAZEBO 7 and ROS Kinetic I don't really understand that error, thank in advance !

2017-04-12 02:55:53 -0500 commented question SetVelocityTarget() has no effect on my robot

As I wrote I am using gazebo, but I used SetLinearVel() directly on my model, it seems to be working pretty well.

2017-04-12 02:54:10 -0500 received badge  Enthusiast
2017-04-11 04:55:22 -0500 asked a question SetVelocityTarget() has no effect on my robot

Hello,

I am currently working on a project where my robots have to keep a constant distance. My algorithm is supposed to be working HOWEVER, I have the same problem for 5 days. I use GAZEBO 7 with ROS Kinetic.


My problem is, I have a function setVelocity() :

    void setVelocity(const double &_vel)
    {   
        this->model->GetJointController()->SetVelocityTarget(this->joint->GetScopedName(), _vel);           
    }

It's working pretty well when I fix that at any value HOWEVER, when I set another value that is LESS than the previous velocity, it keeps its previous velocity and ignores my new request.

I don't understand why it does that. I have to stop my robot sometimes and I can't I need to know why it wont listen to me.

Here is some parts of my code that might interest you :

        this->joint = _model->GetJoints()[0];
        this->pid = common::PID(0.1, 0, 0, 100, -100, 100, -100);
        this->model->GetJointController()->SetVelocityPID(this->joint->GetScopedName(), this->pid);

        sub = n.subscribe("hokuyo_laser", 1, &ListenerPlugin::scanCallback, this);

My robot is a Pioneer3-AT with a hokuyo laser on his top. The previous code is from a tutorial, and my robot has a weight and a friction.

I really need your help, I wanna know if I did something wrong or it the problem comes from GAZEBO if that's the case, can I have another solutions ? thanks in advance !

2017-04-10 02:05:41 -0500 commented question Problems to analyse laser data

Oh, hello, I forget to say I found the problem and indeed that was the problem, thank you anyway !

2017-04-09 21:45:52 -0500 received badge  Popular Question (source)
2017-04-06 09:52:06 -0500 answered a question Set an instant velocity on Gazebo

For the moment I found that, it's working but it's not that good...

    public: void SetVelocity(const double &_vel)
    {
        double __vel = _vel;
        if(__vel>30)__vel=30;
        this->joint->SetDamping(0,old_value/10);
        this->joint->Update();
        this->model->GetJointController()->SetVelocityTarget(this->joint->GetScopedName(), __vel);
        old_value = __vel;
    }

This is stupid, so if someone has better, i'll take it, thank you !

2017-04-06 09:39:14 -0500 commented answer Set an instant velocity on Gazebo

Well, I just tried it, the problem is still the same, even if my pioneer is going forward, asking him to get a force of 0 doesn't make it stop

2017-04-06 09:29:16 -0500 commented answer Set an instant velocity on Gazebo

Hello,

I tried SetVelocity and SetVelocityTarget via a joitController. The thing is if I set the velocity to 30, to pioneer will go at 30 of speed but after that, if I set velocity on 0, it won't stop, and I can't understand why, do you really think it could be better using efforts ?

2017-04-06 06:29:32 -0500 answered a question Set an instant velocity on Gazebo

Ok I found SetDamping() function that is working pretty well.

2017-04-06 04:56:52 -0500 answered a question how to use callback funtions with out using static key word in Ros with c++

Hello,

I understand what you mean, try this :

ros::NodeHandle n; 
ros::Subscriber sub;

sub = n.subscribe("yournode", 1, &YourPlugin::Callback, this);

You wont need static method using it like that ( usable with a class )

2017-04-06 04:53:19 -0500 asked a question Set an instant velocity on Gazebo

Hello,

I am working on Gazebo 7 with ROS kinetic. So, here is my problem, I have that code function :

    void SetVelocity(const double &_vel)
    {   
        this->model->GetJointController()->SetVelocityTarget(this->joint->GetScopedName(), _vel);
    }

It's used to set a velocity to my pioneer, it's working pretty well but I want the velocity to be instant. For exemple, when I set it to a velocity of 30 and then a velocity of 0, it will take so many time to stop. What are the solutions ? Here is the rest of the code :

        this->model = _model; 
        this->joint = _model->GetJoints()[0];
        this->pid = common::PID(0.1, 0, 0, 1000, -1000, 1000, -1000);
        this->model->GetJointController()->SetVelocityPID(this->joint->GetScopedName(), this->pid);

Thank in advance.

2017-04-05 07:22:44 -0500 asked a question Problems to analyse laser data

Hello,

I am using kinetic ROS with GAZEBO 7 and I have a problem, here is my code :

    void SetVelocity(const double &_vel)
    {   

        this->nomModel3 = this->nomModel;
        this->nomModel3 = this->nomModel3 + "/map";         

        if (this->nomModel3==nomModel2){

            this->model->GetJointController()->SetVelocityTarget(this->joint->GetScopedName(), _vel);
        }

    }

    void scanCallback(const sensor_msgs::LaserScan::ConstPtr& scan){

        tailleTableau = (sizeof(scan->ranges)/sizeof(scan->ranges[0])) - 1;

        if (tailleTableau >= 0){

            for (i=0; i < tailleTableau ; i++){

                if ((scan->ranges[i]>=scan->range_min)&&(scan->ranges[i]<=scan->range_max)){

                    ROS_INFO("hello");
                    this->nomModel2 = scan->header.frame_id.c_str();
                    this->SetVelocity(-30);
                }
            }
        }

    }

my scanCallBack() is called everytimes I get information from hokuyo laser, and I want to loop into the array it gives me, so I am using a for loop, however, sometimes I can see the data in scan->range is correct and is supposed to get into my if condition but it's not getting in, it's just writting "inf" even if the command rostopic echo /hokuyo_laser shows me that it's wrong.

What am i doing wrong ? thank in advance

2017-04-04 09:37:30 -0500 received badge  Popular Question (source)
2017-04-04 05:45:18 -0500 commented question Problem to subscrib with class

Hello, i must have had a problem while recopying but the ";" is in the code. After your commentary I searched how does node initialise, and I just switch it on public and now it's working, thank you so much, i've been stuck on that for hours

2017-04-04 05:00:06 -0500 asked a question Problem to subscrib with class

Hello,

I am currently in an internship and Im working on ROS with GAZEBO simulator. I made my own package but now im facing a problem. I have 10 pioneer3AT with a hokuyo laser on each, the plugin for the laser is working well, and I have a topic called "/hokuyo_laser" and I am trying to make my own plugin, using a C++ class, here is my code :

class ListenerPlugin : public ModelPlugin
{

    private:
        ros::NodeHandle n;
        ros::Subscriber sub
    public:


    ListenerPlugin() {}

    void scanCallback(const sensor_msgs::LaserScan::ConstPtr& scan){


         ROS_INFO("VALEUR SCAN: [%s]", scan->ranges);
    }

    virtual void Load(physics::ModelPtr _model, sdf::ElementPtr _sdf){

        std::cerr << "Le plugin listener a ete attache a[" << _model->GetName() << "]\n";

        sub = n.subscribe("hokuyo_laser", 1, &ListenerPlugin::scanCallback, this);
        std::cerr << sub;

    }
};

GZ_REGISTER_MODEL_PLUGIN(ListenerPlugin)

And my problem is that my programm is never going in scanCallback, when I use std::cerr to display my Subscriber, there is only "0x1" that is showing.

Here is the result of the command "rostopic list -v" while simulator is running :

Published topics:

 * /hokuyo_laser [sensor_msgs/LaserScan] 1 publisher
 * /gazebo/link_states [gazebo_msgs/LinkStates] 1 publisher
 * /rosout [rosgraph_msgs/Log] 1 publisher
 * /rosout_agg [rosgraph_msgs/Log] 1 publisher
 * /gazebo/model_states [gazebo_msgs/ModelStates] 1 publisher
 * /clock [rosgraph_msgs/Clock] 1 publisher
 * /gazebo/parameter_descriptions [dynamic_reconfigure/ConfigDescription] 1 publisher
 * /gazebo/parameter_updates [dynamic_reconfigure/Config] 1 publisher

Subscribed topics:

 * /clock [rosgraph_msgs/Clock] 1 subscriber
 * /gazebo/set_model_state [gazebo_msgs/ModelState] 1 subscriber
 * /rosout [rosgraph_msgs/Log] 1 subscriber
 * /gazebo/set_link_state [gazebo_msgs/LinkState] 1 subscriber

I am using ros kinetic by the way, and I am sorry if my mistake is stupid, I litteraly can't find anything working on the Internet. Thank you for answering me !

2017-04-04 05:00:06 -0500 asked a question gdfgfdfgdfgdfg

bgvdbdffdfdsfsdfsdfsd fs tret esr qr zqr z