Home | Tutorials | Wiki | Issues
Ask Your Question

rahul's profile - activity

2019-08-14 17:07:47 -0500 received badge  Famous Question (source)
2019-06-25 07:54:58 -0500 received badge  Famous Question (source)
2019-06-20 14:07:57 -0500 received badge  Notable Question (source)
2019-06-20 13:48:50 -0500 marked best answer Why this->model->SetLinearVel doesn't work?

I am trying to give velocity to a model by using SetLinearVel for the model and apparently it doesn't seem to work. I looked up this tutorial: http://gazebosim.org/tutorials?tut=se... and they are doing model->GetLink("white_link_0")->SetLinearVel({0, 1, 0});. However, I am attempting to do this->model->SetLinearVel(ignition::math::Vector3d(2.0, 0.0, 0.0)); and it doesn't seem to work. I don't see my model moving. What is it that I am doing wrong?

The full code is given below:

namespace gazebo
{
    Sparkle::Sparkle()
    {

    }
    void Sparkle::Load(physics::ModelPtr _parent, sdf::ElementPtr _sdf)
    {
        ROS_INFO_STREAM("Load");
        this->model = _parent; /*Store the pointer to the model*/
        this->world = _parent->GetWorld();
        this->robotNamespace = "";
        this->physicsEngine = (this->world)->Physics(); 

        /*Get the update rate from sdf*/
        if (_sdf->HasElement("updateRate"))
        {
            this->updateRate = _sdf->GetElement("updateRate")->Get<double>();
        }
        if (_sdf->HasElement("robotNamespace"))
        {
            this->robotNamespace = _sdf->GetElement("robotNamespace")->Get<std::string>();
        }


        this->velTopic = this->robotNamespace + "/vel";

        //Start up ros_node
        int argc = 0;
        char** argv = NULL;
        ros::init(argc, argv, "sparkle_sim", ros::init_options::NoSigintHandler | ros::init_options::AnonymousName);
        rosnode_ = new ros::NodeHandle(this->robotNamespace);


        this->ros_spinner_thread_ = boost::thread( boost::bind( &Sparkle::SimROSThread, this ) );


    }

    void Sparkle::SimROSThread()
    {
        ROS_INFO_STREAM("SimROSThread,");
        ros::NodeHandle nodehandle;
        ros::Subscriber velsub = nodehandle.subscribe(this->velTopic, 1, &Sparkle::changeVel, this);
        ros::Rate loop_rate(10);

        while (this->rosnode_->ok())
        {
            ROS_INFO_STREAM("Looping");
            ros::spinOnce();
            loop_rate.sleep( );
        }
    }

    void Sparkle::changeVel(const geometry_msgs::Twist::ConstPtr& msg)
    {
        ROS_INFO_STREAM("ChangingVel");
        double x = msg->linear.x;

        ROS_INFO("Velocity to set is %f\n", x);

        this->model->SetLinearVel(ignition::math::Vector3d(x, 0.0, 0.0));
    }

    void Sparkle::changePos(const gazebo_msgs::ModelState::ConstPtr& msg)
    {
        gazebo_msgs::ModelState newMsgs;
        newMsgs.model_name = this->robotNamespace;
        newMsgs.pose.position = msg->pose.position;
        newMsgs.pose.orientation = msg->pose.orientation;
        this->modelPub.publish(newMsgs);
    }
   GZ_REGISTER_MODEL_PLUGIN(Sparkle)
}

Apart from the fact that tutorial is using old math library, what is the difference between these two methods and why my method doesn't seem to work?

2019-06-20 13:48:36 -0500 commented answer Why this->model->SetLinearVel doesn't work?

Thanks for the suggestions. I took your steps into consideration. I am using Gazebo 9.0. The problem I found was in Poin

2019-06-18 06:53:05 -0500 received badge  Popular Question (source)
2019-06-15 18:43:28 -0500 edited question Why this->model->SetLinearVel doesn't work?

What is the difference between this->model->SetLinearVel and this->model->GetLink("LinkName")->SetLinearV

2019-06-15 18:41:46 -0500 edited question Why this->model->SetLinearVel doesn't work?

What is the difference between this->model->SetLinearVel and this->model->GetLink("LinkName")->SetLinearV

2019-06-15 18:31:02 -0500 edited question Why this->model->SetLinearVel doesn't work?

What is the difference between this->model->SetLinearVel and this->model->GetLink("LinkName")->SetLinearV

2019-06-15 18:01:31 -0500 asked a question Why this->model->SetLinearVel doesn't work?

What is the difference between this->model->SetLinearVel and this->model->GetLink("LinkName")->SetLinearV

2019-06-14 04:06:52 -0500 answered a question The minimum corner of the box must be less than or equal to maximum corner

What I found out that if you do not provide Inertial, you get the error. Try adding following within <link></li

2019-05-31 02:44:39 -0500 received badge  Notable Question (source)
2019-05-30 10:06:47 -0500 received badge  Popular Question (source)
2019-05-21 02:52:18 -0500 received badge  Nice Question (source)
2019-05-21 00:09:59 -0500 edited question How to set gazebo master uri in roslaunch file?

How to gazebo master uri in roslaunch file I know that there are bunch of parameters we can define for gazebo in ros lau

2019-05-21 00:09:14 -0500 marked best answer Why I am getting Exception sending a message when starting Gazebo and how to solve it?

I have ROS melodic and Gazebo 9 in my system. When I type

gazebo

in my terminal, I am getting following message:

Exception sending a message

that keeps on printing in terminal console.

How should I resolve this issue?

2019-05-21 00:08:23 -0500 asked a question How to include ignition math library in CMakeLists.txt?

How to include ignition math library in CMakeLists.txt? I am not sure if this is the right platform to ask this question

2019-01-09 20:22:28 -0500 commented question Reference paper for gazebo

It is not a good idea to cite a paper that is not available to read. It is not a good practice to cite a paper just for

2018-10-12 09:00:49 -0500 received badge  Taxonomist
2018-10-09 05:19:06 -0500 received badge  Famous Question (source)
2018-08-27 04:34:03 -0500 received badge  Famous Question (source)
2018-08-13 21:41:06 -0500 received badge  Famous Question (source)
2018-07-24 02:38:09 -0500 commented question Why I am getting Exception sending a message when starting Gazebo and how to solve it?

Hi @Raskkii , today I encountered this problem again and it occurs even when I type rosrun gazebo_ros gazebo --verbose

2018-07-20 09:43:08 -0500 received badge  Notable Question (source)
2018-07-19 20:17:34 -0500 answered a question Why I am getting Exception sending a message when starting Gazebo and how to solve it?

Surprisingly, I didn't encounter this exception message next day, either with the rosrun method proposed by @Raskkii or

2018-07-19 20:16:44 -0500 commented question Why I am getting Exception sending a message when starting Gazebo and how to solve it?

Surprisingly, I didn't encounter this exception message today, either with your proposed method or just by typing 'gazeb

2018-07-19 20:15:34 -0500 received badge  Popular Question (source)
2018-07-18 01:07:23 -0500 asked a question Why I am getting Exception sending a message when starting Gazebo and how to solve it?

Why I am getting Exception sending a message when starting Gazebo and how to solve it? I have ROS melodic and Gazebo 9 i

2018-06-18 09:31:01 -0500 received badge  Notable Question (source)
2018-06-18 02:21:10 -0500 received badge  Famous Question (source)
2018-06-18 02:00:31 -0500 received badge  Notable Question (source)
2018-06-15 17:16:41 -0500 received badge  Popular Question (source)
2018-06-15 16:14:09 -0500 marked best answer How to create a curved road using <road> tag from SDF version 1.6 in Gazebo?

This question and its answer provides a way to create a straight road in gazebo:

http://answers.gazebosim.org/question...

How should I modify this to create a curved road in Gazebo?

Thanks.

2018-06-15 16:14:07 -0500 commented answer How to create a curved road using <road> tag from SDF version 1.6 in Gazebo?

Okay, thank you very much. I will write code in MATLAB to generate a set of points defining a curvature and use them in

2018-06-15 16:06:15 -0500 commented answer How to create a curved road using <road> tag from SDF version 1.6 in Gazebo?

Alright, thank you very much. Now I understood. Is there any way to define curvature to give a smooth curve?

2018-06-15 15:20:26 -0500 asked a question How to create a curved road using <road> tag from SDF version 1.6 in Gazebo?

How to create a curved road using <road> tag from SDF version 1.6 in Gazebo? This question and its answer provides

2018-06-15 15:18:20 -0500 marked best answer What is the fix for 'No p gain specified for pid. Namespace: /gazebo_ros_control/pid_gains/back_right_wheel_joint ' ros melodic?

Hi, I am using gazebo_ros_control package from ROS melodic. I am geting error like

[ERROR] [1528754765.222507207, 9.660000000]: No p gain specified for pid.  Namespace: /gazebo_ros_control/pid_gains/back_right_wheel_joint

I believe I may need to change something in yaml file but I am quite not sure what do I need to change. Can somebody please point me out?

Thanks.

2018-06-15 15:18:17 -0500 answered a question What is the fix for 'No p gain specified for pid. Namespace: /gazebo_ros_control/pid_gains/back_right_wheel_joint ' ros melodic?

I got the solution to my problem by following this example: https://git.univ-bpclermont.fr/laurent.malaterre/local_a7/bl

2018-06-15 15:17:53 -0500 commented question What is the fix for 'No p gain specified for pid. Namespace: /gazebo_ros_control/pid_gains/back_right_wheel_joint ' ros melodic?

Thanks for answering this. But I got a solution to my problem after finding this example: https://git.univ-bpclermont.fr

2018-06-14 15:33:16 -0500 received badge  Popular Question (source)
2018-06-11 17:52:33 -0500 received badge  Notable Question (source)
2018-06-11 17:47:56 -0500 marked best answer What is Gazebo 9.0 equivalent of gazebo::physics::Joint->GetAngle() used in Gazebo 2.0?

In Gazebo 2.0, gazebo::physics::Joint->GetAngle() is used to Get the angle of rotation of an axis(index). This method is not available in Gazebo 9.0. I would like to know what is equivalent function in Gazebo 9.0

Thanks.

2018-06-11 17:27:13 -0500 commented answer What is Gazebo 9.0 equivalent of gazebo::physics::Joint->GetAngle() used in Gazebo 2.0?

I was able to do it successfully in case any one has the same question. You have to call like: x = steering_joints[0]

2018-06-11 17:21:37 -0500 asked a question What is the fix for 'No p gain specified for pid. Namespace: /gazebo_ros_control/pid_gains/back_right_wheel_joint ' ros melodic?

What is the fix for 'No p gain specified for pid. Namespace: /gazebo_ros_control/pid_gains/back_right_wheel_joint ' ros