Simulating Manual Control using Mavros

You will need to select the SimpleROV-4 and modify the PID values for this frame.

I did select SimpleROV-4 but it still didn’t work. I assume the PID values can be modified using Qground in the parameters tab?

I’m really sorry for delay to answer !
You can configure the PIDs using QGC.

I’ve been busy too haha. Btw i red through the PID control docs and they seem to adjust gain of PID and rates. But my issue is that it spins the wrong thrusters on stabilize.

Hi a little update. I’ve switched to using depth_hold/alt_hold mode. But thing is i don’t know why when i activate it, it does not go to my set depth, “SURFACE_DEPTH = -50.0”. It just stays at the surface. though it tries periodically to correct but never does.

surface_depth is the minimum depth, in other words, how high can the ROV go, if you want to use depth/alt_hold surface_depth need to be zero or the depth value that the ROV read when is armed underwater, you can check what I’m talking about here. A high surface_depth value will make the ROV to try to fly :slight_smile:

If you want to set the depth_hold, just go to the depth you want and start the mode, it’ll try to maintain it. But, to do such thing, you’ll need to go deeper than surface_depth value.

Right! I was under the assumtion that depth hold would dive the AUV automatically. The default surface_depth parameter was - 10cm. Ive since changed it to 0

After testing it seems to work out as planned.

On another note, the auv seems that i cannot move straight and drifts to the left everytime. How can i correct for this?

Can be many things:

  • Inconsistent drag between both sides
  • Uncalibrated joystick
  • Wrong roll estimation / calibration
  • Wrong ballast position

Probably these are the most common issues in this case.

Hi frozeneye,

I have merged the solution here, it was in a different open topic.

My best regards,

Okey, I have got both topics, thanks for you help!
Best wishes!:grinning:

Hi everyone,

Thanks @patrickelectric for your help, sincerously you have helped us a lot.

I have problems to try to use rostopic pub -r 1 /mavros/rc/override mavros_msgs/OverrideRCIn '[1300, 1300, 1300, 1300, 0, 0, 0, 0]'

Issues: The application doesnt have GPS and it should work in ROS without jostick.

I just want to control each motor sending the reference from mavros.

Could you help me with this problem? I’m rookie using this hardware, I have experiencie with ROS.

Kind Regards from Spain!

More info:

ubuntu@ubiquityrobot:~$ rostopic echo -n1 /mavros/state
header: 
  seq: 1121
  stamp: 
    secs: 1539186543
    nsecs: 496607585
  frame_id: ''
connected: True
armed: True
guided: False
mode: "MANUAL"
system_status: 3

ubuntu@ubiquityrobot:~$ rostopic echo -n1 /diagnostics 
header: 
  seq: 884
  stamp: 
    secs: 1539186579
    nsecs: 365087177
  frame_id: ''
status: 
  - 
    level: 0
    name: "mavros: FCU connection"
    message: "connected"
    hardware_id: "/dev/ttyACM0:57600"
    values: 
      - 
        key: "Received packets:"
        value: "55504"
      - 
        key: "Dropped packets:"
        value: "0"
      - 
        key: "Buffer overruns:"
        value: "0"
      - 
        key: "Parse errors:"
        value: "0"
      - 
        key: "Rx sequence number:"
        value: "117"
      - 
        key: "Tx sequence number:"
        value: "195"
      - 
        key: "Rx total bytes:"
        value: "8992398"
      - 
        key: "Tx total bytes:"
        value: "402247"
      - 
        key: "Rx speed:"
        value: "8426.000000"
      - 
        key: "Tx speed:"
        value: "370.000000"
  - 
    level: 2
    name: "mavros: GPS"
    message: "No satellites"
    hardware_id: "/dev/ttyACM0:57600"
    values: 
      - 
        key: "Satellites visible"
        value: "0"
      - 
        key: "Fix type"
        value: "0"
      - 
        key: "EPH (m)"
        value: "99.99"
      - 
        key: "EPV (m)"
        value: "0.00"
  - 
    level: 0
    name: "mavros: Heartbeat"
    message: "Normal"
    hardware_id: "/dev/ttyACM0:57600"
    values: 
      - 
        key: "Heartbeats since startup"
        value: "1156"
      - 
        key: "Frequency (Hz)"
        value: "0.999989"
      - 
        key: "Vehicle type"
        value: "Submarine"
      - 
        key: "Autopilot type"
        value: "ArduPilotMega / ArduCopter"
      - 
        key: "Mode"
        value: "MANUAL"
      - 
        key: "System status"
        value: "Standby"
  - 
    level: 0
    name: "mavros: System"
    message: "Normal"
    hardware_id: "/dev/ttyACM0:57600"
    values: 
      - 
        key: "Sensor present"
        value: "0x0020FC0F"
      - 
        key: "Sensor enabled"
        value: "0x00209C0F"
      - 
        key: "Sensor helth"
        value: "0x0020FC0F"
      - 
        key: "3D gyro"
        value: "Ok"
      - 
        key: "3D accelerometer"
        value: "Ok"
      - 
        key: "3D magnetometer"
        value: "Ok"
      - 
        key: "absolute pressure"
        value: "Ok"
      - 
        key: "3D angular rate control"
        value: "Ok"
      - 
        key: "attitude stabilization"
        value: "Ok"
      - 
        key: "yaw position"
        value: "Ok"
      - 
        key: "motor outputs / control"
        value: "Ok"
      - 
        key: "AHRS subsystem health"
        value: "Ok"
      - 
        key: "CPU Load (%)"
        value: "31.4"
      - 
        key: "Drop rate (%)"
        value: "0.0"
      - 
        key: "Errors comm"
        value: "0"
      - 
        key: "Errors count #1"
        value: "0"
      - 
        key: "Errors count #2"
        value: "0"
      - 
        key: "Errors count #3"
        value: "0"
      - 
        key: "Errors count #4"
        value: "0"
  - 
    level: 1
    name: "mavros: Battery"
    message: "Low voltage"
    hardware_id: "/dev/ttyACM0:57600"
    values: 
      - 
        key: "Voltage"
        value: "0.00"
      - 
        key: "Current"
        value: "-0.0"
      - 
        key: "Remaining"
        value: "-1.0"
  - 
    level: 0
    name: "mavros: Time Sync"
    message: "Normal"
    hardware_id: "/dev/ttyACM0:57600"
    values: 
      - 
        key: "Timesyncs since startup"
        value: "11572"
      - 
        key: "Frequency (Hz)"
        value: "9.999911"
      - 
        key: "Last RTT (ms)"
        value: "23.255099"
      - 
        key: "Mean RTT (ms)"
        value: "16.754528"
      - 
        key: "Last remote time (s)"
        value: "1528.361931000"
      - 
        key: "Estimated time offset (s)"
        value: "1539185050.909203291"
---

Issues: The application doesnt have GPS and it should work in ROS without jostick.

Neither of these are required. Please give more information on your methodology, the output you see, and how you are identifying that there is a problem.

Use ArduSub STABLE firmware version 3.5.3

Hi @jwalser,

Thanks for your answer. In this case, we need to work with a specific frame. We have 4 thrusters and we considered than create a new frame was better than use a custom frame. What is the problem with that? We have build the ardusub and using the topic before named, it doesnt work. We have tried another methods but we dont have idea what is the wrong. For the moment, we cannt move the motor individualy.

About the methodology, it is simply. The robot has 4 thrusters like a drone, but we need to control them from ROS, without GPS and without joystick. Trying to move any motor from ros topic doesnt work, but using the test mode it works, and using one joystick too. Maybe the problem is the correct form to move the motors (plug algorithm, first enable X mode, after set mode X . . .)

I hope, you could help us, we have spend a lot of time with this problem!

Thanks a lot!

Thanks for your answer. In this case, we need to work with a specific frame. We have 4 thrusters and we considered than create a new frame was better than use a custom frame. What is the problem with that? We have build the ardusub and using the topic before named, it doesnt work. We have tried another methods but we dont have idea what is the wrong. For the moment, we cannt move the motor individualy.

You are presenting multiple problems at once with not enough detail to help you with any of them. Present one problem at a time, specifically.

About the methodology, it is simply. The robot has 4 thrusters like a drone, but we need to control them from ROS, without GPS and without joystick. Trying to move any motor from ros topic doesnt work, but using the test mode it works, and using one joystick too. Maybe the problem is the correct form to move the motors (plug algorithm, first enable X mode, after set mode X . . .)

As above, this is not enough information to determine what your problem is. You must show us the steps that you take to realize the problem, so that we may reproduce it here using the same steps.

Hi again,

The main problem is that we need to move the motors individually from ROS.

What steps we have taken:

  1. We create a frame and compile ardusub. it did not work So we decided to do the test with the frame of 4 thrusters that comes by default.

  2. Sending information from the ROS Topic does not work, but it works if the information is sent from a joystick in QGC. The tests of each motor in QGC also work. We believe that hardware problems are not.

  3. The information provided through ROS lets you know that it is configured correctly, or at least in this thread it is said to be done in that way.

  4. It would be better if we could control each motor individually, in our application we require it, hence we can not use the sending of information for services modifying parameters through Mavlink.

Thank you very much!

  1. We create a frame and compile ardusub. it did not work So we decided to do the test with the frame of 4 thrusters that comes by default.

I recommend you use the pre-compiled stable binaries until you learn more about how the system works.

  1. Sending information from the ROS Topic does not work, but it works if the information is sent from a joystick in QGC. The tests of each motor in QGC also work. We believe that hardware problems are not.

There is some problem with your methodology then. Please let us know exactly what you are trying with "Sending information from the ROS Topic does not work" so that we may observe the problem ourselves.

  1. The information provided through ROS lets you know that it is configured correctly, or at least in this thread it is said to be done in that way.

This is not clear. What information? How do you know that it is configured correctly?

  1. It would be better if we could control each motor individually, in our application we require it, hence we can not use the sending of information for services modifying parameters through Mavlink.

It is not possible to do individual motor control with ArduSub. It sounds like this precludes your requirements.

We are currently using a stable version.

When I say the information from ROS I refer to the rostopic pub -r 1 /mavros/rc/override mavros_msgs/OverrideRCIn '[1300, 1300, 1300, 1300, 0, 0, 0, 0]'

The information regarding the hardware configuration. The output of the rostopic echo /mavros/state and the rostopic echo /diagnostics. I can have a wrong configuration.

Is there a real option to move the motors individually from the ardusub?

Considering that I have to close a control loop.

Thanks!

When I say the information from ROS I refer to the rostopic pub -r 1 /mavros/rc/override mavros_msgs/OverrideRCIn '[1300, 1300, 1300, 1300, 0, 0, 0, 0]'

This is not the complete story, though. What did you do before you publish to this topic? How is the autopilot connected to the computer? How did you start ros? Are any other programs running that are communicating with the autopilot?

No. The idea is for ArduSub to handle all of the closed loop control, and you just tell it where to go or what to do.

First I connect the pixhawk to the computer. Then I throw the apm.launch of the mavros package, also try the px4.launch. Then I call the service for arming. At this point there are two things, with manual mode does not work, but when in stabilize mode it stabilizes itself.

I have chosen to read the topic of the information of the IMU to know if it is working correctly.

When I write that message it is armed and in manual mode. Does that mean it’s okay, or not?

As I mentioned earlier we would like to be able to control each motor individually. The idea of the project is to validate software that has autopilot functions.

Thanks!

Let me be clear, if you want help with this, you must demonstrate from beginning to end each command that you are entering, along with the output. This way, others can replicate what you are doing and finally give you some advice.

As I mentioned earlier we would like to be able to control each motor individually. The idea of the project is to validate software that has autopilot functions.