Open mariofaragalla opened 3 years ago
As i remember you cannot control at the same time position and velocity (or attitude?), in any case i suppose easier to use setpoint_raw for prototyping. Then check your autopilot code to see which type masks it supports.
What do you mean by prototyping? I tried to publish the desired position and velocity to the mavros/setpoint_raw/global
topic once from my ros node and another time using rostopic pub -r 50
but I didn't see any change with the drone's position or velocity in the gazebo simulation.
Did you update header.stamp? Update stream also should be frequent, else OFFBOARD would disable (or don't enable).
By prototyping i mean that it's easier to use existing plugin than do new one gust to try different type masks.
use the /mavros/setpoint_velocity/cmd_vel_unstamped
in offboard mode and publish this topic of type Twist
to control it with some teleop command node like teleop_twist_keyboard. You can use the PointTarget
message of topic /mavros/setpoint_raw/local
to takeoff to a certain height and start publishing velocity commands instead of position.
you don't have to edit .cpp files.
you can reffer to my code if you didn't understand
https://github.com/thitapi/Drone-sim/blob/main/exp1/src/px4/offboard.py
I have used this code as a base code and modified it to take teleop commands
https://akshayk07.weebly.com/offboard-control-of-pixhawk.html
This is only bug and feature tracker, please use it to report bugs or request features.
Issue details
I am working on a drone project I’m connecting ros to gazebo and using the mavros node of course. I would like to publish position messages to /mavros/setpoint_position/global topic and at the same time I’m trying to adjust the velocity with which the drone goes to the intended position using the /mavros/setpoint_velocity/cmd_vel, but it doesn’t work together. I think the problem is in the setpoint_position.cpp in this method:
void setpointg_cb(const geographic_msgs::GeoPoseStamped::ConstPtr &req) { using mavlink::common::POSITION_TARGET_TYPEMASK;
}
As I believe that this bit masking ignores the velocity change effects.
Thank you in advance.
MAVROS version and platform
Mavros: ?1.0.0? ROS: ?noetic? Ubuntu: ?20.04?
Autopilot type and version
[ ] ArduPilot [ ] PX4
Version: ?3.7.1?