Page 1 of 1
SERVO_TRIGGER and SERVO_SET
Posted:
Tue Apr 19, 2011 2:14 pm
by daedalus
I want some pictures so I moved to r87 and began to test the servo_set and servo_trigger navigation commands.
The example you suggested in this post
viewtopic.php?f=4&t=275#p1245 did not work out of the box (the servo moved very briefly) and I've thought that maybe the channel 5 is in control loop and tried with channel 6. It worked
.
Now my question is if it is possible with the navigation scripting language to trigger the servo every x seconds, while flying between two waypoints.
Re: SERVO_TRIGGER and SERVO_SET
Posted:
Wed Apr 20, 2011 8:57 pm
by Tom
Hmmm no I didn't think of that...
So basically you would need a START_SERVO_TRIGGERING and a STOP_SERVO_TRIGGERING function?
Re: SERVO_TRIGGER and SERVO_SET
Posted:
Thu Apr 21, 2011 7:09 am
by daedalus
Yes, I think so.
Do you think to incorporate two SERVO_TRIGGER (pulse width and position hold for both positions) commands in the START_SERVO_TRIGGERING?
Re: SERVO_TRIGGER and SERVO_SET
Posted:
Fri Apr 22, 2011 11:05 am
by Tom
I was not thinking about that
Do you want to trigger 2 cameras?
Re: SERVO_TRIGGER and SERVO_SET
Posted:
Fri Apr 22, 2011 3:21 pm
by daedalus
No, I don't think I need 2 cameras...
I've experimented with the following:
1. servo_set(6, 1200)
2. servo_trigger(6, 1800, .5)
3. servo_trigger(6, 1200, 2.5)
3. goto 2
which moved the servo , hold it .5 seconds, moved it back and hold it 2.5 seconds and then repeat the sequence - this was for a 3 seconds total interval between shots.
What I was having in mind was a pair of functions like this:
START_SERVO_TRIGGERING(channel, position1_us, hold1_sec, position2_us, hold2_sec)
#other navigation commands to fly while taking pictures
STOP_SERVO_TRIGGERING(channel)
Unfortunately I'm not a developer and my ideas here might be dumb...
Re: SERVO_TRIGGER and SERVO_SET
Posted:
Tue May 17, 2011 12:16 pm
by daedalus
I am trying to build the gluonpilot v0.52 using MPLAB Tools v8.66 and MPLAB C30 v3.25. I get some warnings but it finally worked - just the resultant rtos_pilot.hex is smaller and not quite working.
In attachment is the build log.
Re: SERVO_TRIGGER and SERVO_SET
Posted:
Tue May 17, 2011 5:42 pm
by Tom
There is a bug in version 3.25 of the C30 compiler (uses twice as much RAM).
Please use version 3.11, which should work better (or use legacy-libs from the compiler option).
Re: SERVO_TRIGGER and SERVO_SET
Posted:
Wed May 18, 2011 1:14 pm
by daedalus
Could not find the 3.11 academic version of the compiler but the "-legacy-libc" option did the trick.
I've put (a bit modified from the servo_trigger) the following piece of code in the navigation.c file in the "case FROM_TO_ABS:" area, just below nav_leg_progres line:
{
servo_set_us(5, 2000); // channel 5, microseconds 2000
unsigned int ms_delay = (unsigned int)(2 * 1000.0);
vTaskDelay(( ( portTickType ) ms_delay / portTICK_RATE_MS ) );
servo_set_us(5, 1500); // set back to middle position
}
It triggers the servo OK but the delay is mostly 4 seconds and sometimes 6 seconds (while I intended to be 2 seconds).
What I am doing wrong?
Re: SERVO_TRIGGER and SERVO_SET
Posted:
Thu May 19, 2011 8:29 pm
by Tom
Everything looks fine... I'll need to investigate it a bit deeper. Is the delay OK when you use servo_trigger?
Re: SERVO_TRIGGER and SERVO_SET
Posted:
Wed Jun 01, 2011 11:44 am
by daedalus
When using servo_trigger the delay is OK.
Also with my modified code the navigation is affected, so maybe some programmer skills are needed.