-
Notifications
You must be signed in to change notification settings - Fork 1
/
manipulation.c
67 lines (54 loc) · 1.49 KB
/
manipulation.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*******************************************************************************
* Copyright 2018~2019
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
# @file manipulation.c
# @brief
# @author [email protected]
#******************************************************************************/
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
#include <string.h>
#include <stdarg.h>
#include "utils.h"
#include "lobot.h"
#include "oled.h"
#include "nrf52840.h"
#include "miniros.h"
#include "message.h"
#include "manipulation.h"
void manipulation_msg_handle(uint8_t msg_id,uint8_t *msg_buf)
{
ret_code_t ret;
int distance = 0;
char buf[20];
LOG("manipulation_msg_handle:%d,%s!\n",msg_id,msg_buf);
switch(msg_id){
case R_ARM_UP:
distance = atoi(msg_buf);
sprintf(buf,"%d-2000-1000",R_ARM_SHOULDER);
miniros_cmd_send("oled",7,"right arm up");
miniros_cmd_send("lobot",SINGLE_CONTROL,buf);
break;
case R_ARM_DOWN:
break;
case L_ARM_UP:
break;
case L_ARM_DOWN:
break;
default:
break;
}
}
void manipulation_module_init()
{
miniros_msg_module_register("manipulation",manipulation_msg_handle);
LOG("manipulation module init!\n");
}
/** @} */