sudo apt update
sudo apt install ros-humble-turtlesim
ros2 pkg executables turtlesim
ros2 run turtlesim turtlesim_node
Output:
[INFO] [turtlesim]: Starting turtlesim with node name /turtlesim
[INFO] [turtlesim]: Spawning turtle [turtle1] at x=[5.544445], y=[5.544445], theta=[0.000000]
ros2 run turtlesim turtle_teleop_key
sudo apt update
sudo apt install ~nros-humble-rqt*
rqt
ros2 run turtlesim turtle_teleop_key --ros-args --remap turtle1/cmd_vel:=turtle2/cmd_vel
ros2 pkg create --build-type ament_python py_pubsub
wget https://raw.githubusercontent.com/ros2/examples/humble/rclpy/topics/minimal_publisher/examples_rclpy_minimal_publisher/publisher_member_function.py
Some changes are made to the created files, then:
wget https://raw.githubusercontent.com/ros2/examples/humble/rclpy/topics/minimal_subscriber/examples_rclpy_minimal_subscriber/subscriber_member_function.py
rosdep install -i --from-path src --rosdistro humble -y
. install/setup.bash
ros2 run py_pubsub talker
ros2 run py_pubsub listener
Relevant files are opened and adjusted according to the official website. Some new files will also be created. Then:
rosdep install -i --from-path src --rosdistro humble -y
colcon build --packages-select py_srvcli
In a new terminal:
. install/setup.bash
ros2 run py_srvcli service
In the third terminal:
ros2 run py_srvcli client 2 3
ros2 pkg create --build-type ament_cmake tutorial_interfaces
mkdir msg
mkdir srv
Several files will be created and edited. Then:
colcon build --packages-select tutorial_interfaces
In a new terminal:
. install/setup.bash
ros2 interface show tutorial_interfaces/msg/Num
ros2 interface show tutorial_interfaces/msg/Sphere
ros2 interface show tutorial_interfaces/srv/AddThreeInts
After that changes are made to the publisher and subscriber files. After all the changes:
colcon build --packages-select cpp_pubsub
Two new terminals will be opened and sourced. Then:
ros2 run py_pubsub talker
ros2 run py_pubsub listener
This includes creating two python files for action.:
gedit fibonacci_action_server.py
gedit fibonacci_action_client.py
After making changes, we run them using python3 in separate terminals:
python3 fibonacci_action_server.py
python3 fibonacci_action_client.py
ros2 component types
ros2 run rclcpp_components component_container
ros2 component list
ros2 component load /ComponentManager composition composition::Talker
ros2 component load /ComponentManager composition composition::Listener
ros2 component load /ComponentManager composition composition::Server
ros2 component load /ComponentManager composition composition::Client
ros2 run composition manual_composition
ros2 component unload /ComponentManager 1 2
ros2 run rclcpp_components component_container --ros-args -r __node:=MyContainer -r __ns:=/ns
ros2 component load /ComponentManager composition composition::Talker --node-name talker2
ros2 component load /ComponentManager composition composition::Talker --node-namespace /ns
ros2 component load /ComponentManager composition composition::Talker --node-name talker3 --node-namespace /ns2
ros2 component load /ComponentManager image_tools image_tools::Cam2Image -p burger_mode:=true
ros2 component load /ComponentManager composition composition::Talker -e use_intra_process_comms:=true
mkdir launch
Creating new files will be included in this task.
cd launch
ros2 launch turtlesim_mimic_launch.py
ros2 topic pub -r 1 /turtlesim1/turtle1/cmd_vel geometry_msgs/msg/Twist "{linear: {x: 2.0, y: 0.0, z: 0.0}, angular: {x: 0.0, y: 0.0, z: -1.8}}"
rqt_graph
mkdir -p launch_ws/src
cd launch_ws/src
ros2 pkg create py_launch_example --build-type ament_python
Several changes are made to the auto-created files inside the package
colcon build
ros2 launch py_launch_example my_script_launch.py
ros2 pkg create launch_tutorial --build-type ament_python
mkdir launch_tutorial/launch
After creating new files and making changes to some of the existing ones:
colcon build
ros2 launch launch_tutorial example_main.launch.py
ros2 launch launch_tutorial example_substitutions.launch.py --show-args
ros2 launch launch_tutorial example_substitutions.launch.py turtlesim_ns:='turtlesim3' use_provided_red:='True' new_background_r:=200
sudo apt-get install ros-humble-turtle-tf2-py ros-humble-tf2-tools ros-humble-tf-transformations
ros2 launch turtle_tf2_py turtle_tf2_demo.launch.py
ros2 run turtlesim turtle_teleop_key
ros2 run tf2_tools view_frames
ros2 run tf2_ros tf2_echo [reference_frame] [target_frame]
ros2 run tf2_ros tf2_echo turtle2 turtle1