Skip to content

Commit 63e033f

Browse files
committed
Issue #21: Fix code style, update README.md, Dockerfile.check (previous commit addition)
1 parent 497ed6f commit 63e033f

File tree

6 files changed

+11
-9
lines changed

6 files changed

+11
-9
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ cd ecu_sw_bb
1616
git submodule init
1717
git submodule update
1818
```
19+
<b> Necessarily check if your glog version is v0.5.0 ! </b>
1920

2021
### Build Docker Image
2122
```
@@ -142,7 +143,7 @@ sudo apt install -y locales
142143
sudo dpkg-reconfigure locales # Choose a locale en_US.UTF-8 = English, United States, UTF8
143144
sudo apt upgrade -y
144145
sudo apt install build-essential -y
145-
sudo apt-get install -y cpufrequtils
146+
sudo apt-get install -y cpufrequtils libgoogle-glog-dev
146147
sudo sed -i 's/GOVERNOR="ondemand"/GOVERNOR="performance"/g' /etc/init.d/cpufrequtils
147148
```
148149

src/kpi_rover_ecu/src/KPIRoverECU.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
#include <vector>
1212

1313
#include "IMUController.h"
14-
#include "loggingIncludes.h"
1514
#include "TCPTransport.h"
1615
#include "UDPClient.h"
16+
#include "loggingIncludes.h"
1717
#include "protocolHandler.h"
1818

1919
KPIRoverECU::KPIRoverECU(ProtocolHanlder *_protocolHandler, TCPTransport *_tcpTransport, UDPClient *_udpClient,
@@ -90,7 +90,7 @@ void KPIRoverECU::IMUThreadFucntion(IMUController *workClass) {
9090
send_val.push_back(bytes[j]);
9191
}
9292
}
93-
93+
9494
LOG_DEBUG << "use UDP client to send message";
9595
udp_client_->Send(send_val);
9696
}

src/kpi_rover_ecu/src/TCPTransport.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ int TCPTransport::Init() {
4545
source_address_[0] = '\0';
4646

4747
sockfd_ = socket(AF_INET, SOCK_STREAM, 0);
48-
4948

5049
if (sockfd_ < 0) {
5150
LOG_ERROR << "Socket()";
@@ -92,7 +91,8 @@ void TCPTransport::Start() {
9291
if (client_sockfd_ >= 0) {
9392
inet_ntop(AF_INET, &client_addr.sin_addr, source_address_, INET_ADDRSTRLEN);
9493
source_port_ = static_cast<int>(ntohs(client_addr.sin_port));
95-
LOG_INFO << "Client connected, source address: " << std::string(source_address_) << " source port: " << source_port_;
94+
LOG_INFO << "Client connected, source address: " << std::string(source_address_)
95+
<< " source port: " << source_port_;
9696
while (true) { // Use true instead of 1
9797
std::uint8_t buffer[kBufferSize];
9898
const ssize_t kBytesReceived = recv(client_sockfd_, buffer, sizeof(buffer), 0);

src/kpi_rover_ecu/src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#include <getopt.h>
2+
#include <glog/logging.h>
23
#include <ifaddrs.h>
34
#include <netdb.h>
45
#include <netinet/in.h>
56
#include <sys/socket.h>
6-
#include <glog/logging.h>
77

88
#include <chrono>
99
#include <csignal>

src/kpi_rover_ecu/src/motor.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
#include <iostream>
1010
#include <ratio>
1111

12-
#include "loggingIncludes.h"
1312
#include "PIDRegulator.h"
13+
#include "loggingIncludes.h"
1414

1515
Motor::Motor(int assigned_number, bool is_inverted, std::array<float, 3> _coeficients)
1616
: motorNumber_(assigned_number), inverted_(is_inverted), currentDutyCycle_(0), setpointRpm_(0), actualRpm_(0) {
@@ -91,7 +91,8 @@ int Motor::GetEncoderCounter() {
9191
const float kTimeDt = GetTimeSegment();
9292
actualRpm_ = static_cast<int>(GetActualRpm(pid_encoder_ticks, kTimeDt));
9393
const int kError = setpointRpm_ - actualRpm_;
94-
LOG_INFO << "set point " << setpointRpm_ << " current point " << actualRpm_ << " error " << kError << " for motor" << motorNumber_;
94+
LOG_INFO << "set point " << setpointRpm_ << " current point " << actualRpm_ << " error " << kError << " for motor"
95+
<< motorNumber_;
9596

9697
LOG_DEBUG << "Run PID regulator";
9798
const int kPidOutput = pidRegulator_.Run(static_cast<float>(kError), kTimeDt);

src/kpi_rover_ecu/src/protocolHandler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ vector<uint8_t> ProtocolHanlder::HandleGetApiVersion(const vector<uint8_t>& mess
5050
vector<uint8_t> ret_val;
5151

5252
ret_val.push_back(ProtocolHanlder::kIdGetApiVersion);
53-
53+
5454
const uint8_t kResponse = kApiVersion;
5555
ret_val.push_back(kResponse);
5656

0 commit comments

Comments
 (0)