Open nisathav opened 1 month ago
Please have a look at our demos. You need to run the controller_manager from the ros2_control_node, which is done by gazebo in the gazebo_ros2_control plugin.
ummm... He did it. He parse xacro file which include ros2_control tag along with gazebo_ros2_control plugin. robot.urdf.xacro
<?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro" name="robot">
<xacro:arg name="use_ros2_control" default="true"/>
<xacro:arg name="sim_mode" default="false"/>
<xacro:include filename="robot_core.xacro" />
<xacro:if value="$(arg use_ros2_control)">
<xacro:include filename="ros2_control.xacro" />
</xacro:if>
<xacro:unless value="$(arg use_ros2_control)">
<xacro:include filename="gazebo_control.xacro" />
</xacro:unless>
<xacro:include filename="lidar.xacro" />
<xacro:include filename="camera.xacro" />
<!-- <xacro:include filename="depth_camera.xacro" /> -->
<xacro:include filename="face.xacro" />
</robot>
and here ros2_control.xacro
<?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro">
<xacro:unless value="$(arg sim_mode)">
<ros2_control name="RealRobot" type="system">
<hardware>
<plugin>diffdrive_arduino/DiffDriveArduinoHardware</plugin>
<param name="left_wheel_name">left_wheel_joint</param>
<param name="right_wheel_name">right_wheel_joint</param>
<param name="loop_rate">30</param>
<param name="device">/dev/ttyUSB0</param>
<param name="baud_rate">57600</param>
<param name="timeout_ms">1000</param>
<param name="enc_counts_per_rev">3436</param>
</hardware>
<joint name="left_wheel_joint">
<command_interface name="velocity">
<param name="min">-10</param>
<param name="max">10</param>
</command_interface>
<state_interface name="position"/>
<state_interface name="velocity"/>
</joint>
<joint name="right_wheel_joint">
<command_interface name="velocity">
<param name="min">-10</param>
<param name="max">10</param>
</command_interface>
<state_interface name="position"/>
<state_interface name="velocity"/>
</joint>
</ros2_control>
</xacro:unless>
<xacro:if value="$(arg sim_mode)">
<ros2_control name="GazeboSystem" type="system">
<hardware>
<plugin>gazebo_ros2_control/GazeboSystem</plugin>
</hardware>
<joint name="left_wheel_joint">
<command_interface name="velocity">
<param name="min">-10</param>
<param name="max">10</param>
</command_interface>
<state_interface name="velocity"/>
<state_interface name="position"/>
</joint>
<joint name="right_wheel_joint">
<command_interface name="velocity">
<param name="min">-10</param>
<param name="max">10</param>
</command_interface>
<state_interface name="velocity"/>
<state_interface name="position"/>
</joint>
</ros2_control>
</xacro:if>
<gazebo>
<plugin name="gazebo_ros2_control" filename="libgazebo_ros2_control.so">
<parameters>$(find articubot_one)/config/my_controllers.yaml</parameters>
<parameters>$(find articubot_one)/config/gaz_ros2_ctl_use_sim.yaml</parameters>
</plugin>
</gazebo>
</robot>
for full code check repo: https://github.com/joshnewans/articubot_one. i think that code in question from here.
ummm... He did it. He parse xacro file which include ros2_control tag along with gazebo_ros2_control plugin. robot.urdf.xacro
No he did not? At least from the launch files he added here. See the launch_robot.launch.py in the linked repo
Maybe he didn't install gazebo_ros2_control package? Because, when i check install folder, i didn't find it, after installing my error is gone, and controller_manager load. But, you point to a launch, that make sense on real robot, not for gazebo simulation. Here 2 launch file, launch_sim.launch.py and launch_robot.launch.py P.S. Sorry for my bad english.
Describe the bug I am trying to run a differential drive robot in my computer. The controls are working fine when used gazebo_controls but when I am switching to ros2_controls, the following errors are received. I am using ros2 humble version.
here is my launch file,
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription from launch.actions import IncludeLaunchDescription from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch_ros.actions import Node
def generate_launch_description():
import os
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription from launch.substitutions import LaunchConfiguration from launch.actions import DeclareLaunchArgument from launch_ros.actions import Node
import xacro
def generate_launch_description():