source: flair-src/tags/latest/lib/FlairIpc/src/IpcBldc.cpp@ 411

Last change on this file since 411 was 397, checked in by Sanahuja Guillaume, 11 months ago

add ipc lib

  • Property svn:eol-style set to native
File size: 1.4 KB
Line 
1// %flair:license{
2// This file is part of the Flair framework distributed under the
3// CECILL-C License, Version 1.0.
4// %flair:license}
5// created: 2021/03/03
6// filename: IpcBldc.cpp
7//
8// author: Sébastien Ambroziak
9// Copyright Heudiasyc UMR UTC/CNRS 7253
10//
11// version: $Id: $
12//
13// purpose: Class for a simulation bldc
14//
15//
16/*********************************************************************/
17
18#include "IpcBldc.h"
19#include "shm_send.h"
20#include <FrameworkManager.h>
21#include <GridLayout.h>
22#include <Matrix.h>
23
24using namespace flair::core;
25using namespace flair::gui;
26
27namespace flair {
28namespace actuator {
29
30IpcBldc::IpcBldc(const IODevice *parent, Layout *layout, string name,
31 uint8_t motors_count, const char* ipc_name, int ipc_channel)
32 : Bldc(parent, layout, name, motors_count) {
33
34
35 //sender = new IpcSenderTab<uint16_t>(motors_count,ipc_name,ipc_channel);
36 sender = new ShmSenderTab<float>(motors_count,ipc_name,ipc_channel);
37 SetIsReady(true);
38}
39
40IpcBldc::~IpcBldc() {
41
42}
43
44void IpcBldc::SetMotors(float *value) {
45
46 sender->send(value);
47
48 // on prend une fois pour toute le mutex et on fait des accès directs
49 output->GetMutex();
50 for (int i = 0; i < MotorsCount(); i++) {
51 output->SetValueNoMutex(i, 0, value[i]);
52 }
53 output->ReleaseMutex();
54}
55
56} // end namespace sensor
57} // end namespace flair
Note: See TracBrowser for help on using the repository browser.