Gazebo | Ignition | Community
Ask Your Question

Ahmet Özkul's profile - activity

2015-01-07 13:55:20 -0500 received badge  Scholar (source)
2014-07-03 14:04:47 -0500 answered a question Gazebo model interaction without ros

Hello, Thanks for the suggestions. Finally, I achieved controlling model from the keyboard. I used http://wiki.ros.org/turtlesim example code. I took turtlesim, terminal reading part and added it to update function of my model. In every update, it checks if there is a key press. update function of my code is below.

 // Called by the world update start event
    public: void OnUpdate()
    {
          char c;
        int kfd = 0;
    struct termios cooked, raw;
          // get the console in raw mode                                                              
      tcgetattr(kfd, &cooked);
      memcpy(&raw, &cooked, sizeof(struct termios));
      raw.c_lflag &=~ (ICANON | ECHO);
      // Setting a new line, then end of file                         
      raw.c_cc[VEOL] = 1;
      raw.c_cc[VEOF] = 2;
      tcsetattr(kfd, TCSANOW, &raw);
        struct pollfd pfd = {0,0,0};       /* poll() settings   */
      int pr;                            /* poll() result     */

      pfd.fd = STDIN_FILENO;
      pfd.events = POLLIN;
      pr = poll(&pfd, 1, 100);
      if(pr>0)
      {
        if(read(kfd, &c, 1) < 0)
        {
          perror("read():");
          exit(-1);
        }
        double rad = 1;
            switch(c)
            {
              case KEYCODE_L:
                puts("LEFT");
                this->left_wheel_joint_->SetAngle(0,0);  //joint
                break;
              case KEYCODE_D:
                puts("DOWN");
                this->left_wheel_joint_->SetAngle(0,-rad); //joint
                break;
            }
       }
       else{
        //no key
        }
}
2014-06-29 21:14:28 -0500 received badge  Famous Question (source)
2014-06-29 21:14:28 -0500 received badge  Popular Question (source)
2014-06-29 21:14:28 -0500 received badge  Notable Question (source)
2014-06-27 16:59:54 -0500 received badge  Editor (source)
2014-06-27 16:58:58 -0500 asked a question I lost in gazebo world :P

Hello, I started with gazebo, creating a model and plugin (using update method). It works than I want to use keyboard to control my robot. I found out that I can listen gazebo world or models with a simple code. But I could not found how to send message. Similar to turtlesim app in Ros I found out if I use ros with gazebo, ros services can send command to model's joints from terminal (here), but the problem is it was using urdf (spawn and control) format (I learned it is used before the sdf).

So far, I lost my path :( . Is there any suggestions to move on a right path.

Should I use urdf with Ros or Is there a simple way to control robot in gazebo without using Ros?

2014-06-26 10:11:39 -0500 received badge  Notable Question (source)
2014-06-26 10:11:39 -0500 received badge  Famous Question (source)
2014-06-25 19:41:01 -0500 received badge  Popular Question (source)
2014-06-24 14:39:28 -0500 asked a question Gazebo model interaction without ros

Hello, I just started to learn gazebo. I want to control my model from keyboard. There is a turtlesim example for ros,but Is it possible to take key events from gazebo without using ros?