Commit from zer0 on branch b_zer0 (2007-06-17 21:28 CEST)
---------------------------------
add a comment for scheduler config
aversive modules/base/scheduler/test/scheduler_config.h 1.4.10.6
aversive modules/base/scheduler/config/scheduler_config.h 1.1.10.7
-------------------------------------------------------
aversive/modules/base/scheduler/test/scheduler_config.h (1.4.10.5 -> 1.4.10.6)
-------------------------------------------------------
***************
*** 15,21 ****
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
! * Revision : $Id: scheduler_config.h,v 1.4.10.5 2007-06-14 16:29:51 zer0
Exp $
*
*/
--- 15,21 ----
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
! * Revision : $Id: scheduler_config.h,v 1.4.10.6 2007-06-17 19:28:03 zer0
Exp $
*
*/
***************
*** 41,48 ****
values of SCHEDULER_CK and SCHEDULER_CLOCK_PRESCALER must also be
coherent (TIMER0_PRESCALER_DIV_VALUE and VALUE) */
#else /* CONFIG_MODULE_SCHEDULER_USE_TIMERS */
#define SCHEDULER_CK TIMER0_PRESCALER_DIV_8
! #define SCHEDULER_CLOCK_PRESCALER 8 /* must coherent with value above */
#endif /* CONFIG_MODULE_SCHEDULER_USE_TIMERS */
--- 41,52 ----
values of SCHEDULER_CK and SCHEDULER_CLOCK_PRESCALER must also be
coherent (TIMER0_PRESCALER_DIV_VALUE and VALUE) */
#else /* CONFIG_MODULE_SCHEDULER_USE_TIMERS */
+
+ /* The 2 values below MUST be coherent:
+ * if SCHEDULER_CK = TIMER0_PRESCALER_DIV_x, then
+ * you must have SCHEDULER_CLOCK_PRESCALER = x too !!! */
#define SCHEDULER_CK TIMER0_PRESCALER_DIV_8
! #define SCHEDULER_CLOCK_PRESCALER 8
#endif /* CONFIG_MODULE_SCHEDULER_USE_TIMERS */
---------------------------------------------------------
aversive/modules/base/scheduler/config/scheduler_config.h (1.1.10.6 ->
1.1.10.7)
---------------------------------------------------------
***************
*** 15,21 ****
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
! * Revision : $Id: scheduler_config.h,v 1.1.10.6 2007-06-14 16:29:51 zer0
Exp $
*
*/
--- 15,21 ----
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
! * Revision : $Id: scheduler_config.h,v 1.1.10.7 2007-06-17 19:28:03 zer0
Exp $
*
*/
***************
*** 41,48 ****
values of SCHEDULER_CK and SCHEDULER_CLOCK_PRESCALER must also be
coherent (TIMER0_PRESCALER_DIV_VALUE and VALUE) */
#else /* CONFIG_MODULE_SCHEDULER_USE_TIMERS */
#define SCHEDULER_CK TIMER0_PRESCALER_DIV_8
! #define SCHEDULER_CLOCK_PRESCALER 8 /* must coherent with value above */
#endif /* CONFIG_MODULE_SCHEDULER_USE_TIMERS */
--- 41,52 ----
values of SCHEDULER_CK and SCHEDULER_CLOCK_PRESCALER must also be
coherent (TIMER0_PRESCALER_DIV_VALUE and VALUE) */
#else /* CONFIG_MODULE_SCHEDULER_USE_TIMERS */
+
+ /* The 2 values below MUST be coherent:
+ * if SCHEDULER_CK = TIMER0_PRESCALER_DIV_x, then
+ * you must have SCHEDULER_CLOCK_PRESCALER = x too !!! */
#define SCHEDULER_CK TIMER0_PRESCALER_DIV_8
! #define SCHEDULER_CLOCK_PRESCALER 8
#endif /* CONFIG_MODULE_SCHEDULER_USE_TIMERS */
Commit from zer0 on branch b_zer0 (2007-06-17 21:34 CEST)
---------------------------------
Change macro to static inline funcs
aversive modules/base/scheduler/scheduler.h 1.8.4.5
-------------------------------------------
aversive/modules/base/scheduler/scheduler.h (1.8.4.4 -> 1.8.4.5)
-------------------------------------------
***************
*** 15,21 ****
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
! * Revision : $Id: scheduler.h,v 1.8.4.4 2007-06-14 16:29:51 zer0 Exp $
*
*/
--- 15,21 ----
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
! * Revision : $Id: scheduler.h,v 1.8.4.5 2007-06-17 19:34:57 zer0 Exp $
*
*/
***************
*** 114,141 ****
#define SCHEDULER_DEFAULT_PRIORITY 128
- #define scheduler_add_single_event_priority(f, data, period, prio) \
- scheduler_add_event(SCHEDULER_SINGLE, f, data, period, prio)
-
- #define scheduler_add_periodical_event_priority(f, data, period, prio) \
- scheduler_add_event(SCHEDULER_PERIODICAL, f, data, period, prio)
-
- #define scheduler_add_single_event(f, data, period) \
- scheduler_add_event(SCHEDULER_SINGLE, f, data, period,
SCHEDULER_DEFAULT_PRIORITY)
-
- #define scheduler_add_periodical_event(f, data, period) \
- scheduler_add_event(SCHEDULER_PERIODICAL, f, data, period,
SCHEDULER_DEFAULT_PRIORITY)
/** Initialisation of the module */
void scheduler_init(void);
/**
! * Adds an event to the event table.
! * Returns the id of the event on succes and -1 on error
! * You can use macro above for simpler use.
*/
int8_t scheduler_add_event(uint8_t unicity, void (*f)(void *), void * data,
uint16_t period, uint8_t priority);
/**
* Dels an event from the table by its ID. If there is no event,
* nothing is done.
--- 114,163 ----
#define SCHEDULER_DEFAULT_PRIORITY 128
/** Initialisation of the module */
void scheduler_init(void);
/**
! * Add an event to the event table.
! * Return the id of the event on succes and -1 on error
! * You can use static inline funcs below for simpler use.
*/
int8_t scheduler_add_event(uint8_t unicity, void (*f)(void *), void * data,
uint16_t period, uint8_t priority);
+
+ /**
+ * Add a single event to the event table, specifying the priority
+ */
+ static inline int8_t scheduler_add_single_event_priority(void (*f)(void *),
void * data, uint16_t period, uint8_t priority)
+ {
+ return scheduler_add_event(SCHEDULER_SINGLE, f, data, period, priority);
+ }
+
+ /**
+ * Add a periodical event to the event table, specifying the priority
+ */
+ static inline int8_t scheduler_add_periodical_event_priority(void (*f)(void
*), void * data, uint16_t period, uint8_t priority)
+ {
+ return scheduler_add_event(SCHEDULER_PERIODICAL, f, data, period,
priority);
+ }
+
+ /**
+ * Add a single event to the event table, with the default priority
+ */
+ static inline int8_t scheduler_add_single_event(void (*f)(void *), void *
data, uint16_t period)
+ {
+ return scheduler_add_event(SCHEDULER_SINGLE, f, data, period,
SCHEDULER_DEFAULT_PRIORITY);
+ }
+
+ /**
+ * Add a periodical event to the event table, with the default priority
+ */
+ static inline int8_t scheduler_add_periodical_event(void (*f)(void *), void *
data, uint16_t period)
+ {
+ return scheduler_add_event(SCHEDULER_PERIODICAL, f, data, period,
SCHEDULER_DEFAULT_PRIORITY);
+ }
+
/**
* Dels an event from the table by its ID. If there is no event,
* nothing is done.
Commit from zer0 on branch b_zer0 (2007-06-17 23:23 CEST)
---------------------------------
Use pointer args instead of 64bits struct arg.
aversive modules/devices/robot/robot_system/robot_system.c 1.6.4.3
aversive modules/devices/robot/robot_system/angle_distance.h 1.3.4.3
aversive modules/devices/robot/robot_system/angle_distance.c 1.4.4.2
----------------------------------------------------------
aversive/modules/devices/robot/robot_system/robot_system.c (1.6.4.2 -> 1.6.4.3)
----------------------------------------------------------
***************
*** 15,21 ****
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
! * Revision : $Id: robot_system.c,v 1.6.4.2 2007-05-23 17:18:13 zer0 Exp $
*
*/
--- 15,21 ----
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
! * Revision : $Id: robot_system.c,v 1.6.4.3 2007-06-17 21:23:40 zer0 Exp $
*
*/
***************
*** 220,226 ****
IRQ_UNLOCK(flags);
p.angle = angle;
! w = rs_get_wheels_from_polar(p);
SAFE_SETPWM(rs->left_pwm, rs->left_pwm_param, w.left);
SAFE_SETPWM(rs->right_pwm, rs->right_pwm_param, w.right);
--- 220,226 ----
IRQ_UNLOCK(flags);
p.angle = angle;
! rs_get_wheels_from_polar(&w, &p);
SAFE_SETPWM(rs->left_pwm, rs->left_pwm_param, w.left);
SAFE_SETPWM(rs->right_pwm, rs->right_pwm_param, w.right);
***************
*** 243,249 ****
IRQ_UNLOCK(flags);
p.distance = distance;
! w = rs_get_wheels_from_polar(p);
SAFE_SETPWM(rs->left_pwm, rs->left_pwm_param, w.left);
SAFE_SETPWM(rs->right_pwm, rs->right_pwm_param, w.right);
--- 243,249 ----
IRQ_UNLOCK(flags);
p.distance = distance;
! rs_get_wheels_from_polar(&w, &p);
SAFE_SETPWM(rs->left_pwm, rs->left_pwm_param, w.left);
SAFE_SETPWM(rs->right_pwm, rs->right_pwm_param, w.right);
***************
*** 459,470 ****
wmot.left = f64_msb_mul(f64_from_lsb(wmot.left), rs->left_mot_gain);
wmot.right = f64_msb_mul(f64_from_lsb(wmot.right), rs->right_mot_gain);
! pext = rs_get_polar_from_wheels(wext);
! pmot = rs_get_polar_from_wheels(wmot);
/* apply ratio to polar and reupdate wheels for ext coders */
pext.angle = f64_msb_mul(f64_from_lsb(pext.angle), rs->ratio_mot_ext);
! wext = rs_get_wheels_from_polar(pext);
/* update from external encoders */
if( rs->flags & RS_USE_EXT ) {
--- 459,470 ----
wmot.left = f64_msb_mul(f64_from_lsb(wmot.left), rs->left_mot_gain);
wmot.right = f64_msb_mul(f64_from_lsb(wmot.right), rs->right_mot_gain);
! rs_get_polar_from_wheels(&pext, &wext);
! rs_get_polar_from_wheels(&pmot, &wmot);
/* apply ratio to polar and reupdate wheels for ext coders */
pext.angle = f64_msb_mul(f64_from_lsb(pext.angle), rs->ratio_mot_ext);
! rs_get_wheels_from_polar(&wext, &pext);
/* update from external encoders */
if( rs->flags & RS_USE_EXT ) {
------------------------------------------------------------
aversive/modules/devices/robot/robot_system/angle_distance.h (1.3.4.2 ->
1.3.4.3)
------------------------------------------------------------
***************
*** 15,21 ****
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
! * Revision : $Id: angle_distance.h,v 1.3.4.2 2007-05-23 17:18:13 zer0 Exp $
*
*/
--- 15,21 ----
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
! * Revision : $Id: angle_distance.h,v 1.3.4.3 2007-06-17 21:23:41 zer0 Exp $
*
*/
***************
*** 39,49 ****
* convert the values of wheels encoders (left, right) into (distance,
* angle)
*/
! struct rs_polar rs_get_polar_from_wheels(struct rs_wheels w);
/**
* convert (distance, angle) into (left, right)
*/
! struct rs_wheels rs_get_wheels_from_polar(struct rs_polar p);
#endif
--- 39,49 ----
* convert the values of wheels encoders (left, right) into (distance,
* angle)
*/
! void rs_get_polar_from_wheels(struct rs_polar * p_dst, struct rs_wheels *
w_src);
/**
* convert (distance, angle) into (left, right)
*/
! void rs_get_wheels_from_polar(struct rs_wheels * w_dst, struct rs_polar *
p_src);
#endif
------------------------------------------------------------
aversive/modules/devices/robot/robot_system/angle_distance.c (1.4.4.1 ->
1.4.4.2)
------------------------------------------------------------
***************
*** 15,21 ****
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
! * Revision : $Id: angle_distance.c,v 1.4.4.1 2006-11-26 21:06:05 zer0 Exp $
*
*/
--- 15,21 ----
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
! * Revision : $Id: angle_distance.c,v 1.4.4.2 2007-06-17 21:23:41 zer0 Exp $
*
*/
***************
*** 25,51 ****
* convert the values of wheels encoders (left, right) into (distance,
* angle)
*/
! struct rs_polar rs_get_polar_from_wheels(struct rs_wheels w)
{
! struct rs_polar p;
!
! p.distance = w.right + w.left;
! p.angle = w.right - w.left;
!
! return p;
}
/**
* convert (distance, angle) into (left, right)
*/
! struct rs_wheels rs_get_wheels_from_polar(struct rs_polar p)
{
! struct rs_wheels w;
!
! w.left = (p.distance - p.angle) / 2;
! w.right = (p.distance + p.angle) / 2;
!
! return w;
}
-
--- 25,42 ----
* convert the values of wheels encoders (left, right) into (distance,
* angle)
*/
! void rs_get_polar_from_wheels(struct rs_polar * p_dst, struct rs_wheels *
w_src)
{
! p_dst->distance = w_src->right + w_src->left;
! p_dst->angle = w_src->right - w_src->left;
}
/**
* convert (distance, angle) into (left, right)
*/
! void rs_get_wheels_from_polar(struct rs_wheels * w_dst, struct rs_polar *
p_src)
{
! w_dst->left = (p_src->distance - p_src->angle) / 2;
! w_dst->right = (p_src->distance + p_src->angle) / 2;
}
_______________________________________________
Avr-list mailing list
[email protected]
CVSWEB : http://cvsweb.droids-corp.org/cgi-bin/viewcvs.cgi/aversive
WIKI : http://wiki.droids-corp.org/index.php/Aversive
DOXYGEN : http://zer0.droids-corp.org/doxygen_aversive/html/
BUGZILLA : http://bugzilla.droids-corp.org
COMMIT LOGS : http://zer0.droids-corp.org/aversive_commitlog