Unit2: What does source /home/simulations/ros2_sims_ws/install/setup.bash do?

Hello, I’m trying to get my robotic arm to work in gazebo on my local machine. But it seems like there is an issue when I launch it. I think all my gazebo and urdf things are okay. I now saw that i get the same behaviour in the unit 2 example when i not execute the command source /home/simulations/ros2_sims_ws/install/setup.bash. What does this do? How can I reproduce that on my local machine?

This is the behaviour without this source command. Its nearly the same on my local machine.

ros2 launch my_robot_bringup my_robot.launch.py
[INFO] [launch]: All log files can be found below /home/user/.ros/log/2024-03-03-14-34-22-717989-2_xterm-3976
[INFO] [launch]: Default logging verbosity is set to INFO

[INFO] [spawn_entity.py-1]: process started with pid [3978]
[INFO] [robot_state_publisher-2]: process started with pid [3980]
[robot_state_publisher-2] Link link1 had 1 children
[robot_state_publisher-2] Link link2 had 1 children
[robot_state_publisher-2] Link link3 had 1 children
[robot_state_publisher-2] Link camera_link had 1 children
[robot_state_publisher-2] Link camera_link_optical had 0 children
[robot_state_publisher-2] [INFO] [1709476464.596560724] [robot_state_publisher]: got segment camera_link
[robot_state_publisher-2] [INFO] [1709476464.596719866] [robot_state_publisher]: got segment camera_link_optical
[robot_state_publisher-2] [INFO] [1709476464.596748490] [robot_state_publisher]: got segment link1
[robot_state_publisher-2] [INFO] [1709476464.596765679] [robot_state_publisher]: got segment link2
[robot_state_publisher-2] [INFO] [1709476464.596783134] [robot_state_publisher]: got segment link3
[robot_state_publisher-2] [INFO] [1709476464.596800048] [robot_state_publisher]: got segment world
[spawn_entity.py-1] [INFO] [1709476468.679737790] [spawn_entity]: Spawn Entity started
[spawn_entity.py-1] [INFO] [1709476468.680330773] [spawn_entity]: Loading entity published on topic robot_description
[spawn_entity.py-1] [INFO] [1709476468.695792895] [spawn_entity]: Waiting for entity xml on robot_description
[spawn_entity.py-1] [INFO] [1709476468.699564239] [spawn_entity]: Waiting for service /spawn_entity, timeout = 5
[spawn_entity.py-1] [INFO] [1709476468.700240558] [spawn_entity]: Waiting for service /spawn_entity
[spawn_entity.py-1] [INFO] [1709476468.797434879] [spawn_entity]: Calling service /spawn_entity
[spawn_entity.py-1] [INFO] [1709476469.121975940] [spawn_entity]: Spawn status: SpawnEntity: Successfully spawned entity [robot]
[spawn_entity.py-1] /opt/ros/galactic/lib/python3.8/site-packages/rclpy/qos.py:307: UserWarning: DurabilityPolicy.RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL is deprecated. Use DurabilityPolicy.TRANSIENT_LOCAL instead.
[spawn_entity.py-1]   warnings.warn(
[INFO] [spawn_entity.py-1]: process has finished cleanly [pid 3978]
[INFO] [spawner-3]: process started with pid [4014]
[spawner-3] [INFO] [1709476471.190487958] [spawner_joint_state_broadcaster]: Waiting for /controller_manager services
[spawner-3] [INFO] [1709476473.204330486] [spawner_joint_state_broadcaster]: Waiting for /controller_manager services
[spawner-3] [INFO] [1709476475.215810131] [spawner_joint_state_broadcaster]: Waiting for /controller_manager services
[spawner-3] [INFO] [1709476477.250760414] [spawner_joint_state_broadcaster]: Waiting for /controller_manager services
[spawner-3] [INFO] [1709476479.263905187] [spawner_joint_state_broadcaster]: Waiting for /controller_manager services
[spawner-3] [ERROR] [1709476481.274753648] [spawner_joint_state_broadcaster]: Controller manager not available
[ERROR] [spawner-3]: process has died [pid 4014, exit code 1, cmd '/opt/ros/galactic/lib/controller_manager/spawner joint_state_broadcaster --controller-manager /controller_manager --ros-args'].
[INFO] [spawner-4]: process started with pid [4064]
[spawner-4] [INFO] [1709476481.827622049] [spawner_forward_position_controller]: Waiting for /controller_manager services
[spawner-4] [INFO] [1709476483.838453661] [spawner_forward_position_controller]: Waiting for /controller_manager services
[spawner-4] [INFO] [1709476485.849615618] [spawner_forward_position_controller]: Waiting for /controller_manager services
[spawner-4] [INFO] [1709476487.860064039] [spawner_forward_position_controller]: Waiting for /controller_manager services
[spawner-4] [INFO] [1709476489.870978040] [spawner_forward_position_controller]: Waiting for /controller_manager services
[spawner-4] [ERROR] [1709476491.881752627] [spawner_forward_position_controller]: Controller manager not available
[ERROR] [spawner-4]: process has died [pid 4064, exit code 1, cmd '/opt/ros/galactic/lib/controller_manager/spawner forward_position_controller -c /controller_manager --ros-args'].
^C[WARNING] [launch]: user interrupted with ctrl-c (SIGINT)
[robot_state_publisher-2] [INFO] [1709476511.531921217] [rclcpp]: signal_handler(signal_value=2)
[INFO] [robot_state_publisher-2]: process has finished cleanly [pid 3980]

And here is the correct behavior after this source command from Unit 2.

ros2 launch my_robot_bringup my_robot.launch.py
[INFO] [launch]: All log files can be found below /home/user/.ros/log/2024-03-03-14-35-17-808150-2_xterm-4192
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [spawn_entity.py-1]: process started with pid [4194]
[INFO] [robot_state_publisher-2]: process started with pid [4196]
[robot_state_publisher-2] Link link1 had 1 children
[robot_state_publisher-2] Link link2 had 1 children
[robot_state_publisher-2] Link link3 had 1 children
[robot_state_publisher-2] Link camera_link had 1 children
[robot_state_publisher-2] Link camera_link_optical had 0 children
[robot_state_publisher-2] [INFO] [1709476518.297313633] [robot_state_publisher]: got segment camera_link
[robot_state_publisher-2] [INFO] [1709476518.297644649] [robot_state_publisher]: got segment camera_link_optical
[robot_state_publisher-2] [INFO] [1709476518.297671806] [robot_state_publisher]: got segment link1
[robot_state_publisher-2] [INFO] [1709476518.297684910] [robot_state_publisher]: got segment link2
[robot_state_publisher-2] [INFO] [1709476518.297696774] [robot_state_publisher]: got segment link3
[robot_state_publisher-2] [INFO] [1709476518.297707912] [robot_state_publisher]: got segment world
[spawn_entity.py-1] [INFO] [1709476518.904607854] [spawn_entity]: Spawn Entity started
[spawn_entity.py-1] [INFO] [1709476518.905407953] [spawn_entity]: Loading entity published on topic robot_description
[spawn_entity.py-1] [INFO] [1709476518.909561356] [spawn_entity]: Waiting for entity xml on robot_description
[spawn_entity.py-1] [INFO] [1709476518.911730833] [spawn_entity]: Waiting for service /spawn_entity, timeout = 5
[spawn_entity.py-1] [INFO] [1709476518.912263024] [spawn_entity]: Waiting for service /spawn_entity
[spawn_entity.py-1] [INFO] [1709476518.917276786] [spawn_entity]: Calling service /spawn_entity
[spawn_entity.py-1] [INFO] [1709476519.221035117] [spawn_entity]: Spawn status: SpawnEntity: Successfully spawned entity [robot]
[spawn_entity.py-1] /opt/ros/galactic/lib/python3.8/site-packages/rclpy/qos.py:307: UserWarning: DurabilityPolicy.RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL is deprecated. Use DurabilityPolicy.TRANSIENT_LOCAL instead.
[spawn_entity.py-1]   warnings.warn(
[INFO] [spawn_entity.py-1]: process has finished cleanly [pid 4194]
[INFO] [spawner-3]: process started with pid [4215]
[spawner-3] [INFO] [1709476519.862023160] [spawner_joint_state_broadcaster]: Waiting for /controller_manager services
[spawner-3] [INFO] [1709476521.872013444] [spawner_joint_state_broadcaster]: Waiting for /controller_manager services
[spawner-3] [INFO] [1709476523.618676457] [spawner_joint_state_broadcaster]: Loaded joint_state_broadcaster
[spawner-3] [INFO] [1709476523.825767326] [spawner_joint_state_broadcaster]: Configured and started joint_state_broadcaster
[INFO] [spawner-3]: process has finished cleanly [pid 4215]
[INFO] [spawner-4]: process started with pid [4240]
[spawner-4] [INFO] [1709476524.479204507] [spawner_forward_position_controller]: Loaded forward_position_controller
[spawner-4] [INFO] [1709476524.689397522] [spawner_forward_position_controller]: Configured and started forward_position_controller
[INFO] [spawner-4]: process has finished cleanly [pid 4240]

Okay, i now got it to work by installing gazebo_ros2_control and after that got a message telling me it can’t load the controllers, through which i noticed that i don’t had ros2_control properly installed on this machine. Now it seems to work fine.

Hi @jonas.haeberli ,

Seems like your problem is fixed.

Anyways, since you asked, about the below line:
source /home/simulations/ros2_sims_ws/install/setup.bash

This is what that command does: It sets up the workspace for ROS2 to load simulation files that are already compiled in the /home/simulations/ros2_sims_ws path.
It is similar to sourcing install/setup.bash in your ros2_ws path where you source the compiled packages that you have made. The above command sources that compiled simulation-only packages that are in the above path.

I hope your doubt is now clarified.

Regards,
Girish

Hi @jonas.haeberli ,

I want to do the same thing as you this coming week how do you install gazebo_ros2_controls properly? I only found a GitHub link to all the controls from git page. Is it alright that I ask how you did it? This is the github I found for the install to pull the packages and compile. GitHub - ros-controls/gazebo_ros2_control at humble

I am testing it in my Ubuntu 22.04 ROS2 Humble machine.

Thank you again!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.