Open GilmarCorreia opened 2 years ago
[ign gazebo-1] [libprotobuf ERROR google/protobuf/descriptor_database.cc:58] File already exists in database: ignition/msgs/actor.proto [ign gazebo-1] [libprotobuf FATAL google/protobuf/descriptor.cc:1358] CHECK failed: GeneratedDatabase()->Add(encoded_file_descriptor, size): [ign gazebo-1] terminate called after throwing an instance of 'google::protobuf::FatalException' [ign gazebo-1] what(): CHECK failed: GeneratedDatabase()->Add(encoded_file_descriptor, size):
I can deduce from this error that you are compiling ign_ros2_control with one ignition version but you are trying to run the plugin with another one.
Two questions:
ign_ros2_control
did you set export IGNITION_VERSION=fortress
?After a feel tryings, I could see my mistake. To the plugin work properly I had to clone the ign_ros2_control (branch Foxy) into my ros2 workspace (not working with: sudo apt-get install ros-foxy-ign-ros2-control).
Now I'm facing another issue, specially when changing robot namespace. In the robot, I've done this steps to configure a new namespace:
<gazebo>
<plugin filename="libign_ros2_control-system.so" name="ign_ros2_control::IgnitionROS2ControlPlugin">
<ros>
<namespace>/model/$(arg robot_name)</namespace>
</ros>
<parameters>$(find ntu_gazebo)/models/teste_bot_v2/config/teste_bot_v2_controller.yaml</parameters>
</plugin>
</gazebo>
The launch file has this configuration:
def generate_launch_description():
ntu_gazebo_path = get_package_share_path('ntu_gazebo')
default_model = 'teste_bot_v2'
model_arg = DeclareLaunchArgument(name='model', default_value=str(default_model), description='Set the robot model to spawn')
model_name_arg = DeclareLaunchArgument(name='model_name', default_value=str(default_model), description='Set the robot model_name')
model = LaunchConfiguration('model')
model_name = LaunchConfiguration('model_name')
GLOBAL_NS = model_name
robot_description = ParameterValue(Command(['xacro '+str(ntu_gazebo_path)+"/models/",model,"/urdf/",model,".xacro robot_name:=",model_name]),
value_type=str)
robot_state_publisher_node = Node(
package='robot_state_publisher',
executable='robot_state_publisher',
namespace = ['/model/',GLOBAL_NS],
output='screen',
parameters=[{'robot_description': robot_description.value}],
)
ignition_spawn_entity = Node(
package='ros_ign_gazebo',
executable='create',
output='screen',
namespace = ['/model/',GLOBAL_NS],
arguments=['-string', robot_description.value,
'-name', model_name,
'-allow_renaming', 'true'],
)
cm_node_name = ["model/",GLOBAL_NS,"/controller_manager"]
load_joint_state_controller = ExecuteProcess(
cmd=['ros2', 'control', 'load_controller', '--controller-manager', cm_node_name, '--set-state', 'start',
'joint_state_broadcaster'],
output='screen'
)
load_diff_drive_controller = ExecuteProcess(
cmd=['ros2', 'control', 'load_controller', '--controller-manager', cm_node_name, '--set-state', 'start',
'diff_drive_base_controller'],
output='screen'
)
return LaunchDescription([
RegisterEventHandler(
event_handler=OnProcessExit(
target_action=ignition_spawn_entity,
on_exit=[load_joint_state_controller],
)
),
RegisterEventHandler(
event_handler=OnProcessExit(
target_action=load_joint_state_controller,
on_exit=[load_diff_drive_controller],
)
),
robot_state_publisher_node,
ignition_spawn_entity,
model_arg,
model_name_arg
])
Meanwhile, the robot .yaml has this configuration:
controller_manager:
ros__parameters:
update_rate: 1000 # Hz
velocity_controller:
type: velocity_controllers/JointGroupVelocityController
joint_state_broadcaster:
type: joint_state_broadcaster/JointStateBroadcaster
velocity_controller:
ros__parameters:
joints:
- left_wheel_joint
- right_wheel_joint
command_interfaces:
- velocity
state_interfaces:
- position
- velocity
When I remove the namespace from the nodes and the .xacro file the controllers load fine. But when I add (
[ign gazebo-1] [ERROR] [1646850252.337324700] [model.r2d2.controller_manager]: The 'type' param not defined for 'joint_state_broadcaster'.
Environment
Error: Hello Ignition developers. I'm trying to spawn a robot inside Ignition Fortress using Ros2 (Foxy) but I'm facing some issues, especially when using libign_ros2_control-system.so plugin inside .urdf model.
The spawn it's working successfully when commenting the following line:
When I uncomment this line, the following error appears:
Could someone help me to solve this issue? I've just started learning how to use ros2_control, but it's quite confusing (If someone has any kind of book or course to recommend to me, I will be thankful).