Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update configurations for new jetson orin nx #334

Merged
merged 1 commit into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions enable_CAN.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
#!/bin/bash

CAN_BITRATE="${CAN_BITRATE:-125000}"
CAN_DBITRATE="${CAN_DBITRATE:-500000}"
CAN_DBITRATE="${CAN_DBITRATE:-125000}"

sudo modprobe can
sudo modprobe can_raw
sudo modprobe mttcan

sudo ip link set can0 type can bitrate "${CAN_BITRATE}" dbitrate "${CAN_DBITRATE}" \
berr-reporting on fd on
sudo ip link set can1 type can bitrate "${CAN_BITRATE}" dbitrate "${CAN_DBITRATE}" \
berr-reporting on fd on
berr-reporting on fd on restart-ms 100
sudo ip link set up can0
sudo ip link set up can1

if [[ $? != 0 ]]; then
echo "Could not enable hardware CAN interface; using virtual CAN instead."
sudo ip link add type vcan
sudo ip link set dev vcan0 up
echo "Error enabling can0 interface!"
fi
11 changes: 3 additions & 8 deletions enable_CAN_and_GPS.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,19 @@
#!/bin/bash

CAN_BITRATE=125000
CAN_DBITRATE=500000
CAN_DBITRATE=125000
GPS_PATH="/dev/ttyUSB0"

sudo modprobe can
sudo modprobe can_raw
sudo modprobe mttcan

sudo ip link set can0 type can bitrate "${CAN_BITRATE}" dbitrate "${CAN_DBITRATE}" \
berr-reporting on fd on
sudo ip link set can1 type can bitrate "${CAN_BITRATE}" dbitrate "${CAN_DBITRATE}" \
berr-reporting on fd on
berr-reporting on fd on restart-ms 100
sudo ip link set up can0
sudo ip link set up can1

if [[ $? != 0 ]]; then
echo "Could not enable hardware CAN interface; using virtual CAN instead."
sudo ip link add type vcan
sudo ip link set dev vcan0 up
echo "Error enabling can0 interface!"
fi

# For some reason, on the rover, the gpsd that starts on boot does not
Expand Down
6 changes: 3 additions & 3 deletions rover-config/50-rover-cameras.rules
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
# Install this in /etc/udev/rules.d

# Hand camera
SUBSYSTEM=="video4linux", ATTRS{idVendor}=="0c45", ATTRS{idProduct}=="6369", KERNELS=="1-2.1", SYMLINK+="video20"
SUBSYSTEM=="video4linux", ATTRS{idVendor}=="0c45", ATTRS{idProduct}=="6369", ATTR{index}=="0", SYMLINK+="video20"

# Forearm camera
SUBSYSTEM=="video4linux", ATTRS{idVendor}=="32e4", ATTRS{idProduct}=="9230", KERNELS=="1-2.1", SYMLINK+="video30"
SUBSYSTEM=="video4linux", ATTRS{idVendor}=="32e4", ATTRS{idProduct}=="9230", ATTR{index}=="0", SYMLINK+="video30"

# Mast camera
SUBSYSTEM=="video4linux", ATTRS{idVendor}=="05a3", ATTRS{idProduct}=="9230", KERNELS=="1-2.4.4", SYMLINK+="video40"
SUBSYSTEM=="video4linux", ATTRS{idVendor}=="05a3", ATTRS{idProduct}=="9230", ATTR{index}=="0", SYMLINK+="video40"
7 changes: 5 additions & 2 deletions src/CAN/CAN.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,13 +264,16 @@ void initCAN() {
}

void sendCANPacket(const CANPacket& packet) {
can_frame frame;
canfd_frame frame;
std::memset(&frame, 0, sizeof(frame));
frame.can_id = packet.id;
frame.can_dlc = packet.dlc;
frame.len = packet.dlc;
std::memcpy(frame.data, packet.data, packet.dlc);
bool success;
{
std::lock_guard lock(socketMutex);
// note that frame is a canfd_frame but we're using sizeof(can_frame)
// not sure why this is required to work
success = write(can_fd, &frame, sizeof(struct can_frame)) == sizeof(struct can_frame);
tcdrain(can_fd);
}
Expand Down
1 change: 1 addition & 0 deletions src/world_interface/real_world_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ void openCamera(CameraID camID, const char* cameraPath) {

void setupCameras() {
openCamera(Constants::MAST_CAMERA_ID, Constants::MAST_CAMERA_CONFIG_PATH);
openCamera(Constants::FOREARM_CAMERA_ID, Constants::FOREARM_CAMERA_CONFIG_PATH);
openCamera(Constants::HAND_CAMERA_ID, Constants::HAND_CAMERA_CONFIG_PATH);
}
} // namespace
Expand Down