Skip to content

Commit 601099b

Browse files
authored
Merge branch 'main' into jamen/track-global-waypoints
2 parents f9f833b + d09ca43 commit 601099b

File tree

9 files changed

+31
-19
lines changed

9 files changed

+31
-19
lines changed

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"name": "Sailbot Workspace",
44
"dockerComposeFile": [
55
"docker-compose.yml",
6-
"website/docker-compose.website.yml", // website
6+
// "website/docker-compose.website.yml", // website
77

88
// Uncomment the files containing the programs you need
99
// "docs/docker-compose.docs.yml", // docs

.github/CODEOWNERS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# the repo. Unless a later match takes precedence,
66
# these owners will be requested for
77
# review when someone opens a pull request.
8-
* @SPDonaghy
8+
* @SPDonaghy @FireBoyAJ24
99

1010
# boat_simulator
1111
/notebooks/boat_simulator @eomielan
@@ -29,7 +29,7 @@
2929
/src/local_pathfinding @jamenkaye @FireBoyAJ24 @SPDonaghy
3030

3131
# network_systems
32-
/src/network_systems @Jng468 @vaibhavambastha
32+
/src/network_systems @Jng468 @vaibhavambastha @lross03
3333

3434
# website
3535
/src/website @JordanChen123

src/local_pathfinding/local_pathfinding/node_mock_gps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from geopy.distance import great_circle
1111
from rclpy.node import Node
1212

13-
from local_pathfinding.objectives import get_true_wind
13+
from local_pathfinding.ompl_objectives import get_true_wind
1414

1515
MEAN_SPEED = ci.HelperSpeed(speed=15.0) # mean boat speed in kmph
1616

File renamed without changes.

src/local_pathfinding/local_pathfinding/ompl_path.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
import local_pathfinding.coord_systems as cs
2323
import local_pathfinding.obstacles as ob
24-
from local_pathfinding.objectives import get_sailing_objective
24+
from local_pathfinding.ompl_objectives import get_sailing_objective
2525

2626
if TYPE_CHECKING:
2727
from local_pathfinding.local_path import LocalPathState

src/local_pathfinding/local_pathfinding/visualizer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
from shapely.geometry import Polygon
2828

2929
import local_pathfinding.coord_systems as cs
30-
from local_pathfinding.objectives import get_true_wind
30+
from local_pathfinding.ompl_objectives import get_true_wind
3131

3232
app = dash.Dash(__name__)
3333

src/local_pathfinding/test/test_objectives.py renamed to src/local_pathfinding/test/test_ompl_objectives.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
from rclpy.impl.rcutils_logger import RcutilsLogger
66

77
import local_pathfinding.coord_systems as coord_systems
8-
import local_pathfinding.objectives as objectives
8+
import local_pathfinding.ompl_objectives as objectives
99
import local_pathfinding.ompl_path as ompl_path
1010
from local_pathfinding.local_path import LocalPathState
11-
from local_pathfinding.objectives import get_true_wind
11+
from local_pathfinding.ompl_objectives import get_true_wind
1212

1313
# Upwind downwind cost multipliers
1414
UPWIND_MULTIPLIER = 3000.0

src/network_systems/projects/can_transceiver/src/can_transceiver.cpp

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "can_transceiver.h"
22

33
#include <errno.h>
4+
#include <fcntl.h>
45
#include <linux/can.h>
56
#include <net/if.h>
67
#include <sys/ioctl.h>
@@ -108,10 +109,19 @@ CanTransceiver::~CanTransceiver()
108109

109110
void CanTransceiver::receive()
110111
{
112+
int flags = fcntl(sock_desc_, F_GETFL, 0);
113+
if (flags == -1) {
114+
std::cerr << "failed to get flags for CAN socket fd" << std::endl;
115+
}
116+
// make read() non-blocking so mutex gets released
117+
flags |= O_NONBLOCK;
118+
if (fcntl(sock_desc_, F_SETFL, flags) == -1) {
119+
std::cerr << "failed to set flags for CAN socket fd" << std::endl;
120+
}
111121
while (!shutdown_flag_) {
112122
// make sure the lock is acquired and released INSIDE the loop, otherwise send() will never get the lock
113-
std::lock_guard<std::mutex> lock(can_mtx_);
114123
CanFrame frame;
124+
std::lock_guard<std::mutex> lock(can_mtx_);
115125
ssize_t bytes_read = read(sock_desc_, &frame, sizeof(CanFrame));
116126
if (bytes_read > 0) {
117127
if (bytes_read != sizeof(CanFrame)) {
@@ -121,8 +131,10 @@ void CanTransceiver::receive()
121131
onNewCanData(frame);
122132
}
123133
} else if (bytes_read < 0) {
124-
std::cerr << "CAN read error: " << errno << "(" << strerror(errno) // NOLINT(concurrency-mt-unsafe)
125-
<< ")" << std::endl;
134+
if (errno != EAGAIN && errno != EWOULDBLOCK) {
135+
std::cerr << "CAN read error: " << errno << "(" << strerror(errno) // NOLINT(concurrency-mt-unsafe)
136+
<< ")" << std::endl;
137+
}
126138
}
127139
}
128140
}

src/network_systems/projects/can_transceiver/src/can_transceiver_ros_intf.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -532,17 +532,17 @@ class CanTransceiverIntf : public NetNode
532532
void subDesiredHeadingCb(msg::DesiredHeading desired_heading)
533533
{
534534
desired_heading_ = desired_heading;
535-
try {
536-
CAN_FP::DesiredHeading desired_heading_frame(desired_heading, CanId::MAIN_TR_TAB);
535+
// try {
536+
auto desired_heading_frame = CAN_FP::DesiredHeading(desired_heading_, CanId::MAIN_HEADING);
537537
can_trns_->send(desired_heading_frame.toLinuxCan());
538538
RCLCPP_INFO(
539539
this->get_logger(), "%s %s", getCurrentTimeString().c_str(), desired_heading_frame.toString().c_str());
540-
} catch (const std::out_of_range & e) {
541-
RCLCPP_WARN(
542-
this->get_logger(), "%s Attempted to construct DesiredHeading but was out of range",
543-
getCurrentTimeString().c_str());
544-
return;
545-
}
540+
// } catch (const std::out_of_range & e) {
541+
// RCLCPP_WARN(
542+
// this->get_logger(), "%s Attempted to construct DesiredHeading but was out of range",
543+
// getCurrentTimeString().c_str());
544+
// return;
545+
// }
546546
}
547547

548548
/**

0 commit comments

Comments
 (0)