Hello,
Let me start off by saying im a rookie at this pixhawk and mavros stuff. I am using Ardusub V3.5.1.
My ultimate goal here is to make the pixhawk move my motors in any of the axes, X, Y and Z. Im running Ubuntu Mate on an ARMv7 chip. (ODroid XU3)
Note that i am not using any localisation techniques. I simply want to command a movement in a certain direction.
I have tried publishing to “/mavros/setpoint_velocity/cmd_vel” with no results. Of course, i armed it beforehand with “rosrun mavros mavsafety arm”
Here is the code i got online to publish cmd_vel:
#include <ros/ros.h>
#include <std_msgs/String.h>
#include <stdio.h>
#include “geometry_msgs/TwistStamped.h”
#include “geometry_msgs/Vector3Stamped.h”
int M = 0;
int L = 0;
int main(int argc, char **argv)
{
geometry_msgs::TwistStamped msg;
ros::init(argc, argv, “move_pix”);
ros::NodeHandle nh;
ros::Publisher velocity_message = nh.advertise<geometry_msgs::TwistStamped>(“/mavros/setpoint_velocity/cmd_vel”,100);
ros::Rate loop_rate(10);
while(ros::ok()){
msg.header.stamp = ros::Time::now();
msg.header.seq=1;
msg.twist.linear.x = 1;
msg.twist.linear.y = 1;
msg.twist.linear.z = 1;
msg.twist.angular.x = 0;
msg.twist.angular.y = 0;
msg.twist.angular.z = 0;
velocity_message.publish(msg);
ros::spinOnce();
loop_rate.sleep();
M++;
L++;
}
return 0;
}
Can someone advise on how i should go about achieving my goal? Thanks a bunch