You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mavros: 2.4.0 (if I am correct)
ROS: foxy
Ubuntu: 20.04
[ ] ArduPilot
[ X ] PX4
Version: 1.15 beta
I have written a simple offboard code to use with px4 autopilot in sitl. My code's state callback works, however position callback is not being called. Beside this, when I run mavros with command: ros2 run mavros mavros_node --ros-args --param fcu_url:=udp://:14540@127.0.0.1:14557, I continuosly get this error: [ERROR] [1724271415.008343266] [mavros.odometry]: ODOM: Ex: Could not find a connection between 'map' and 'base_link_frd' because they are not part of the same tree.Tf has two or more unconnected trees.
Colcon builds this code successfully, switches vehicle to offboard, arms it and takes it off, but pose_cb is not called in this code. When I run ros2 topic echo command in another terminal I can see that the position is being published. Also, my code runs state callback successfully, when I cannot use the posiiton data in my code, did I installed mavros incorrectly? I added comment line where my code run in the simulation.
I hope I do not made a simple mistake with callbacks, thanks in advance to those who are interested.
Mavros: 2.4.0 (if I am correct)
ROS: foxy
Ubuntu: 20.04
[ ] ArduPilot
[ X ] PX4
Version: 1.15 beta
I have written a simple offboard code to use with px4 autopilot in sitl. My code's state callback works, however position callback is not being called. Beside this, when I run mavros with command: ros2 run mavros mavros_node --ros-args --param fcu_url:=udp://:14540@127.0.0.1:14557, I continuosly get this error: [ERROR] [1724271415.008343266] [mavros.odometry]: ODOM: Ex: Could not find a connection between 'map' and 'base_link_frd' because they are not part of the same tree.Tf has two or more unconnected trees.
Colcon builds this code successfully, switches vehicle to offboard, arms it and takes it off, but pose_cb is not called in this code. When I run ros2 topic echo command in another terminal I can see that the position is being published. Also, my code runs state callback successfully, when I cannot use the posiiton data in my code, did I installed mavros incorrectly? I added comment line where my code run in the simulation.
I hope I do not made a simple mistake with callbacks, thanks in advance to those who are interested.
This is my code:
#include <rclcpp/rclcpp.hpp>
#include <geometry_msgs/msg/pose_stamped.hpp>
#include <mavros_msgs/msg/state.hpp>
#include <mavros_msgs/srv/command_bool.hpp>
#include <mavros_msgs/srv/set_mode.hpp>
mavros_msgs::msg::State current_state;
void state_cb(const mavros_msgs::msg::State::SharedPtr msg) {
current_state = *msg;
}
geometry_msgs::msg::PoseStamped current_pose;
void pose_cb(const geometry_msgs::msg::PoseStamped::SharedPtr msg) {
RCLCPP_INFO(rclcpp::get_logger("rclcpp"), "Current pose: x=%f, y=%f, z=%f", msg->pose.position.x, msg->pose.position.y, msg->pose.position.z);
current_pose = *msg;
}
struct Point {
double x, y;
};
int main(int argc, char **argv) {
rclcpp::init(argc, argv);
std::shared_ptrrclcpp::Node node = rclcpp::Node::make_shared("position_node");
// The code does not pass here. Because it does not obtain local position data from code.
}
The text was updated successfully, but these errors were encountered: