Skip to content

Commit

Permalink
Fix code
Browse files Browse the repository at this point in the history
  • Loading branch information
Chi-EEE committed Dec 22, 2023
1 parent 869db30 commit 5d34b20
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
1 change: 0 additions & 1 deletion app/raspberry_pi/repository/packages/r/rplidar/xmake.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package("rplidar")
add_deps("serial", "spdlog", "tl_expected")
set_sourcedir(path.join(os.scriptdir(), "rplidar"))
set_policy("package.install_always", true)
on_install(function (package)
local configs = {}
import("package.tools.xmake").install(package, configs)
Expand Down
8 changes: 4 additions & 4 deletions app/raspberry_pi/src/car/system/movement/MovementSystem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ namespace car::system::movement {

void initalize()
{
this->pwn->init(1, 0x40);
this->pwm->init(1, 0x40);
std::this_thread::sleep_for(std::chrono::milliseconds(100));
this->pwn->setPWMFreq(FREQUENCY);
this->pwm->setPWMFreq(FREQUENCY);
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
}

Expand All @@ -37,12 +37,12 @@ namespace car::system::movement {

void terminate() {
}
//def map(self, x, in_min, in_max, out_min, out_max):

// https://www.arduino.cc/en/Reference/Map
int map(int x, int in_min, int in_max, int out_min, int out_max) {
return ((x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min);
}

//def _angle_to_analog(self, angle):
int setAngleToAnalog(int angle) {
float pulse_wide;
int analog_value;
Expand Down
5 changes: 4 additions & 1 deletion app/raspberry_pi/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,13 @@ int main()

std::unique_ptr<MessagingSystem> messaging_system = std::make_unique<MessagingSystem>(websocket_url);

std::unique_ptr<MovementSystem> movement_system = std::make_unique<MovementSystem>();

auto car_system = std::make_unique<CarSystem>(
websocket_url,
std::move(scanner),
std::move(messaging_system)
std::move(messaging_system),
std::move(movement_system)
);

// The CarConsole object will display the UI and handle user input:
Expand Down
2 changes: 1 addition & 1 deletion app/raspberry_pi/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ add_requires("imath")

if is_plat("linux", "macosx") then
-- For the SunFounder Car
add_requires("pca9685", {configs = {shared = true}})
add_requires("pca9685")
end

-- For Functional Programming?
Expand Down

0 comments on commit 5d34b20

Please sign in to comment.