Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

offboard reject #327

Closed
dreamkeep opened this issue Jul 2, 2015 · 8 comments
Closed

offboard reject #327

dreamkeep opened this issue Jul 2, 2015 · 8 comments
Labels

Comments

@dreamkeep
Copy link

@vooon when i switch to offboard ,it report that:

[ WARN] [1435839397.770402629]: GPS: no fix
[ERROR] [1435839407.447141970]: FCU: REJECT OFFBOARD
[ERROR] [1435839417.539181644]: FCU: REJECT OFFBOARD

when I run rosrun mavros mavsys mode -c OFFBOARD

it show :
Timed out!

this is my comand list:

roslaunch mavros px4.launch &

px4@ubilinux:~/ros_catkin_ws$ roslaunch mavros px4.launch &
[1] 2021
px4@ubilinux:~/ros_catkin_ws$ ... logging to /home/px4/.ros/log/b54007a4-20bb-11e5-b2f7-784b879ee7ab/roslaunch-ubilinux-2021.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://ubilinux:57735/

SUMMARY
========

CLEAR PARAMETERS
 * /mavros/

PARAMETERS
 * /mavros/cmd/use_comp_id_system_control: False
 * /mavros/conn/heartbeat: 5.0
 * /mavros/conn/system_time: 1.0
 * /mavros/conn/timeout: 10.0
 * /mavros/conn/timesync: 0.1
 * /mavros/fcu_url: /dev/ttyMFD1:57600
 * /mavros/gcs_url: udp://:14556@192....
 * /mavros/global_position/child_frame_id: fcu
 * /mavros/global_position/frame_id: local_origin
 * /mavros/global_position/rot_covariance: 99999.0
 * /mavros/global_position/send_tf: False
 * /mavros/gps/frame_id: gps
 * /mavros/image/frame_id: px4flow
 * /mavros/imu/angular_velocity_stdev: 0.000349065850399
 * /mavros/imu/frame_id: fcu
 * /mavros/imu/linear_acceleration_stdev: 0.0003
 * /mavros/imu/magnetic_stdev: 0.0
 * /mavros/imu/orientation_stdev: 1.0
 * /mavros/local_position/child_frame_id: fcu
 * /mavros/local_position/frame_id: local_origin
 * /mavros/local_position/send_tf: False
 * /mavros/mission/pull_after_gcs: True
 * /mavros/mocap/use_pose: True
 * /mavros/mocap/use_tf: False
 * /mavros/plugin_blacklist: ['image_pub', '3d...
 * /mavros/plugin_whitelist: []
 * /mavros/px4flow/frame_id: px4flow
 * /mavros/px4flow/ranger_fov: 0.0
 * /mavros/px4flow/ranger_max_range: 5.0
 * /mavros/px4flow/ranger_min_range: 0.3
 * /mavros/safety_area/p1/x: 1.0
 * /mavros/safety_area/p1/y: 1.0
 * /mavros/safety_area/p1/z: 1.0
 * /mavros/safety_area/p2/x: -1.0
 * /mavros/safety_area/p2/y: -1.0
 * /mavros/safety_area/p2/z: -1.0
 * /mavros/setpoint/accel/send_force: False
 * /mavros/setpoint_accel/send_force: False
 * /mavros/setpoint_attitude/child_frame_id: attitude
 * /mavros/setpoint_attitude/frame_id: local_origin
 * /mavros/setpoint_attitude/listen_tf: False
 * /mavros/setpoint_attitude/listen_twist: False
 * /mavros/setpoint_attitude/pose_with_covariance: False
 * /mavros/setpoint_attitude/reverse_throttle: False
 * /mavros/setpoint_attitude/tf_rate_limit: 10.0
 * /mavros/setpoint_position/child_frame_id: setpoint
 * /mavros/setpoint_position/frame_id: local_origin
 * /mavros/setpoint_position/listen_tf: False
 * /mavros/setpoint_position/tf_rate_limit: 50.0
 * /mavros/startup_px4_usb_quirk: True
 * /mavros/sys/disable_diag: False
 * /mavros/sys/min_voltage: 10.0
 * /mavros/target_component_id: 50
 * /mavros/target_system_id: 1
 * /mavros/tdr_radio/low_rssi: 40
 * /mavros/time/time_ref_source: fcu
 * /mavros/time/timesync_avg_alpha: 0.6
 * /mavros/vision_pose/child_frame_id: vision
 * /mavros/vision_pose/frame_id: local_origin
 * /mavros/vision_pose/listen_tf: False
 * /mavros/vision_pose/pose_with_covariance: False
 * /mavros/vision_pose/tf_rate_limit: 10.0
 * /mavros/vision_speed/listen_twist: False
 * /mavros/visualization/child_frame_id: fcu
 * /mavros/visualization/fixed_frame_id: local_origin
 * /mavros/visualization/marker_scale: 2.0
 * /rosdistro: indigo
 * /rosversion: 1.11.13

NODES
  /
    mavros (mavros/mavros_node)

auto-starting new master
process[master]: started with pid [2034]
ROS_MASTER_URI=http://localhost:11311

setting /run_id to b54007a4-20bb-11e5-b2f7-784b879ee7ab
process[rosout-1]: started with pid [2047]
started core service [/rosout]
process[mavros-2]: started with pid [2065]
[ INFO] [1435842631.490195336]: FCU URL: /dev/ttyMFD1:57600
[ INFO] [1435842631.492176042]: serial0: device: /dev/ttyMFD1 @ 57600 bps
[ INFO] [1435842631.515757539]: GCS URL: udp://:14556@192.168.11.6:14550
[ INFO] [1435842631.517619784]: udp1: Bind address: 0.0.0.0:14556
[ INFO] [1435842631.518500386]: udp1: Remote address: 192.168.11.6:14550
[ INFO] [1435842631.565450969]: Plugin 3dr_radio blacklisted
[ INFO] [1435842631.565981860]: Plugin actuator_control blacklisted
[ INFO] [1435842632.089080812]: Plugin command loaded and initialized
[ INFO] [1435842632.232367324]: Plugin ftp loaded and initialized
[ INFO] [1435842632.328589300]: Plugin global_position loaded and initialized
[ INFO] [1435842632.357806142]: Plugin gps loaded and initialized
[ INFO] [1435842632.459551724]: Plugin imu_pub loaded and initialized
[ INFO] [1435842632.504802612]: Plugin local_position loaded and initialized
[ INFO] [1435842632.537367521]: Plugin param loaded and initialized
[ INFO] [1435842632.591341465]: Plugin rc_io loaded and initialized
[ INFO] [1435842632.629340877]: SA: Set safty area: P1(1.000000 1.000000 1.000000) P2(-1.000000 -1.000000 -1.000000)
[ INFO] [1435842632.669942551]: Plugin safety_area loaded and initialized
[ INFO] [1435842632.721713932]: Plugin setpoint_accel loaded and initialized
[ INFO] [1435842632.722090897]: Plugin setpoint_attitude blacklisted
[ INFO] [1435842632.722407734]: Plugin setpoint_position blacklisted
[ INFO] [1435842632.722682124]: Plugin setpoint_velocity blacklisted
[ INFO] [1435842632.804802613]: Plugin sys_status loaded and initialized
[ INFO] [1435842632.863679056]: Plugin sys_time loaded and initialized
[ INFO] [1435842632.880861734]: Plugin vfr_hud loaded and initialized
[ INFO] [1435842632.938584938]: Plugin waypoint loaded and initialized
[ INFO] [1435842632.939091500]: Autostarting mavlink via USB on PX4
[ INFO] [1435842632.940299276]: Built-in mavlink dialect: ardupilotmega
[ INFO] [1435842632.941281180]: MAVROS started. MY ID [1, 240], TARGET ID [1, 50]
[ INFO] [1435842633.135966658]: High resolution IMU detected!
[ INFO] [1435842633.137634071]: RC_CHANNELS message detected!
[ INFO] [1435842633.403663278]: CON: Got HEARTBEAT, connected.
[ INFO] [1435842634.543793828]: High resolution IMU detected!
[ WARN] [1435842634.544686168]: GPS: no fix
[ INFO] [1435842634.546175757]: RC_CHANNELS message detected!
[ WARN] [1435842635.415967919]: VER: request timeout, retries left 1
[ WARN] [1435842636.415620519]: VER: request timeout, retries left 0
[ WARN] [1435842637.415424502]: VER: your FCU don't support AUTOPILOT_VERSION, switched to default capabilities
[ WARN] [1435842644.405430846]: PR: request list timeout, retries left 2
[ WARN] [1435842645.407261017]: PR: request list timeout, retries left 1
[ WARN] [1435842646.408217097]: PR: request list timeout, retries left 0
[ WARN] [1435842649.407130145]: WP: timeout, retries left 2
[ WARN] [1435842650.408128472]: WP: timeout, retries left 1
[ WARN] [1435842651.409173884]: WP: timeout, retries left 0
[ERROR] [1435842652.410243606]: WP: timed out.

and then I arm pixhawk on qgroundstation ,and it success arm.
then run ./setpoint_demo.py

then I switch mode to OFFBOARD ,so it show this:

[ WARN] [1435843066.282789513]: PR: request list timeout, retries left 0

[ERROR] [1435843071.536739849]: FCU: REJECT OFFBOARD

so I don't know how to fix this issue ,
this is my /diagnostics

rostopic echo -n1 /diagnostics
header: 
  seq: 994
  stamp: 
    secs: 1435843620
    nsecs: 771162107
  frame_id: ''
status: 
  - 
    level: 0
    name: mavros: FCU connection
    message: connected
    hardware_id: /dev/ttyMFD1:57600
    values: 
      - 
        key: Received packets:
        value: 22717
      - 
        key: Dropped packets:
        value: 0
      - 
        key: Buffer overruns:
        value: 0
      - 
        key: Parse errors:
        value: 0
      - 
        key: Rx sequence number:
        value: 76
      - 
        key: Tx sequence number:
        value: 46
      - 
        key: Rx total bytes:
        value: 865359
      - 
        key: Tx total bytes:
        value: 263111
      - 
        key: Rx speed:
        value: 1062.000000
      - 
        key: Tx speed:
        value: 260.000000
  - 
    level: 0
    name: mavros: GCS bridge
    message: connected
    hardware_id: /dev/ttyMFD1:57600
    values: 
      - 
        key: Received packets:
        value: 0
      - 
        key: Dropped packets:
        value: 0
      - 
        key: Buffer overruns:
        value: 0
      - 
        key: Parse errors:
        value: 0
      - 
        key: Rx sequence number:
        value: 0
      - 
        key: Tx sequence number:
        value: 0
      - 
        key: Rx total bytes:
        value: 0
      - 
        key: Tx total bytes:
        value: 865329
      - 
        key: Rx speed:
        value: 0.000000
      - 
        key: Tx speed:
        value: 1062.000000
  - 
    level: 2
    name: mavros: GPS
    message: No satellites
    hardware_id: /dev/ttyMFD1:57600
    values: 
      - 
        key: Satellites visible
        value: 0
      - 
        key: Fix type
        value: 0
      - 
        key: EPH (m)
        value: 0.00
      - 
        key: EPV (m)
        value: 0.00
  - 
    level: 0
    name: mavros: Heartbeat
    message: Normal
    hardware_id: /dev/ttyMFD1:57600
    values: 
      - 
        key: Heartbeats since startup
        value: 978
      - 
        key: Frequency (Hz)
        value: 0.999195
      - 
        key: Vehicle type
        value: Quadrotor
      - 
        key: Autopilot type
        value: PX4
      - 
        key: Mode
        value: MANUAL
      - 
        key: System status
        value: Active
  - 
    level: 0
    name: mavros: System
    message: Normal
    hardware_id: /dev/ttyMFD1:57600
    values: 
      - 
        key: Sensor present
        value: 0x00000000
      - 
        key: Sensor enabled
        value: 0x00000000
      - 
        key: Sensor helth
        value: 0x00000000
      - 
        key: CPU Load (%)
        value: 37.5
      - 
        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/ttyMFD1:57600
    values: 
      - 
        key: Voltage
        value: 0.00
      - 
        key: Current
        value: 0.0
      - 
        key: Remaining
        value: -1.0
  - 
    level: 2
    name: mavros: Time Sync
    message: No events recorded.
    hardware_id: /dev/ttyMFD1:57600
    values: 
      - 
        key: Timesyncs since startup
        value: 0
      - 
        key: Frequency (Hz)
        value: 0.000000
      - 
        key: Last dt (ms)
        value: 0.000000
      - 
        key: Mean dt (ms)
        value: 0.000000
      - 
        key: Last system time (s)
        value: 0.000000000
      - 
        key: Time offset (s)
        value: 0.000000000

---

what should i do?

@TSC21
Copy link
Member

TSC21 commented Jul 2, 2015

@dreamkeep are you sending any kind of setepoint stream to the FCU? (using setpoint plugins for example). Cause you have to. Otherwise FCU will reject changing to OFFBOARD mode 'cause it doesn't detect any external setpoint.

@wangsen1312
Copy link
Contributor

I have meet this. Now I use RC change to the Manual Mode and Offboard Mode, which seem works well.

@dreamkeep
Copy link
Author

I use RC change to the Manual mode is ok.

I use this setpoint example:

import rospy
import thread
import threading
import time

from geometry_msgs.msg import PoseStamped, Quaternion
from math import *
from mavros.srv import CommandBool
from mavros.utils import *
from std_msgs.msg import Header
from std_msgs.msg import String
from tf.transformations import quaternion_from_euler

class Setpoint:

    def __init__(self, pub, rospy):
        self.pub = pub
        self.rospy = rospy

        self.x = 0.0
        self.y = 0.0
        self.z = 0.0

        try:
            thread.start_new_thread( self.navigate, () )
        except:
            print "Error: Unable to start thread"

        # TODO(simon): Clean this up.
        self.done = False
        self.done_evt = threading.Event()
        sub = rospy.Subscriber('/mavros/local_position/local', PoseStamped, self.reached)

    def navigate(self):
        rate = self.rospy.Rate(10) # 10hz

        msg = PoseStamped()
        msg.header = Header() 
        msg.header.frame_id = "base_footprint"
        msg.header.stamp = rospy.Time.now()

        while 1:
            msg.pose.position.x = self.x
            msg.pose.position.y = self.y
            msg.pose.position.z = self.z

            # For demo purposes we will lock yaw/heading to north.
            yaw_degrees = 0  # North
            yaw = radians(yaw_degrees)
            quaternion = quaternion_from_euler(0, 0, yaw)
            msg.pose.orientation = Quaternion(*quaternion)

            self.pub.publish(msg)

            rate.sleep()

    def set(self, x, y, z, delay=0, wait=True):
        self.done = False
        self.x = x
        self.y = y
        self.z = z

        if wait:
            rate = rospy.Rate(5)
            while not self.done:
                rate.sleep()

        time.sleep(delay)


    def reached(self, topic):
            #print topic.pose.position.z, self.z, abs(topic.pose.position.z - self.z)
            if abs(topic.pose.position.x - self.x) < 0.5 and abs(topic.pose.position.y - self.y) < 0.5 and abs(topic.pose.position.z - self.z) < 0.5:
                self.done = True

            self.done_evt.set()

def setpoint_demo():
    pub = rospy.Publisher('/mavros/setpoint_position/local_position', PoseStamped, queue_size=10)

    rospy.init_node('pose', anonymous=True)
    rate = rospy.Rate(10) 

    setpoint = Setpoint(pub, rospy)

    print "Climb"
    setpoint.set(0.0, 0.0, 3.0, 0)
    setpoint.set(0.0, 0.0, 10.0, 5)

    print "Sink"
    setpoint.set(0.0, 0.0, 8.0, 5)

    print "Fly to the right"
    setpoint.set(10.0, 4.0, 8.0, 5)

    print "Fly to the left"
    setpoint.set(0.0, 0.0, 8.0, 5)

    offset_x = 0.0
    offset_y = 0.0
    offset_z = 10.0
    sides = 360
    radius = 20

    print "Fly in a circle"
    setpoint.set(0.0, 0.0, 10.0, 3)   # Climb to the starting height first
    i = 0
    while not rospy.is_shutdown():
        x = radius * cos(i*2*pi/sides) + offset_x   
        y = radius * sin(i*2*pi/sides) + offset_y
        z = offset_z

        wait = False
        delay = 0
        if (i == 0 or i == sides):
            # Let it reach the setpoint.
            wait = True
            delay = 5

        setpoint.set(x, y, z, delay, wait)

        i = i + 1 
        rate.sleep()

        if (i > sides):
            print "Fly home"
            setpoint.set(0.0, 0.0, 10.0, 5)
            break

    # Simulate a slow landing.
    setpoint.set(0.0, 0.0,  8.0, 5)
    setpoint.set(0.0, 0.0,  3.0, 5)
    setpoint.set(0.0, 0.0,  2.0, 2)
    setpoint.set(0.0, 0.0,  1.0, 2)
    setpoint.set(0.0, 0.0,  0.0, 2)
    setpoint.set(0.0, 0.0, -0.2, 2)

    print "Bye!"


if __name__ == '__main__':
    try:
        setpoint_demo()
    except rospy.ROSInterruptException:
        pass

@wangsen1312
Copy link
Contributor

In the def init(self, pub, rospy): part sub = rospy.Subscriber('/mavros/local_position/local', PoseStamped, self.reached)
may should change to /mavros/setpoint_position/local_position'

@TSC21
Copy link
Member

TSC21 commented Jul 2, 2015

In the def init(self, pub, rospy): part sub = rospy.Subscriber('/mavros/local_position/local', PoseStamped, self.reached)
may should change to /mavros/setpoint_position/local_position'

No, that's a subscription. Doesn't have nothing to do with the setpoints -> it's just a way of retrieving feedback from the FCU (through LOCAL_POSITION_NED mavlink msgs).

Setpoints are being published through pub = rospy.Publisher('/mavros/setpoint_position/local_position', PoseStamped, queue_size=10)

@vooon vooon added the question label Jul 2, 2015
@vooon
Copy link
Member

vooon commented Jul 2, 2015

  1. please use code block tags for listings
  2. no gps fix, wp & pr timeout cause me that your have bad link to fcu.
  3. don't use & (foreground) executing or roslaunch, that not error, but else you can miss log reports
  4. no timsync - also looks strange for PX4

@TSC21
Copy link
Member

TSC21 commented Jul 2, 2015

@dreamkeep do you have position lock on your FCU (i.e. big status LED blinking green instead of blue)?

@TSC21
Copy link
Member

TSC21 commented Jul 22, 2015

@dreamkeep what's the status on this?

@vooon vooon closed this as completed Jul 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants