1- Install ROS2-Humble & colcon(to build the packages) 2- Add it to enviromental variables
gedit ~/.bashrc
source /opt/ros/humble/setup.bash
source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash
test it using 3 terminals
ros2 run demo_nodes_cpp talker
ros2 run demo_nodes_cpp listener
rqt_graph
mkdir ros2_ws
cd ros2_ws
mkdir src
colcon build # it will craete all necessary files and folders including setup.bash so you can run it using
source ~/dev/ros2_ws/install/setup.bash
cd src
ros2 pkg create my_robot_controler --build-type ament_python (youc n also use ament_cmake) --dependencies rclpy
cd ..
colcon build
cd my_robot_controler/my_robot_controler
touch my_first_node.py
chmod +x my_first_node.py
#write your code inside my_first_node (check the example in this repo) first send second line should be #!/usr/bin/env python3 & import rclpy import Node class and inherit from that
run the code itself using ./myfirstnode To be able to run it on your ros2 run you need to add it to setup.py in section"entry_points" e.g sudo vim src/my_robotcontroler/setup.py entry_points={'console_scripts': ["test_node= my_robot_controler.my_first_node:main"],}
cd ~/dev/ros2_ws
colcon build
source ~./bashrc
ros2 run my_robot_controler test_node
if you dont want to type "colcon build" each time you make changes to your code you can type "colcon build --symlink-install" once
Feature/Component | Description |
---|---|
ros2 node list | list of nodes |
ros2 node info | get info |
ros2 topic list | list of topics |
ros2 topic info | get info |
ros2 topic echo | see output of a publisher |
ros2 topic hz | see frequency of publisher outputs |
ros2 interface show | see data structure of input or output for the topic aftergetting the topic info |
ros2 service list | list of services |
ros2 service type | type of service |
ros2 interface show | show data |
rqt_qrt | show the gragh |
colcon build | build project |
colcon build --packages-up-to time_controler | build a specific package only |
ros2 run time_controler nmea_subscriber | |
ros2 launch fixposition_driver_ros2 tcp.launch | |
create client. service, publisher, subsriber | different type of constructors |
use installation here:// https://tsn.readthedocs.io/timesync.html#introduction//
1- check ethernets
ip link show
2- use ethtool to check if an eth send the ptp
ethtool -T <name from list above>
3- use this command
sudo ptp4l -i eno1 -f configs/gPTP.cfg --step_threshold=1 -m
4- get check_clocks.c and compile it (check if your pc clock is synchronized)
gcc -o check_clocks check_clocks.c
sudo ./check_clocks -d <name from list above>
Clocks on this system are synchronized :)