Closed ArkadiuszNiemiec closed 5 years ago
As I said: I have also tested scripts and followed instructions in PX4 docks but ended up with same results.
But I will do a clean VM with Ubuntu 18.04 and test it again.
Try using the build_all.bash
script and then use the respective opened terminals to launch the respective daemons and nodes. If you are not planning to use ROS 1, then just use the build_ros2_workspace.bash
. Any if these scripts will setup the environments properly on your terminals.
I have prepared a Dockerfile to test px4_ros_com
: https://github.com/ArkadiuszNiemiec/px4_ros_com/tree/master/docker
Dockerfile includes your px4-dev-ros2-crystal
image, clones PX4 Firmware and do a px4_ros_com
setup the same way the docs and script does:
# --- px4_ros_com ---
RUN ["/bin/bash", "-c", "\
cd ${HOME_DIR} && \
mkdir -p ${HOME_DIR}/px4_ros_com_ros2/src && \
git clone https://github.com/PX4/px4_ros_com.git ${HOME_DIR}/px4_ros_com_ros2/src/px4_ros_com && \
git clone https://github.com/PX4/px4_msgs.git ${HOME_DIR}/px4_ros_com_ros2/src/px4_msgs && \
source /opt/ros/melodic/setup.bash && \
source /opt/ros/crystal/setup.bash && \
cd ${HOME_DIR}/px4_ros_com_ros2 && colcon build --symlink-install --event-handlers console_direct+ \
"]
At the end I am launching a screenrc file that has three sessions: first launches a px4_sitl_rtps
, second one launches micrortps_agent -t UDP
and the third one is launching sensor_combined_listener
. I am manually starting the micrortps_client start -t UDP
in SITL session.
When I change line 36 in Dockerfile (cd ${HOME_DIR}/px4_ros_com_ros2 && colcon build --symlink-install --event-handlers console_direct+ \
) to ${HOME_DIR}/px4_ros_com_ros2/src/px4_ros_com/scripts/ build_ros2_workspace.bash
I got this message:
Cloning into '/root/px4_ros_com_ros2/src/px4_ros_com'...
Cloning into '/root/px4_ros_com_ros2/src/px4_msgs'...
ROS_DISTRO was set to 'melodic' before. Please make sure that the environment does not mix paths from different distributions.
Cloning into 'ros1_bridge'...
[3.793s] ERROR:colcon.colcon_core.package_identification:ROS package '/opt/ros/crystal/share/demo_nodes_py' with build type 'ament_python' has no 'setup.py' file
[3.844s] ERROR:colcon.colcon_core.package_identification:ROS package '/opt/ros/crystal/share/examples_rclpy_executors' with build type 'ament_python' has no 'setup.py' file
[3.846s] ERROR:colcon.colcon_core.package_identification:ROS package '/opt/ros/crystal/share/examples_rclpy_minimal_client' with build type 'ament_python' has no 'setup.py' file
[3.849s] ERROR:colcon.colcon_core.package_identification:ROS package '/opt/ros/crystal/share/examples_rclpy_minimal_publisher' with build type 'ament_python' has no 'setup.py' file
[3.851s] ERROR:colcon.colcon_core.package_identification:ROS package '/opt/ros/crystal/share/examples_rclpy_minimal_service' with build type 'ament_python' has no 'setup.py' file
[3.854s] ERROR:colcon.colcon_core.package_identification:ROS package '/opt/ros/crystal/share/examples_rclpy_minimal_subscriber' with build type 'ament_python' has no 'setup.py' file
[4.123s] ERROR:colcon.colcon_core.package_identification:ROS package '/opt/ros/crystal/share/teleop_twist_keyboard' with build type 'ament_python' has no 'setup.py' file
[4.179s] ERROR:colcon.colcon_core.package_identification:ROS package '/opt/ros/crystal/share/topic_monitor' with build type 'ament_python' has no 'setup.py' file
so I changed the script to manually building the px4_ros_com_ros2
workspace. I will test if further.
micrortps_client status
confirms that the client is working on PX4 SITL but there's no message in micrortps_agent
and in sensor_combined_listener
.
Typing ros2 topic hz /SensorCombined_topic
in fourth sessions returns:
WARNING: topic [/SensorCombined_topic] does not appear to be published yet
OR
Cannot echo topic '/SensorCombined_topic', as it contains more than one type: [px4_msgs/SensorCombined, px4_ros_com/SensorCombined]
The problem you report in 3. is known and is going tl be solved soon (it has to do with the major reestructure that happened on the repo).
And the problem no 1 is the problem with using a script in Dockerfile. The '$ROS_WS_DIR' is /
and that's not a correct path. We can ignore it.
So the only problem is that sensor_combined_listener
is not reporting any data and I cannot print them using ros2 topic echo
.
And the problem no 1 is the problem with using a script in Dockerfile. The '$ROS_WS_DIR' is / and that's not a correct path. We can ignore it.
The only problem there is that you are not using the script correctly. It should be ./build_all.bash --ros1_ws_dir <your/path/to/ros1_ws>
.
So the only problem is that sensor_combined_listener is not reporting any data and I cannot print them using ros2 topic echo.
Solution coming soon.
Ok, thanks. I will debug the software myself so I can contribute in the future.
@ArkadiuszNiemiec the related issue is https://github.com/PX4/px4_ros_com/issues/14 and it got fixed now. Closing this as solved.
@TSC21 yes, this fixes my problems. Thanks.
I am trying to run
px4_ros_com
onUbuntu 18.04
but have some problems. Can you tell me what's wrong? This is what I did:export FASTRTPSGEN_DIR=/home/aniemiec/eProsima_FastRTPS-1.7.1-Linux/bin
to~/.bashrc
and restarted the sessionROS2 Crystal
by following Building ROS 2 on Linuxpx4_msgs
to ~/ros2_ws/src/px4_ros_com
to ~/ros2_ws/src/genmsg
by executingsudo apt install ros-melodic-genmsg
ros
by executingsource /opt/ros/melodic/setup.bash
ros2_ws
by executingsource ~/ros2_ws/install/local_setup.bash
ros2_ws
by executingcolcon build --symlink-install
ros2_ws
by executingsource ~/ros2_ws/install/local_setup.bash
cd ~/src/Firmware/; make px4_sitl_rtps gazebo
micrortps_client start -t UDP
inside aNuttShell
micrortps_agent -t UDP
in first terminal.To test my setup I opened a third terminal, sourced
ros2_ws
and listed topics. This genertated an error:Sourcing ros2_ws by
source ~/ros2_ws/install/setup.bash
generates this message:This sourcing allows me to run
ros2 topic list
but I got this error when I echo any topic:I have also tested scripts and followed instructions in PX4 docks but ended up with same results.