PX4 / PX4-SITL_gazebo-classic

Set of plugins, models and worlds to use with OSRF Gazebo Simulator in SITL and HITL.
http://dev.px4.io/simulation-gazebo.html
378 stars 796 forks source link

Image Capture Not working in GAZEBO-PX4 SITL #501

Closed HarshilNaikk closed 4 years ago

HarshilNaikk commented 4 years ago
> `harshil@harshil-Lenovo-ideapad-320-15IKB:~/Firmware$ roslaunch px4 mavros_posix_sitl.launch 
... logging to /home/harshil/.ros/log/db5b0b1e-9bea-11ea-b77f-b0fc362b6d6b/roslaunch-harshil-Lenovo-ideapad-320-15IKB-17913.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://harshil-Lenovo-ideapad-320-15IKB:33905/

SUMMARY
========

CLEAR PARAMETERS
 * /mavros/

PARAMETERS
 * /gazebo/enable_ros_network: True
 * /mavros/cmd/use_comp_id_system_control: False
 * /mavros/conn/heartbeat_rate: 1.0
 * /mavros/conn/system_time_rate: 1.0
 * /mavros/conn/timeout: 10.0
 * /mavros/conn/timesync_rate: 10.0
 * /mavros/distance_sensor/hrlv_ez4_pub/field_of_view: 0.0
 * /mavros/distance_sensor/hrlv_ez4_pub/frame_id: hrlv_ez4_sonar
 * /mavros/distance_sensor/hrlv_ez4_pub/id: 0
 * /mavros/distance_sensor/hrlv_ez4_pub/orientation: PITCH_270
 * /mavros/distance_sensor/hrlv_ez4_pub/send_tf: True
 * /mavros/distance_sensor/hrlv_ez4_pub/sensor_position/x: 0.0
 * /mavros/distance_sensor/hrlv_ez4_pub/sensor_position/y: 0.0
 * /mavros/distance_sensor/hrlv_ez4_pub/sensor_position/z: -0.1
 * /mavros/distance_sensor/laser_1_sub/id: 3
 * /mavros/distance_sensor/laser_1_sub/orientation: PITCH_270
 * /mavros/distance_sensor/laser_1_sub/subscriber: True
 * /mavros/distance_sensor/lidarlite_pub/field_of_view: 0.0
 * /mavros/distance_sensor/lidarlite_pub/frame_id: lidarlite_laser
 * /mavros/distance_sensor/lidarlite_pub/id: 1
 * /mavros/distance_sensor/lidarlite_pub/orientation: PITCH_270
 * /mavros/distance_sensor/lidarlite_pub/send_tf: True
 * /mavros/distance_sensor/lidarlite_pub/sensor_position/x: 0.0
 * /mavros/distance_sensor/lidarlite_pub/sensor_position/y: 0.0
 * /mavros/distance_sensor/lidarlite_pub/sensor_position/z: -0.1
 * /mavros/distance_sensor/sonar_1_sub/id: 2
 * /mavros/distance_sensor/sonar_1_sub/orientation: PITCH_270
 * /mavros/distance_sensor/sonar_1_sub/subscriber: True
 * /mavros/fake_gps/eph: 2.0
 * /mavros/fake_gps/epv: 2.0
 * /mavros/fake_gps/fix_type: 3
 * /mavros/fake_gps/geo_origin/alt: 408.0
 * /mavros/fake_gps/geo_origin/lat: 47.3667
 * /mavros/fake_gps/geo_origin/lon: 8.55
 * /mavros/fake_gps/gps_rate: 5.0
 * /mavros/fake_gps/mocap_transform: True
 * /mavros/fake_gps/satellites_visible: 5
 * /mavros/fake_gps/tf/child_frame_id: fix
 * /mavros/fake_gps/tf/frame_id: map
 * /mavros/fake_gps/tf/listen: False
 * /mavros/fake_gps/tf/rate_limit: 10.0
 * /mavros/fake_gps/tf/send: False
 * /mavros/fake_gps/use_mocap: True
 * /mavros/fake_gps/use_vision: False
 * /mavros/fcu_protocol: v2.0
 * /mavros/fcu_url: udp://:14540@loca...
 * /mavros/gcs_url: 
 * /mavros/global_position/child_frame_id: base_link
 * /mavros/global_position/frame_id: map
 * /mavros/global_position/gps_uere: 1.0
 * /mavros/global_position/rot_covariance: 99999.0
 * /mavros/global_position/tf/child_frame_id: base_link
 * /mavros/global_position/tf/frame_id: map
 * /mavros/global_position/tf/global_frame_id: earth
 * /mavros/global_position/tf/send: False
 * /mavros/global_position/use_relative_alt: True
 * /mavros/image/frame_id: px4flow
 * /mavros/imu/angular_velocity_stdev: 0.0003490659 // 0...
 * /mavros/imu/frame_id: base_link
 * /mavros/imu/linear_acceleration_stdev: 0.0003
 * /mavros/imu/magnetic_stdev: 0.0
 * /mavros/imu/orientation_stdev: 1.0
 * /mavros/landing_target/camera/fov_x: 2.0071286398
 * /mavros/landing_target/camera/fov_y: 2.0071286398
 * /mavros/landing_target/image/height: 480
 * /mavros/landing_target/image/width: 640
 * /mavros/landing_target/land_target_type: VISION_FIDUCIAL
 * /mavros/landing_target/listen_lt: False
 * /mavros/landing_target/mav_frame: LOCAL_NED
 * /mavros/landing_target/target_size/x: 0.3
 * /mavros/landing_target/target_size/y: 0.3
 * /mavros/landing_target/tf/child_frame_id: camera_center
 * /mavros/landing_target/tf/frame_id: landing_target
 * /mavros/landing_target/tf/listen: False
 * /mavros/landing_target/tf/rate_limit: 10.0
 * /mavros/landing_target/tf/send: True
 * /mavros/local_position/frame_id: map
 * /mavros/local_position/tf/child_frame_id: base_link
 * /mavros/local_position/tf/frame_id: map
 * /mavros/local_position/tf/send: False
 * /mavros/local_position/tf/send_fcu: False
 * /mavros/mission/pull_after_gcs: True
 * /mavros/mocap/use_pose: True
 * /mavros/mocap/use_tf: False
 * /mavros/odometry/fcu/odom_child_id_des: base_link
 * /mavros/odometry/fcu/odom_parent_id_des: map
 * /mavros/plugin_blacklist: ['safety_area', '...
 * /mavros/plugin_whitelist: []
 * /mavros/px4flow/frame_id: px4flow
 * /mavros/px4flow/ranger_fov: 0.118682
 * /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_attitude/reverse_thrust: False
 * /mavros/setpoint_attitude/tf/child_frame_id: target_attitude
 * /mavros/setpoint_attitude/tf/frame_id: map
 * /mavros/setpoint_attitude/tf/listen: False
 * /mavros/setpoint_attitude/tf/rate_limit: 50.0
 * /mavros/setpoint_attitude/use_quaternion: False
 * /mavros/setpoint_position/mav_frame: LOCAL_NED
 * /mavros/setpoint_position/tf/child_frame_id: target_position
 * /mavros/setpoint_position/tf/frame_id: map
 * /mavros/setpoint_position/tf/listen: False
 * /mavros/setpoint_position/tf/rate_limit: 50.0
 * /mavros/setpoint_raw/thrust_scaling: 1.0
 * /mavros/setpoint_velocity/mav_frame: LOCAL_NED
 * /mavros/startup_px4_usb_quirk: True
 * /mavros/sys/disable_diag: False
 * /mavros/sys/min_voltage: 10.0
 * /mavros/target_component_id: 1
 * /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/time/timesync_mode: MAVLINK
 * /mavros/vibration/frame_id: base_link
 * /mavros/vision_pose/tf/child_frame_id: vision_estimate
 * /mavros/vision_pose/tf/frame_id: odom
 * /mavros/vision_pose/tf/listen: False
 * /mavros/vision_pose/tf/rate_limit: 10.0
 * /mavros/vision_speed/listen_twist: True
 * /mavros/vision_speed/twist_cov: True
 * /mavros/wheel_odometry/child_frame_id: base_link
 * /mavros/wheel_odometry/count: 2
 * /mavros/wheel_odometry/frame_id: odom
 * /mavros/wheel_odometry/send_raw: True
 * /mavros/wheel_odometry/send_twist: False
 * /mavros/wheel_odometry/tf/child_frame_id: base_link
 * /mavros/wheel_odometry/tf/frame_id: odom
 * /mavros/wheel_odometry/tf/send: False
 * /mavros/wheel_odometry/use_rpm: False
 * /mavros/wheel_odometry/vel_error: 0.1
 * /mavros/wheel_odometry/wheel0/radius: 0.05
 * /mavros/wheel_odometry/wheel0/x: 0.0
 * /mavros/wheel_odometry/wheel0/y: -0.15
 * /mavros/wheel_odometry/wheel1/radius: 0.05
 * /mavros/wheel_odometry/wheel1/x: 0.0
 * /mavros/wheel_odometry/wheel1/y: 0.15
 * /rosdistro: melodic
 * /rosversion: 1.14.5
 * /use_sim_time: True

NODES
  /
    gazebo (gazebo_ros/gzserver)
    gazebo_gui (gazebo_ros/gzclient)
    mavros (mavros/mavros_node)
    sitl (px4/px4)
    vehicle_spawn_harshil_Lenovo_ideapad_320_15IKB_17913_7872246682930561901 (gazebo_ros/spawn_model)

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

setting /run_id to db5b0b1e-9bea-11ea-b77f-b0fc362b6d6b
process[rosout-1]: started with pid [17937]
started core service [/rosout]
process[sitl-2]: started with pid [17945]
INFO  [px4] Creating symlink /home/harshil/Firmware/ROMFS/px4fmu_common -> /home/harshil/.ros/etc

______  __   __    ___ 
| ___ \ \ \ / /   /   |
| |_/ /  \ V /   / /| |
|  __/   /   \  / /_| |
| |     / /^\ \ \___  |
\_|     \/   \/     |_/

px4 starting.

INFO  [px4] Calling startup script: /bin/sh etc/init.d-posix/rcS 0
process[gazebo-3]: started with pid [17959]
INFO  [param] selected parameter default file eeprom/parameters_1031
process[gazebo_gui-4]: started with pid [17970]
[param] Loaded: eeprom/parameters_1031
process[vehicle_spawn_harshil_Lenovo_ideapad_320_15IKB_17913_7872246682930561901-5]: started with pid [17978]
process[mavros-6]: started with pid [17981]
INFO  [dataman] Unknown restart, data manager file './dataman' size is 11798680 bytes
INFO  [simulator] Waiting for simulator to accept connection on TCP port 4560
[ INFO] [1590124360.040655680]: FCU URL: udp://:14540@localhost:14557
[ INFO] [1590124360.057069716]: udp0: Bind address: 0.0.0.0:14540
[ INFO] [1590124360.057214909]: udp0: Remote address: 127.0.0.1:14557
[ INFO] [1590124360.057566201]: GCS bridge disabled
[ INFO] [1590124360.083161533]: Plugin 3dr_radio loaded
[ INFO] [1590124360.086556124]: Plugin 3dr_radio initialized
[ INFO] [1590124360.086928696]: Plugin actuator_control loaded
[ INFO] [1590124360.094663773]: Plugin actuator_control initialized
[ INFO] [1590124360.100594870]: Plugin adsb loaded
[ INFO] [1590124360.106506455]: Plugin adsb initialized
[ INFO] [1590124360.106927077]: Plugin altitude loaded
[ INFO] [1590124360.108850856]: Plugin altitude initialized
[ INFO] [1590124360.109318470]: Plugin cam_imu_sync loaded
[ INFO] [1590124360.110405676]: Plugin cam_imu_sync initialized
[ INFO] [1590124360.111135788]: Plugin command loaded
[ INFO] [1590124360.124138469]: Plugin command initialized
[ INFO] [1590124360.124341130]: Plugin companion_process_status loaded
[ INFO] [1590124360.128075601]: Plugin companion_process_status initialized
[ INFO] [1590124360.128369855]: Plugin debug_value loaded
[ INFO] [1590124360.133763550]: Plugin debug_value initialized
[ INFO] [1590124360.133827533]: Plugin distance_sensor blacklisted
[ INFO] [1590124360.134016059]: Plugin fake_gps loaded
[ INFO] [1590124360.154365412]: Plugin fake_gps initialized
[ INFO] [1590124360.154749678]: Plugin ftp loaded
[ INFO] [1590124360.171303365]: Plugin ftp initialized
[ INFO] [1590124360.171622673]: Plugin global_position loaded
[ INFO] [1590124360.201158483]: Plugin global_position initialized
[ INFO] [1590124360.201362159]: Plugin gps_rtk loaded
[ INFO] [1590124360.205539309]: Plugin gps_rtk initialized
[ INFO] [1590124360.205769143]: Plugin hil loaded
[ INFO] [1590124360.230666516]: Plugin hil initialized
[ INFO] [1590124360.230896771]: Plugin home_position loaded
[ INFO] [1590124360.237654738]: Plugin home_position initialized
[ INFO] [1590124360.237955969]: Plugin imu loaded
[ INFO] [1590124360.255746026]: Plugin imu initialized
[ INFO] [1590124360.255958810]: Plugin landing_target loaded
[ INFO] [1590124360.284640953]: Plugin landing_target initialized
[ INFO] [1590124360.284841740]: Plugin local_position loaded
[ INFO] [1590124360.297442168]: Plugin local_position initialized
[ INFO] [1590124360.297645233]: Plugin log_transfer loaded
[ INFO] [1590124360.303060174]: Plugin log_transfer initialized
[ INFO] [1590124360.303308668]: Plugin manual_control loaded
[ INFO] [1590124360.309420121]: Plugin manual_control initialized
[ INFO] [1590124360.309624732]: Plugin mocap_pose_estimate loaded
[ INFO] [1590124360.315381430]: Plugin mocap_pose_estimate initialized
[ INFO] [1590124360.315593565]: Plugin mount_control loaded
[ INFO] [1590124360.321436658]: Plugin mount_control initialized
[ INFO] [1590124360.321645703]: Plugin obstacle_distance loaded
[ INFO] [1590124360.326762669]: Plugin obstacle_distance initialized
[ INFO] [1590124360.326969381]: Plugin odom loaded
[ INFO] [1590124360.342709252]: Plugin odom initialized
[ INFO] [1590124360.342928431]: Plugin onboard_computer_status loaded
[ INFO] [1590124360.350283625]: Plugin onboard_computer_status initialized
[ INFO] [1590124360.350566920]: Plugin param loaded
[ INFO] [1590124360.361062909]: Plugin param initialized
[ INFO] [1590124360.361274274]: Plugin px4flow loaded
[ INFO] [1590124360.383425369]: Plugin px4flow initialized
[ INFO] [1590124360.383485244]: Plugin rangefinder blacklisted
[ INFO] [1590124360.383710937]: Plugin rc_io loaded
[ INFO] [1590124360.393480623]: Plugin rc_io initialized
[ INFO] [1590124360.393539912]: Plugin safety_area blacklisted
[ INFO] [1590124360.393713120]: Plugin setpoint_accel loaded
[ INFO] [1590124360.403247111]: Plugin setpoint_accel initialized
[ INFO] [1590124360.403583189]: Plugin setpoint_attitude loaded
[ INFO] [1590124360.428132783]: Plugin setpoint_attitude initialized
[ INFO] [1590124360.428386897]: Plugin setpoint_position loaded
[ INFO] [1590124360.454961615]: Plugin setpoint_position initialized
[ INFO] [1590124360.455171374]: Plugin setpoint_raw loaded
[ INFO] [1590124360.468374359]: Plugin setpoint_raw initialized
[ INFO] [1590124360.468639321]: Plugin setpoint_trajectory loaded
[ INFO] [1590124360.477435623]: Plugin setpoint_trajectory initialized
[ INFO] [1590124360.477659109]: Plugin setpoint_velocity loaded
[ INFO] [1590124360.488127485]: Plugin setpoint_velocity initialized
[ INFO] [1590124360.488547091]: Plugin sys_status loaded
[ INFO] [1590124360.511285985]: Plugin sys_status initialized
[ INFO] [1590124360.511523754]: Plugin sys_time loaded
[ INFO] [1590124360.521712135]: TM: Timesync mode: MAVLINK
[ INFO] [1590124360.524402649]: Plugin sys_time initialized
[ INFO] [1590124360.524617089]: Plugin trajectory loaded
[ INFO] [1590124360.536014448]: Plugin trajectory initialized
[ INFO] [1590124360.536198179]: Plugin vfr_hud loaded
[ INFO] [1590124360.538145513]: Plugin vfr_hud initialized
[ INFO] [1590124360.538231577]: Plugin vibration blacklisted
[ INFO] [1590124360.538521749]: Plugin vision_pose_estimate loaded
[ INFO] [1590124360.554166869]: Plugin vision_pose_estimate initialized
[ INFO] [1590124360.554386476]: Plugin vision_speed_estimate loaded
[ INFO] [1590124360.561693276]: Plugin vision_speed_estimate initialized
[ INFO] [1590124360.561956746]: Plugin waypoint loaded
[ INFO] [1590124360.571406990]: Plugin waypoint initialized
[ INFO] [1590124360.571477875]: Plugin wheel_odometry blacklisted
[ INFO] [1590124360.571658456]: Plugin wind_estimation loaded
[ INFO] [1590124360.573023515]: Plugin wind_estimation initialized
[ INFO] [1590124360.573116383]: Autostarting mavlink via USB on PX4
[ INFO] [1590124360.573291778]: Built-in SIMD instructions: SSE, SSE2
[ INFO] [1590124360.573322231]: Built-in MAVLink package version: 2020.5.5
[ INFO] [1590124360.573353450]: Known MAVLink dialects: common ardupilotmega ASLUAV autoquad icarous matrixpilot paparazzi slugs standard uAvionix ualberta
[ INFO] [1590124360.573380182]: MAVROS started. MY ID 1.240, TARGET ID 1.1
[ INFO] [1590124360.660780398]: Finished loading Gazebo ROS API Plugin.
[ INFO] [1590124360.664908904]: waitForService: Service [/gazebo_gui/set_physics_properties] has not been advertised, waiting...
[ INFO] [1590124360.687060194]: Finished loading Gazebo ROS API Plugin.
[ INFO] [1590124360.690122388]: waitForService: Service [/gazebo/set_physics_properties] has not been advertised, waiting...
[INFO] [1590124361.010686, 0.000000]: Loading model XML from file /home/harshil/Firmware/Tools/sitl_gazebo/models/plane_cam/plane_cam.sdf
[INFO] [1590124361.012138, 0.000000]: Waiting for service /gazebo/spawn_sdf_model
[ INFO] [1590124361.305074011]: waitForService: Service [/gazebo/set_physics_properties] is now available.
[INFO] [1590124361.315597, 0.000000]: Calling service /gazebo/spawn_sdf_model
[INFO] [1590124361.602755, 0.156000]: Spawn status: SpawnModel: Successfully spawned entity
[ INFO] [1590124361.614353024, 0.156000000]: Physics dynamic reconfigure ready.
[vehicle_spawn_harshil_Lenovo_ideapad_320_15IKB_17913_7872246682930561901-5] process has finished cleanly
log file: /home/harshil/.ros/log/db5b0b1e-9bea-11ea-b77f-b0fc362b6d6b/vehicle_spawn_harshil_Lenovo_ideapad_320_15IKB_17913_7872246682930561901-5*.log
10.80
INFO  [simulator] Simulator connected on TCP port 4560.
INFO  [commander] LED: open /dev/led0 failed (22)
INFO  [commander] Mission #2 loaded, 5 WPs, curr: 4
INFO  [init] Mixer: etc/mixers-sitl/plane_sitl.main.mix on /dev/pwm_output0
INFO  [mavlink] mode: Normal, data rate: 4000000 B/s on udp port 18570 remote port 14550
INFO  [mavlink] mode: Onboard, data rate: 4000000 B/s on udp port 14580 remote port 14540
INFO  [mavlink] mode: Onboard, data rate: 4000 B/s on udp port 14280 remote port 14030
INFO  [mavlink] MAVLink only on localhost (set param MAV_BROADCAST = 1 to enable network)
INFO  [px4] Startup script returned successfully
pxh> INFO  [logger] logger started (mode=all)
INFO  [logger] Start file log (type: full)
INFO  [logger] [logger] ./log/2020-05-22/05_12_42.ulg
INFO  [logger] Opened full log file: ./log/2020-05-22/05_12_42.ulg
[ INFO] [1590124362.408511733, 0.376000000]: udp0: Remote address: 127.0.0.1:14580
[ INFO] [1590124362.409348372, 0.380000000]: IMU: High resolution IMU detected!
[ INFO] [1590124362.425082984, 0.396000000]: FCU: [logger] ./log/2020-05-22/05_12_42.ulg
INFO  [mavlink] partner IP: 127.0.0.1
[Err] [REST.cc:205] Error in REST request

libcurl: (51) SSL: no alternative certificate subject name matches target host name 'api.ignitionfuel.org'
INFO  [ecl/EKF] 608000: GPS checks passed
INFO  [mavlink] partner IP: 127.0.0.1
[ INFO] [1590124363.905002171, 1.344000000]: CON: Got HEARTBEAT, connected. FCU: PX4 Autopilot
[ INFO] [1590124363.916999681, 1.356000000]: IMU: High resolution IMU detected!
INFO  [ecl/EKF] 1772000: EKF aligned, (baro hgt, IMU buf: 18, OBS buf: 14)
INFO  [ecl/EKF] 1772000: reset position to last known position
INFO  [ecl/EKF] 1772000: reset velocity to zero
[ INFO] [1590124365.944757970, 2.116000000]: IMU: Attitude quaternion IMU detected!
[ INFO] [1590124366.705112391, 2.344000000]: VER: 1.1: Capabilities         0x000000000000e4ef
[ INFO] [1590124366.705489996, 2.344000000]: VER: 1.1: Flight software:     010b0000 (76de299302000000)
[ INFO] [1590124366.705760703, 2.344000000]: VER: 1.1: Middleware software: 010b0000 (76de299302000000)
[ INFO] [1590124366.706013410, 2.344000000]: VER: 1.1: OS software:         050300ff (0000000000000000)
[ INFO] [1590124366.706225160, 2.348000000]: VER: 1.1: Board hardware:      00000001
[ INFO] [1590124366.706445194, 2.348000000]: VER: 1.1: VID/PID:             0000:0000
[ INFO] [1590124366.706569364, 2.348000000]: VER: 1.1: UID:                 4954414c44494e4f
[ INFO] [1590124372.017141697, 4.804000000]: WP: seems GCS requesting mission
[ INFO] [1590124372.017344746, 4.804000000]: WP: scheduling pull after GCS is done
INFO  [ecl/EKF] 5188000: reset position to GPS
INFO  [ecl/EKF] 5188000: reset velocity to GPS
INFO  [ecl/EKF] 5188000: starting GPS fusion
`

I tried to use Mavlink to trigger the camera, but thats not happening. Also, when i triggered the camera using the GUI in QGC, the image icon does appear on the map, indicating that the image was captured, but i can't find the location where it was saved.

I am trying to use a py script to run a mission, which consists of this part. Any help would be appreciated.

This is the Script I am using:


  `
#!/usr/bin/env python

>import rospy
import time
from mavros_msgs.srv import *
from pymavlink import mavutil, mavwp
from mavros_msgs.msg import *

def takeoff(x): # input: takeoff alt
    rospy.wait_for_service('/mavros/cmd/takeoff')
    try:
        takeoff = rospy.ServiceProxy('/mavros/cmd/takeoff', CommandTOL)
        response = takeoff(0,0,0,0,x)
        response.success
    except rospy.ServiceException, e:
        print "Service call failed: %s"%e

def setmode(x): # input: mode in capital
    rospy.wait_for_service('/mavros/set_mode')
    try:
        mode = rospy.ServiceProxy('/mavros/set_mode', SetMode)
        response = mode(0,x)
        response.mode_sent
    except rospy.ServiceException, e:
        print "Service call failed: %s"%e

def setarm(x): # input: 1=arm, 0=disarm
    rospy.wait_for_service('/mavros/cmd/arming')
    try:
        arming = rospy.ServiceProxy('/mavros/cmd/arming', CommandBool)
        response = arming(x)
        response.success
    except rospy.ServiceException, e:
        print "Service call failed: %s"%e

def waypoint(x): # x is address of wp.txt file
    rospy.wait_for_service('/mavros/mission/push')
    try:
        wp = rospy.ServiceProxy('/mavros/mission/push', WaypointPush)
        start_index = 0
        response = wp(start_index, wpt(x))
        if (response.success):
            print "Sent %s waypoints"%(response.wp_transfered)
    except rospy.ServiceException, e:
        print "Service call failed: %s"%e

def wpt(x):
    wp_list = []
    file = open(x, "r")
    for line in file:
        if line.startswith('#'):
            comment = line[1:].lstrip()
            continue
        line = line.strip()
        if not line:
            continue
        a = line.split()
        d = Waypoint()
        d.frame = int(a[2])
        d.command = int(a[3])
        d.is_current = int(a[1])
        d.autocontinue = int(a[11])
        d.param1 = float(a[4])
        d.param2 = float(a[5])
        d.param3 = float(a[6])
        d.param4 = float(a[7])
        d.x_lat = float(a[8])
        d.y_long = float(a[9])
        d.z_alt = float(a[10])
        wp_list.append(d)
    file.close()
    return wp_list

if __name__ == '__main__':
    rospy.init_node('ardu_mavros_node', anonymous=True)
    mavutil.set_dialect("ardupilotmega")
    master = mavutil.mavlink_connection('udpin:0.0.0.0:14550')
    master.wait_heartbeat()

    setarm(1)
    time.sleep(2)
    takeoff(35)
    time.sleep(1)
    waypoint('/home/harshil/BSDC-Ardupilot_and_Mavros/ArduMavros/src/mavros_py/waypointfiles/wayptmav.txt')
    time.sleep(1)
    master.mav.command_long_send(
    master.target_system,
    master.target_component,
    mavutil.mavlink.MAV_CMD_IMAGE_START_CAPTURE,
    1,
    0, 3, 20, 0, 0, 0, 0)
    setmode('AUTO.MISSION')

`

@julianoes

julianoes commented 4 years ago

It looks like you're using ArduMavros. I have no idea if that works with PX4 like that.

And please put ``` around pasted log output or source to make it more readable.

Jaeyoung-Lim commented 4 years ago

@HarshilNaikk Tried with QGC and PX4 SITL and looks functional. Have you tried without using mavros? I am not sure the location is supposed to appear if you manually trigger the camera. It is usually only like that during a survey.

appetito commented 4 years ago

You can check Gazebo logs for details (~/.gazebo/server-11345/default.log on my machine) Image path looks like ~/Firmware/build/px4_sitl_default/tmp/frames target component for MAV_CMD_IMAGE_START_CAPTURE command should be 100 (https://github.com/PX4/sitl_gazebo/blob/master/src/gazebo_geotagged_images_plugin.cpp#L305)

Jaeyoung-Lim commented 4 years ago

@appetito Thanks!

Closing since the original author of the issue has not responded