]> rtime.felk.cvut.cz Git - eurobot/public.git/blob - src/robofsm/actuators.cc
robofsm: Change type of files
[eurobot/public.git] / src / robofsm / actuators.cc
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 void act_camera_on(void)
32 {
33         orte->camera_control.on = 1;
34         ORTEPublicationSend(orte->publication_camera_control);
35 }
36
37 void act_camera_off(void)
38 {
39         orte->camera_control.on = 0;
40         ORTEPublicationSend(orte->publication_camera_control);
41 }
42
43 void act_magnet(unsigned char on)
44 {
45         orte->magnet_cmd.on = on;
46         ORTEPublicationSend(orte->publication_magnet_cmd);
47 }
48
49 static int crane_last_request;
50
51 void act_crane(int position)
52 {
53         orte->crane_cmd.req_pos = position;
54         /* Remember the request so that we change check for matching
55          * response in rcv_crane_status_cb() */
56         crane_last_request = position;
57         ORTEPublicationSend(orte->publication_crane_cmd);
58 }
59
60 int act_crane_get_last_reqest(void)
61 {
62         return crane_last_request;
63 }