-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added a tutorial #8
Added a tutorial #8
Conversation
Hello! Just curious if this has been tried with multiple agents? Thanks |
Hi @jaypatrikar -- no I haven't tried it yet |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the thorough tutorial
I think overall it looks good, but I am a little uncomfortable of adding binary images to the repository. Would you be able to remove them from the commit, and reduce them / add them as text to the tutorial file?
@Jaeyoung-Lim binary images is good, why you don't like it? |
@mengchaoheng It is not good practice to have large binaries in trees since it increases the size of the repository. Also having screenshots of a terminal as a image does not provide more information compared to text |
All right. Can you fix it? @stevehenderson |
Yes, no problem! |
Yes, no problem! |
@stevehenderson Any updates? |
Hi @Jaeyoung-Lim I just pushed a new commit with the requested modifications. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the changes!
I left a few comments that would be nice to address
doc/ROS2_PX4_Offboard_Tutorial.md
Outdated
### Prerequisites | ||
|
||
* [ROS2 Installed](https://docs.px4.io/main/en/ros/ros2_comm.html#install-ros-2), and setup for your operating system (e.g. [Linux Ubuntu](https://docs.px4.io/main/en/dev_setup/dev_env_linux_ubuntu.html)) with Gazebo | ||
* [FastDDS Installed](https://docs.px4.io/main/en/dev_setup/fast-dds-installation.html) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This link seems to be dead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated. It doesnt seem fastdds is in the current px4 branch, so I linked to the last supported version.
doc/ROS2_PX4_Offboard_Tutorial.md
Outdated
|
||
### Example System Details | ||
|
||
* Ubuntu 22.02 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Ubuntu 22.02 | |
* Ubuntu 22.04 |
doc/ROS2_PX4_Offboard_Tutorial.md
Outdated
* [PX4-Autopilot downloaded](https://docs.px4.io/main/en/dev_setup/building_px4.html) | ||
* [QGroundControl installed](https://docs.qgroundcontrol.com/master/en/getting_started/download_and_install.html) | ||
|
||
### Example System Details |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be part of the Prerequisites
doc/ROS2_PX4_Offboard_Tutorial.md
Outdated
cd ~ | ||
mkdir px4_ros_com_ws | ||
cd px4_ros_com_ws | ||
git clone https://github.com/PX4/px4_ros_com.git |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need px4_ros_com
for this package to work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
doc/ROS2_PX4_Offboard_Tutorial.md
Outdated
``` | ||
cd ~ | ||
mkdir px4_ros_com_ws | ||
cd px4_ros_com_ws |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cd px4_ros_com_ws | |
cd <colcon_workspace_path> |
doc/ROS2_PX4_Offboard_Tutorial.md
Outdated
|
||
``` | ||
Starting >>> px4_msgs | ||
Finished <<< px4_msgs [6.42s] | ||
Starting >>> px4_ros_com | ||
Finished <<< px4_ros_com [0.13s] | ||
|
||
Summary: 2 packages finished [6.71s] | ||
``` | ||
|
||
You may see some warnings interspered with the output. As long as there are no __*errors*__ you should be OK.. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
``` | |
Starting >>> px4_msgs | |
Finished <<< px4_msgs [6.42s] | |
Starting >>> px4_ros_com | |
Finished <<< px4_ros_com [0.13s] | |
Summary: 2 packages finished [6.71s] | |
``` | |
You may see some warnings interspered with the output. As long as there are no __*errors*__ you should be OK.. |
doc/ROS2_PX4_Offboard_Tutorial.md
Outdated
#### Building the micro_ros_agent | ||
|
||
From: [Building micro-ROS-Agent](https://github.com/micro-ROS/micro_ros_setup#building-micro-ros-agent) | ||
|
||
``` | ||
cd ~ | ||
mkdir ~/microros_ws | ||
cd microros_ws | ||
git clone -b $ROS_DISTRO https://github.com/micro-ROS/micro_ros_setup.git | ||
mkdir src | ||
mv micro_ros_setup/ src/ | ||
``` | ||
|
||
*Note how the `ROS_DISTRO` environment variable is used to specify the correct branch... | ||
|
||
Now build | ||
|
||
|
||
``` | ||
colcon build | ||
source install/local_setup.sh | ||
ros2 run micro_ros_setup create_agent_ws.sh | ||
ros2 run micro_ros_setup build_agent.sh | ||
``` | ||
|
||
|
||
This should build and may flash a few warnings: | ||
|
||
``` | ||
colcon build | ||
[0.584s] WARNING:colcon.colcon_ros.prefix_path.ament:The path '/home/analyst/microros_ws/install/micro_ros_setup' in the environment variable AMENT_PREFIX_PATH doesn't exist | ||
[0.584s] WARNING:colcon.colcon_ros.prefix_path.ament:The path '/home/analyst/microros_ws/install/micro_ros_agent' in the environment variable AMENT_PREFIX_PATH doesn't exist | ||
[0.584s] WARNING:colcon.colcon_ros.prefix_path.ament:The path '/home/analyst/microros_ws/install/micro_ros_msgs' in the environment variable AMENT_PREFIX_PATH doesn't exist | ||
[0.585s] WARNING:colcon.colcon_ros.prefix_path.catkin:The path '/home/analyst/microros_ws/install/micro_ros_setup' in the environment variable CMAKE_PREFIX_PATH doesn't exist | ||
[0.585s] WARNING:colcon.colcon_ros.prefix_path.catkin:The path '/home/analyst/microros_ws/install/micro_ros_agent' in the environment variable CMAKE_PREFIX_PATH doesn't exist | ||
[0.585s] WARNING:colcon.colcon_ros.prefix_path.catkin:The path '/home/analyst/microros_ws/install/micro_ros_msgs' in the environment variable CMAKE_PREFIX_PATH doesn't exist | ||
Starting >>> micro_ros_setup | ||
Finished <<< micro_ros_setup [1.52s] | ||
|
||
Summary: 1 package finished [1.80s] | ||
analyst@casa:~/microros_ws$ source install/local_setup.sh | ||
analyst@casa:~/microros_ws$ ros2 run micro_ros_setup create_agent_ws.sh | ||
.. | ||
=== ./uros/micro-ROS-Agent (git) === | ||
Cloning into '.'... | ||
=== ./uros/micro_ros_msgs (git) === | ||
Cloning into '.'... | ||
#All required rosdeps installed successfully | ||
analyst@casa:~/microros_ws$ ros2 run micro_ros_setup build_agent.sh | ||
Building micro-ROS Agent | ||
[0.593s] WARNING:colcon.colcon_ros.prefix_path.ament:The path '/home/analyst/microros_ws/install/micro_ros_agent' in the environment variable AMENT_PREFIX_PATH doesn't exist | ||
[0.593s] WARNING:colcon.colcon_ros.prefix_path.ament:The path '/home/analyst/microros_ws/install/micro_ros_msgs' in the environment variable AMENT_PREFIX_PATH doesn't exist | ||
[0.593s] WARNING:colcon.colcon_ros.prefix_path.catkin:The path '/home/analyst/microros_ws/install/micro_ros_agent' in the environment variable CMAKE_PREFIX_PATH doesn't exist | ||
[0.593s] WARNING:colcon.colcon_ros.prefix_path.catkin:The path '/home/analyst/microros_ws/install/micro_ros_msgs' in the environment variable CMAKE_PREFIX_PATH doesn't exist | ||
Starting >>> micro_ros_msgs | ||
Finished <<< micro_ros_msgs [5.51s] | ||
Starting >>> micro_ros_agent | ||
--- stderr: micro_ros_agent | ||
Cloning into 'xrceagent'... | ||
Switched to a new branch 'ros2' | ||
HEAD is now at 3eb56b5 Release v2.3.0 | ||
CMake Warning (dev) at /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:438 (message): | ||
The package name passed to `find_package_handle_standard_args` (tinyxml2) | ||
does not match the name of the calling package (TinyXML2). This can lead | ||
to problems in calling code that expects `find_package` result variables | ||
(e.g., `_FOUND`) to follow a certain pattern. | ||
Call Stack (most recent call first): | ||
cmake/modules/FindTinyXML2.cmake:40 (find_package_handle_standard_args) | ||
/opt/ros/humble/share/fastrtps/cmake/fastrtps-config.cmake:51 (find_package) | ||
CMakeLists.txt:153 (find_package) | ||
This warning is for project developers. Use -Wno-dev to suppress it. | ||
|
||
--- | ||
Finished <<< micro_ros_agent [23.2s] | ||
|
||
Summary: 2 packages finished [29.0s] | ||
1 package had stderr output: micro_ros_agent | ||
|
||
``` | ||
|
||
Try running the agent: | ||
|
||
``` | ||
source install/local_setup.sh | ||
ros2 run micro_ros_agent micro_ros_agent udp4 --port 8888 | ||
``` | ||
|
||
It should respond with: | ||
|
||
``` | ||
[1670101284.566587] info | UDPv4AgentLinux.cpp | init | running... | port: 8888 | ||
[1670101284.566822] info | Root.cpp | set_verbose_level | logger setup | verbose_level: 4 | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we just link the instruction to an external link? building a micro-ros-agent is not really related to this package
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
``` | ||
cd ~/microros_ws | ||
export ROS_DOMAIN_ID=0 | ||
export PYTHONOPTIMIZE=1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. As a newbie, I struggled for hours before I realized that my ROS_DOMAIN_ID
had to be consistent across the 3 processes. PYTHONOPTIMIZE is required in my environment for GAZEBO to work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you know why PYTHONOPTIMIZE is required? what environment are you on?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My environment:
* Ubuntu 22.04
* ROS2 Humble
* Python 3.10
When I ran through this the first time, months ago, I got this error:
After several hours, I found the solution here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, strange
I added a step by step tutorial for this excellent repo.
Thank you @mengchaoheng for all the tips in #3