Hi All,

I have a quick question and was hoping someone could kindly point me into the right direction. My APM 2.5 had a damaged contact on the microprocessor that is connected to output channel 4. Since I'm only using 4 channels on my quad, I was hoping to change the output on channel 4 to either channel 5,6,7, or 8.

I have downloaded the ArduCopter 2.9.1 branch from GitHub and can successfully compile the firmware. I have tried changing the output definition on ../libraries/APM_RC/APM_RC.h

// Radio channels

// Note channels are from 0!

#define CH_1 0
#define CH_2 1
#define CH_3 2
#define CH_4 6
#define CH_5 4
#define CH_6 5
#define CH_7 3
#define CH_8 7
#define CH_9 8
#define CH_10 9
#define CH_11 10

I was hoping this would just swap the output on channel 4 and 7. Although now I do get a PWM throttle response from channel 7. The PWM is not consistant with the output of channel 1, 2, and 3.

If anyone could let me know what other code I must change to achieve this, I would greatly appreciate it.

Kind Regards,

Mike

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • hi, i'm a newbie. i think i have the same problem. In my flight controller the port number 2 is not working anymore. I'd like to use other free ports (i have a quadcopter) to control the motor. i'm looking inside the apm 3.2.1 version but i can't find the ap_motors.h you mentioned. do you know if the motor mapping is in another file? if i'll find it, how can i compile the firmware to install it in the drone? thanks
    • Hi,

      I am also newbie, so I am not 100% sure my solution is correct, but it worked for me. 

      After quick look at sources I found out that set_motor_to_channel_map method was removed in this commit, so I checked two solutions and both worked. In my case chanel 4 was broken, so I swapped channel 4 with 5.

      Solution 1 (ArduCopter-3.2.1)

      In file ardupilot\libraries\AP_Motors\/AP_Motors_Class.h I made the following change:

       -#define APM2_MOTOR_TO_CHANNEL_MAP CH_1,CH_2,CH_3,CH_4,CH_5,CH_6,CH_7,CH_8
      +#define APM2_MOTOR_TO_CHANNEL_MAP CH_1,CH_2,CH_3,CH_5,CH_4,CH_6,CH_7,CH_8

      Solution 2 (ArduCopter-3.1.2)

      I simply checkout to version 3.1.2 (git checkout ArduCopter-3.1.2) and made the change suggested by Mike. Note that in this version method set_motor_to_channel_map can be found in file ardupilot\libraries\AP_Motors\/AP_Motors_Class.h (not in AP_Motors.h).

      Hope that helps.

  • Hi All,

    Looks like I figured it out, so if anyone is ever curious:

    ../libraries/AP_Motors/AP_Motors.h

     // set mapping from motor number to RC channel
        virtual void        set_motor_to_channel_map( uint8_t mot_1, uint8_t mot_2, uint8_t mot_3, uint8_t mot_4, uint8_t mot_5, uint8_t mot_6, uint8_t mot_7, uint8_t mot_$
            _motor_to_channel_map[AP_MOTORS_MOT_1] = mot_1;
            _motor_to_channel_map[AP_MOTORS_MOT_2] = mot_2;
            _motor_to_channel_map[AP_MOTORS_MOT_3] = mot_3;
            _motor_to_channel_map[AP_MOTORS_MOT_5] = mot_4;
            _motor_to_channel_map[AP_MOTORS_MOT_4] = mot_5;
            _motor_to_channel_map[AP_MOTORS_MOT_6] = mot_6;
            _motor_to_channel_map[AP_MOTORS_MOT_7] = mot_7;
            _motor_to_channel_map[AP_MOTORS_MOT_8] = mot_8;
        }

    Just swapped MOTORS_MOT_5 and MOTORS_MOT_4 in the two bolded lines and motor 4 is now on channel 5.

    Kind Regards,

    Mike

    • Hi Mike! 

      Did found the solution for the newest firmwares? Because it seems that after the 2.9 version the code changed and the same tweak you've made cannot be done... 

      Regards! 

    • I have this same problem but no output on channel 2. So is there a way to edit the hex file directly or do I have to find the arduino file and compile (high I have no clue how to do?). I'm going crazy with this as I just got it together and after one programming blew the 3.3 regarding (which is now fixed) and this no output now. I'm running a hexacopter so I would have to swap to 7 or 8.

      Thanks!

    • Please buddy help me do this.
      I am getting these errors even without editing anything-
      I am having many errors in compiling the default firmware, here they are-

      compassmot.pde: In function 'uint8_t mavlink_compassmot(mavlink_channel_t)':
      compassmot:230: error: 'report_compass' was not declared in this scope
      crash_check.pde: In function 'void parachute_check()':
      crash_check.pde:113: warning: comparison between signed and unsigned integer expressions
      crash_check.pde: In function 'void parachute_manual_release()':
      crash_check.pde:180: warning: comparison between signed and unsigned integer expressions
      motors.pde: In function 'bool pre_arm_gps_checks(bool)':
      motors.pde:440: warning: comparison between signed and unsigned integer expressions
      radio.pde: In function 'void init_rc_out()':
      radio:75: error: 'init_esc' was not declared in this scope
      system.pde: In function 'void init_ardupilot()':
      system:127: error: 'report_version' was not declared in this scope
      /compat.h: At global scope:
      /compat.h:12: warning: 'void run_cli(AP_HAL::UARTDriver*)' declared 'static' but never defined
      ArduCopter.pde:175: warning: 'void update_optical_flow()' declared 'static' but never defined
      GCS_Mavlink.pde:284: warning: 'void send_simstate(mavlink_channel_t)' defined but not used
      ArduCopter.pde:219: warning: 'void send_servo_out(mavlink_channel_t)' declared 'static' but never defined
      Log.pde:248: warning: 'void Log_Write_Optflow()' defined but not used
      Log.pde:524: warning: 'void Log_Write_Data(uint8_t, int16_t)' defined but not used
      Log.pde:581: warning: 'void Log_Write_Data(uint8_t, uint32_t)' defined but not used
      Log.pde:600: warning: 'void Log_Write_Data(uint8_t, float)' defined but not used
      ArduCopter.pde:260: warning: 'void Log_Write_IMU()' declared 'static' but never defined
      ArduCopter.pde:261: warning: 'void Log_Write_GPS()' declared 'static' but never defined
      compat.pde:8: warning: 'void mavlink_delay(uint32_t)' defined but not used
      ArduCopter.pde:411: warning: 'void heli_init()' declared 'static' but never defined
      ArduCopter.pde:412: warning: 'int16_t get_pilot_desired_collective(int16_t)' declared 'static' but never defined
      ArduCopter.pde:413: warning: 'void check_dynamic_flight()' declared 'static' but never defined
      ArduCopter.pde:414: warning: 'void heli_update_landing_swash()' declared 'static' but never defined
      ArduCopter.pde:415: warning: 'void heli_update_rotor_speed_targets()' declared 'static' but never defined
      ArduCopter.pde:416: warning: 'bool heli_acro_init(bool)' declared 'static' but never defined
      ArduCopter.pde:417: warning: 'void heli_acro_run()' declared 'static' but never defined
      ArduCopter.pde:418: warning: 'bool heli_stabilize_init(bool)' declared 'static' but never defined
      ArduCopter.pde:419: warning: 'void heli_stabilize_run()' declared 'static' but never defined
      motors.pde:567: warning: 'void servo_write(uint8_t, uint16_t)' defined but not used
      ArduCopter.pde:472: warning: 'void print_hit_enter()' declared 'static' but never defined
      Log.pde:154: warning: 'int8_t process_logs(uint8_t, const Menu::arg*)' defined but not used

This reply was deleted.

Activity

Neville Rodrigues liked Neville Rodrigues's profile
Jun 30
Santiago Perez liked Santiago Perez's profile
Jun 21
More…