Skip to content
This repository was archived by the owner on Dec 20, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
d1856d1
Initial commit
jaku-jaku Jan 23, 2019
05ad667
basic setup
simeng-yang Feb 8, 2019
f36f363
Develop - Release 0.1 (#7)
w29ahmed Mar 5, 2019
1237a04
Created rr_interface node; Implemented mechanism to communicate to Co…
Apr 26, 2019
09f0161
fix attempt for a vscode issue
Apr 26, 2019
a3fde24
Attempt 2
Apr 26, 2019
07a4894
A
Apr 26, 2019
beb99aa
A
Apr 26, 2019
9144d9b
Removing src/.vs from git history
Apr 26, 2019
a9bf4cf
Created method for serialization/deserialization; needs to be tested …
Apr 28, 2019
8113ec7
Added new message type and method to receive data from the ROS interface
Apr 29, 2019
069bb85
Stuff
w29ahmed May 14, 2019
c4e331d
Up
May 14, 2019
4151179
Added arduino sketch for testing uart communication
w29ahmed May 18, 2019
d8deeb4
Had to move arduino sketch into folder cuz arduion ide is stupid
w29ahmed May 18, 2019
6cf05ac
Commented out previous code and setup UART from scratch to test
w29ahmed May 19, 2019
20860fa
Can read and write seperately but not at the same time :(, also tabs …
w29ahmed May 19, 2019
be58b1a
changed stuff
May 19, 2019
04cd960
merge conflict fixed
Jun 5, 2019
129862e
changed to structs
Jun 5, 2019
740801e
Testing...
Jun 10, 2019
6bf4aa7
Fixed UART COMMUNICATION FINALLY WORKS WOOHOO
Jun 11, 2019
a478044
Setting up stuff
Jun 17, 2019
471a0a8
Conversion complete until specs
Jun 18, 2019
5e1d8ee
ipch random file removed
Jun 18, 2019
b34eef5
Updated more enum tags
Jun 18, 2019
2b7a9fb
stuff
Jun 22, 2019
a43c3bf
works on high level; issue with mcu
Jun 22, 2019
563d1bf
Acutally fixed and works
Jun 22, 2019
b1d6aff
Changed write transmitter related functions to ensure that emitter works
Jun 29, 2019
d348301
Fixed interface to just write
Jul 10, 2019
4de21de
merge conflict fixed
Jul 11, 2019
3437869
Merge branch 'develop' into feature/CoretexM4Communication
DongJunJin Jul 12, 2019
59dd232
Changed behavior
Jul 13, 2019
9e20235
Merge branch 'feature/CoretexM4Communication' of https://github.com/u…
Jul 13, 2019
8268c18
Merge branch 'develop' of https://github.com/uwrobotics/RR2019-Hummin…
Jul 13, 2019
463e04f
BOOP
w29ahmed Jul 13, 2019
a46ed83
stuff
Jul 14, 2019
3b0257d
[WORKING !!!]
jaku-jaku Jul 14, 2019
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ Temporary Items

.vscode/settings.json
.vscode/c_cpp_properties.json
.vscode/ipch/*
.weights

# Notebook checkpoints
Expand Down
36 changes: 36 additions & 0 deletions rr_interface/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
cmake_minimum_required(VERSION 2.8.3)
project(rr_interface)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

set(CMAKE_BUILD_TYPE Release)

find_package(
catkin REQUIRED COMPONENTS
roscpp
rospy
std_msgs
roslint
message_generation
)

add_message_files(
FILES
Transmitter.msg
)

generate_messages(
DEPENDENCIES
std_msgs
)

catkin_package(
CATKIN_DEPENDS message_runtime
)

roslint_cpp()

include_directories(include ${catkin_INCLUDE_DIRS})
add_executable(rr_interface src/interface_main.cpp src/interface.cpp include/interface.hpp)
add_dependencies(rr_interface rr_interface_generate_messages_cpp)
target_link_libraries(rr_interface ${catkin_LIBRARIES})
84 changes: 84 additions & 0 deletions rr_interface/include/interface.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/** @file laser_mapper.hpp
* @author Andrew Jin (D29Jin)
* @competition IARRC 2019
*/

#ifndef INTERFACE_H
#define INTERFACE_H

// ROS headers
#include <ros/ros.h>

#include <rr_interface/Transmitter.h>

typedef struct __attribute__ ((packed))
{
int16_t jetson_ang;
int16_t jetson_spd;
uint16_t jetson_flag;
}jetson_data_t;

typedef struct
{
uint8_t startByte;
jetson_data_t data;
uint8_t endByte;
}jetson_packet_t;

typedef union
{
jetson_packet_t myFrame;
uint8_t serializedArray[8];
}jetson_union_t;

/*
This is a flag that is sent by the transmitter (Jetson -> Coretex M4)
It is designed to send specific commands to ensure that the robot does
not deviate during certain cases
All the values defined above are binary values and should always be the case
*/
enum class jetsonFlag : uint8_t {
ESTOP = 1
// Stuff
};

enum class coretexFlag : uint8_t {
ALIVE = 0,
STABLE = 1,
CONNECTED = 2
};

class Interface
{
public:
Interface(ros::NodeHandle nh);
~Interface();

/*
struct Transmitter {
int16_t steer_angle; // Degrees
uint16_t speed; // cm/s
uint16_t flag; // Flag enum
uint16_t padding;
};
*/

struct Receiver {
coretexFlag flag; // Flag enum
};

std::vector<uint16_t> Serialize(std::vector<uint16_t> transmitter);
Receiver Deserialize(char* buffer);

jetson_union_t transmitter_;
Receiver receiver_;
private:

// Subscribers/Advertisers
ros::Subscriber transmitter_subscriber_;
ros::Publisher receiver_publisher_;

void TransmitterCallback(const rr_interface::Transmitter &msg);
};

#endif // INTERFACE_H
8 changes: 8 additions & 0 deletions rr_interface/launch/interface.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<!--@file interface.launch
- @author Andrew Jin
- @competition IARRC 2019
-->
<launch>
<node pkg="rr_interface" name="rr_interface" type="rr_interface" output="screen">
</node>
</launch>
10 changes: 10 additions & 0 deletions rr_interface/msg/Transmitter.msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# The message currently only receives a value from the coretex m4
# This is mainly designed to help us figure out the current status of M4

# Steering Angle (Degrees)
int16 steer_angle

# Speed (cm/s)
int16 speed

uint16 FLAG
25 changes: 25 additions & 0 deletions rr_interface/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0"?>
<package>
<name>rr_interface</name>
<version>0.0.0</version>
<description>The robot racing interface package</description>
<maintainer email="robotracer@todo.todo">robotracer</maintainer>
<license>TODO</license>

<buildtool_depend>catkin</buildtool_depend>
<build_depend>std_msgs</build_depend>
<build_depend>rospy</build_depend>
<build_depend>roscpp</build_depend>
<build_depend>roslint</build_depend>
<build_depend>boost</build_depend>
<build_depend>message_generation</build_depend>

<run_depend>std_msgs</run_depend>
<run_depend>rospy</run_depend>
<run_depend>roscpp</run_depend>
<run_depend>boost</run_depend>
<run_depend>message_runtime</run_depend>

<export>
</export>
</package>
58 changes: 58 additions & 0 deletions rr_interface/serial_tests/serial_tests.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
//typedef struct Receiver {
// byte speed;
// byte steer;
// byte position;
//};
//
//typedef struct Transmitter {
// byte payload;
//};
//
//union Uni {
// Transmitter frame;
// uint8_t serialized_array[512];
//};
//
//Receiver rx_byte;
//union Uni payloadunion;
//Transmitter tx_byte;

int receivedByte;
String input;
unsigned char output = 'w';

void setup() {
// Setup serial communication with a baud rate of 115200
// and 8 data bits, no parity bits, 1 stop bit (default if not specified)
Serial.begin(115200, SERIAL_8N1);
}

void read()
{
if (Serial.available() > 0)
{
receivedByte = Serial.read();
Serial.print("Received data: ");
Serial.print(receivedByte);
Serial.println();
}
}

void write()
{
Serial.write(output);
// payloadunion.frame.payload = 1;
// tx_byte.payload = 1;
// Serial.write('P');
// Serial.write((uint8_t*)&tx_byte,sizeof(tx_byte));
// Serial.write('S');
// return;
}

void loop() {
write();
delay(10);
read();
//write();
//delay(500);
}
50 changes: 50 additions & 0 deletions rr_interface/src/interface.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/** @file interface.cpp
* @author Andrew Jin (DongJunJin)
* @competition IARRC 2019
*/

// Local
#include "interface.hpp"

/**
* @name Interface
* @brief initiliazes the Interface class
* @return NONE
*/
Interface::Interface(ros::NodeHandle nh) {
transmitter_subscriber_ = nh.subscribe("interface/transmitter", 0 , &Interface::TransmitterCallback, this);
memset(transmitter_.serializedArray, '\n', sizeof(transmitter_.serializedArray));
}

/**
* @name ~Interface
* @brief destructs the Interface class
* @return NONE
*/
Interface::~Interface() {
}

Interface::Receiver Interface::Deserialize(char* buffer)
{
if (buffer)
{
Interface::Receiver rReceiver;

// Converts the data to the correct struct
Receiver *fromChar = (Receiver*)buffer;
return rReceiver;
}
}

void Interface::TransmitterCallback(const rr_interface::Transmitter &msg) {
/*
switch(msg.flag) {
case 0:
transmitter_.flag = jetsonFlag::ESTOP;
break;
}
*/
transmitter_.myFrame.data.jetson_ang = msg.steer_angle;
transmitter_.myFrame.data.jetson_spd = msg.speed;
transmitter_.myFrame.data.jetson_flag = msg.FLAG;
}
Loading