Robotics StackExchange | Archived questions

Gazebo/rviz2 robot isn't moving from teleop keyboard (Foxy)

I tried to move my customize robot using teleop keyboard. Somehow, it's not moving at all even if the /cmd_vel is responding.

Take a look at this picture

image description

What did I miss?

Update one:

omg...I wasn't aware of this. How do I link /cmdvel with /robotstate_publisher? Then link to /gazebo? image description

Update #1:

Here is the launch since comment didn't work.

#!/usr/bin/env python3


from launch.substitutions import Command, LaunchConfiguration
from ament_index_python.packages import get_package_share_directory
from launch.substitutions import Command, FindExecutable, PathJoinSubstitution
from launch_ros.substitutions import FindPackageShare
from launch import LaunchDescription
from launch_ros.actions import Node
import launch_ros
import os
import sys
import launch_ros.actions
import xacro
import launch


def generate_launch_description():


    robot_description_content = Command(
    [
        PathJoinSubstitution([FindExecutable(name="xacro")]),
        " ",
        PathJoinSubstitution(
            [
                FindPackageShare("my_robot_description"),
                "src/description",
                "my_robot.urdf",
            ]
        ),
    ]
    )
    robot_description = {"robot_description": robot_description_content}
    rviz_config_file = PathJoinSubstitution(
    [FindPackageShare("my_robot_description"), "rviz", "urdf_config.rviz"]
    )

    rviz_node = Node(
    package="rviz2",
    executable="rviz2",
    name="rviz2",
    output="log",
    arguments=["-d", rviz_config_file],
    )
    robot_state_pub_node = Node(
    package="robot_state_publisher",
    executable="robot_state_publisher",
    output="both",
    parameters=[robot_description],
    )
    spawn_entity = launch_ros.actions.Node(
    package='gazebo_ros',
    executable='spawn_entity.py',
    arguments=['-entity', 'my_robot', '-topic', 'robot_description'],
    output='screen'
    )


    return launch.LaunchDescription([
    launch.actions.ExecuteProcess(cmd=['gazebo', '--verbose', '-s', 'libgazebo_ros_factory.so'], output='screen'),
    launch.actions.ExecuteProcess(
            name='fake_joint_calibration',
            cmd = ['ros2', 'topic', 'pub', '/joint_states', 'sensor_msgs/msg/JointState', '"{data: True}"'],
            output = 'screen',
            shell='True'
      ),


    robot_state_pub_node,
    rviz_node,
    spawn_entity,
    ])

Asked by kak13 on 2021-08-23 22:34:32 UTC

Comments

Answers

You need to load controllers for your robot. Do you mind sharing the launch file?

Asked by aprotyas on 2021-08-24 03:32:36 UTC

Comments

Sure! Thank you very much!

I updated the post with the launch file since comment couldn't load a full file

Asked by kak13 on 2021-08-24 03:33:47 UTC