Hello all,

I've been developing a locking gimbal system for a few months now and I'm in desperate need of some software to make my gimbal work fully.

The basic idea for the gimbal is for a second person to be able to control the camera pan and tilt whilst it is stabilized by the APM but remaining very lightweight and also not having any obstructions in view whilst 360 Degree panning.

My all up weight with the tricopter is 1250g. thats 800g for the tri, 200g for the gimbal and accessories and 250g for the camera. 

Ive done some flight tests but i have had to hand launch due to the lack of software to make the locking mechanism work. The gimbal works ok but still needs a bit of fine tuning which I'm concentrating on at the moment.(all work in progress)

What I'm after is the two roll servos (that are plugged into separate roll channels) to go to a neutral position and then go to a retract position (opposite to each other) to lock and unlock the gimbal. The tilt servos need to just go to a neutral position. This function could be triggered by a simple rc input or possible auto trigger somehow. If any one is willing to help out with the  software I would be happy to share any drawings etc of my design or possibly make a gimbal or two. (the design and function is still in progress though so no guarantee of functionality just yet)

Sorry for bad video quality!

https://www.youtube.com/watch?v=FvnCta23gu8&feature=youtu.be 

Cheers

Alex

Views: 790

Reply to This

Replies to This Discussion

Hi, what do you mean with locking? Mechanically preventing it from moving (why would you want to do that)? Or tracking something, "locking" on to it?

It's servos and not brushless, right?

Regards

Soren

Hi Søren, the gimbal has the undercarriage attached to it so the legs don't get in the shot when it is panned around. When it is on the floor the apm keeps the gimbal flat which is great but say you came to land, when the motors stop keeping the tricopter from staying level it will fall to the floor. So the universal joint locks by moving the servos to a certain position stopping this From happening. I need the retract functions to work with an rc input and not a mavlink message. Very frustrating!

Hi,

Okay. That is definitely doable.

But you will need to have a running development environment yourself. Otherwise, you will need 3rd party help and get hex files that you don't really know the contents of. Maybe I or someone else can do the original work but not the maintenance...

If you have a dev. env., all you need to do when a new release comes it a "git fetch" and "git merge" followed by build and upload.

Regards, Soren

Søren,
this sounds amazing. I am very grateful for your help. I only know a tiny bit about this stuff but would love to give it a go with your help. I will try and sort out a development environment. Is this the same as the arducopter git clone?
Regards
Alex
Søren, I've already got the patched arduino ide and have started looking through the code to see if I could make any sense of it. I can see relevant parts of the code but that's as far as it goes.
regards
Alex

Hi, Great!

Let me know how it's going.

Regards

Soren

BTW I found a simpler solution to starting and landing with a gimbal.

http://www.youtube.com/watch?v=pW1dva4Pnwk

0$ and 0g.

Regards

Soren

Been there already. Works great until you miss it for some reason!

Ive been nosing around the code a bit and think I have found where the message is read from the mavlink message part.

 

This is from the AP.MOUNT library

 

/// Control the mount (depends on the previously set mount configuration)

/// triggered by a MavLink packet.

void AP_Mount::control_msg(mavlink_message_t *msg)

{

    __mavlink_mount_control_t packet;

    mavlink_msg_mount_control_decode(msg, &packet);

    if (mavlink_check_target(packet.target_system, packet.target_component)) {

        // not for us

        return;

    }

    switch ((enum MAV_MOUNT_MODE)_mount_mode.get())

    {

#if MNT_RETRACT_OPTION == ENABLED

    case MAV_MOUNT_MODE_RETRACT:      // Load and keep safe position (Roll,Pitch,Yaw) from EEPROM and stop stabilization

        set_retract_angles(packet.input_b*0.01f, packet.input_a*0.01f, packet.input_c*0.01f);

        if (packet.save_position)

        {

            _retract_angles.save();

        }

        break;

#endif

    case MAV_MOUNT_MODE_NEUTRAL:      //  Load and keep neutral position (Roll,Pitch,Yaw) from EEPROM

        set_neutral_angles(packet.input_b*0.01f, packet.input_a*0.01f, packet.input_c*0.01f);

        if (packet.save_position)

        {

            _neutral_angles.save();

        }

        break;

 

If it is, how hard would it be to configure say channel 7 or 8 to mimic this message instead of the mavlink? 

What do you think?

 

Regards Alex

All I can seem to find about the Mount message is here in commands_Logic.pde

 

#if MOUNT == ENABLED

    case MAV_CMD_DO_MOUNT_CONFIGURE:                    // Mission command to configure a camera mount |Mount operation mode (see MAV_CONFIGURE_MOUNT_MODE enum)| stabilize roll? (1 = yes, 0 = no)| stabilize pitch? (1 = yes, 0 = no)| stabilize yaw? (1 = yes, 0 = no)| Empty| Empty| Empty|

        camera_mount.configure_cmd();

        break;

    case MAV_CMD_DO_MOUNT_CONTROL:                      // Mission command to control a camera mount |pitch(deg*100) or lat, depending on mount mode.| roll(deg*100) or lon depending on mount mode| yaw(deg*100) or alt (in cm) depending on mount mode| Empty| Empty| Empty| Empty|

        camera_mount.control_cmd();

        break;

#endif

    default:

        // do nothing with unrecognized MAVLink messages

        break;

    }

}

There is something to do with channel 7 for shutter control. Don't know if this can maybe be adapted to work somehow?

 

 

// do_take_picture - take a picture with the camera library

static void do_take_picture()

{

#if CAMERA == ENABLED

    camera.trigger_pic();

    if (g.log_bitmask & MASK_LOG_CAMERA) {

        Log_Write_Camera();

    }

#endif

}

Regards

 

Alex

Oh and this in GCS_Mavlink.

#if CAMERA == ENABLED

    case MAVLINK_MSG_ID_DIGICAM_CONFIGURE:

    {

        camera.configure_msg(msg);

        break;

    }

    case MAVLINK_MSG_ID_DIGICAM_CONTROL:

    {

        camera.control_msg(msg);

        break;

    }

#endif // CAMERA == ENABLED

#if MOUNT == ENABLED

    case MAVLINK_MSG_ID_MOUNT_CONFIGURE:

    {

        camera_mount.configure_msg(msg);

        break;

    }

    case MAVLINK_MSG_ID_MOUNT_CONTROL:

    {

        camera_mount.control_msg(msg);

        break;

    }

    case MAVLINK_MSG_ID_MOUNT_STATUS:

    {

        camera_mount.status_msg(msg);

        break;

    }

#endif // MOUNT == ENABLED

Hi,

Yes you found it.

Now you need to 1) write some other code that has the same effect (extend and retract gimbal) but not the same "triggering", 2) make it conditional of an RC channel and 3) let it be run regularly (as ArduPilot does not have an event or messaging mechanism, all we can do is calling it sometimes and let it gather its own information to check).

I will sugggest something:

Just write a new procedure somewhere (in a new .pde file):

void checkRCRetract() {

  static enum MAV_MOUNT_MODE savedMode = MAV_MOUNT_MODE_STABILIZE; // or whatever else you prefer.

  static uint8_t latch = 0;

  if (blahblah .. check the RC channel blah > 1500) {

    if (!latch) {

      savedMode = camera_mount.get_mode(); // maybe u need to implement a getter.

      camera_mount.set_mode(MAV_MOUNT_MODE_RETRACT);

      latch = 1;

   }

} else if (latch) {

    camera_mount.set_mode(savedMode);

    latch = 0;

}

}

and in ArduCopter.pde where the scheduler is configured - the long list of procedures that are called by the scheduler and how often - add an entry for checkRCRetract that executes like 5 or 10 times a second.

Maybe that's all that is needed.

Regards

Soren

Hi Soren, 

As I expected ive run into problems.....

This is what Ive done with the code-

ArduCopter.pde -

// This is the slow (3 1/3 Hz) loop pieces
//----------------------------------------
switch (slow_loopCounter) {
case 0:
slow_loopCounter++;
superslow_loopCounter++;

// check if we've lost contact with the ground station
failsafe_gcs_check();

// check for retract enable switch
checkRCRetract_check();

// record if the compass is healthy
set_compass_healthy(compass.healthy);

if(superslow_loopCounter > 1200) {

I dont know if this is right but if i verify the code in the arduino ide it says -  

ArduCopter:1207: error: 'checkRCRetract_check' was not declared in this scope

gimbal_retract.pde: In function 'void checkRCRetract()':

gimbal_retract:2: error 'MAV_MOUNT_MODE_STABILIZE' was not declared in this scope

gimbal_retract:6: error: 'class AP_Mount' has no member named 'get_mode'

C:\Users\alex\Documents\Arduino\libraries\AP_Mount/AP_Mount.h:67:

error: 'void AP_Mount::set_mode(MAV_MOUNT_MODE)' is private

gimbal_retract:7: error within this context

C:\Users\alex\Documents\Arduino\librarys\AP_Mount/AP_Mount.h:67:

error: 'void AP_Mount::set_mode(MAV_MOUNT_MODE)' is private

gimbal_retract:11: error: within this context

This is what ive done in the arducopter file folder. (same folder that arducopter.pde is in)

void checkRCRetract() {
static enum MAV_MOUNT_MODE savedMode = MAV_MOUNT_MODE_STABILIZE; // or whatever else you prefer.
static uint8_t latch = 0;
if (g.rc_6.control_in > 1500) {
if (!latch) {
savedMode = camera_mount.get_mode(); // maybe u need to implement a getter.
camera_mount.set_mode(MAV_MOUNT_MODE_RETRACT);
latch = 1;
}
} else if (latch) {
camera_mount.set_mode(savedMode);
latch = 0;
}
}

 This is saved as gimbal_retract.pde

I would be grateful if you could suggest where ive gone wrong. 

Also I was wandering about implementing a getter for what you suggested here, I dont know if i need it?savedMode = camera_mount.get_mode();

Regards

Alex

Reply to Discussion

RSS

© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service