]> rtime.felk.cvut.cz Git - eurobot/public.git/blob - src/robofsm/actuators.c
robomon: Implement motor simulation
[eurobot/public.git] / src / robofsm / actuators.c
1 /**
2  * @file actuators.c
3  * @author Martin Zidek
4  * @author Michal Sojka
5  * @author Filip Jares (?)
6  * @date 2009-2010
7  *
8  * @brief Robot's actuators control library
9  */
10
11 /*
12  * actuators.c                  09/02/25
13  *
14  * Robot's actuators control.
15  *
16  * Copyright: (c) 2008-2010 CTU Dragons
17  *            CTU FEE - Department of Control Engineering
18  * License: GNU GPL v.2
19  */
20
21 #include <robot.h>
22 #include <actuators.h>
23
24 static struct robottype_orte_data *orte = NULL;
25
26 void act_init(struct robottype_orte_data *ortedata)
27 {
28         orte = ortedata;
29 }
30
31 // FIXME: obsolete (?)
32 void act_hokuyo(unsigned char angle)
33 {
34         orte->hokuyo_pitch.angle = angle;
35         ORTEPublicationSend(orte->publication_hokuyo_pitch);
36 }
37
38 void act_camera_on(void)
39 {
40         orte->camera_control.on = 1;
41         ORTEPublicationSend(orte->publication_camera_control);
42 }
43
44 void act_camera_off(void)
45 {
46         orte->camera_control.on = 0;
47         ORTEPublicationSend(orte->publication_camera_control);
48 }
49
50 static uint16_t vidle_last_request;
51
52 void act_vidle(uint16_t position, char speed)
53 {
54         orte->vidle_cmd.req_pos = position;
55         orte->vidle_cmd.speed = speed;
56         /* Remember the request so that we change check for matching
57          * response in rcv_vidle_status_cb() */
58         vidle_last_request = position;
59         ORTEPublicationSend(orte->publication_vidle_cmd);
60 }
61
62 uint16_t act_vidle_get_last_reqest(void)
63 {
64         return vidle_last_request;
65 }