Skip to content

Commit

Permalink
Compatibility with Mbed CLI.
Browse files Browse the repository at this point in the history
  • Loading branch information
byq77 committed Dec 11, 2018
1 parent 512775e commit 1e00285
Show file tree
Hide file tree
Showing 20 changed files with 78 additions and 27 deletions.
4 changes: 2 additions & 2 deletions MbedHardware.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@

class MbedHardware {
public:
MbedHardware(PinName tx, PinName rx, long baud = 57600)
MbedHardware(PinName tx, PinName rx, long baud = ROSSERIAL_BAUDRATE)
:iostream(tx, rx){
baud_ = baud;
t.start();
}

MbedHardware()
:iostream(ROSSERIAL_TX, ROSSERIAL_RX) {
baud_ = 57600;
baud_ = ROSSERIAL_BAUDRATE;
t.start();
}

Expand Down
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# rosserial-mbed-lib

This repository is a slightly modified content of `ros_lib` directory created accordingly to [rosserial MBED Setup](http://wiki.ros.org/rosserial_mbed/Tutorials/rosserial_mbed%20Setup) tutorial from official ros documentation. Modification involves changing default Serial pins used by library to fit CORE2 RPI connector. You can adjust them in `mbed_app.json` under "target_overrides" tag.
This repository is a slightly modified content of `ros_lib` directory created accordingly to [rosserial MBED Setup](http://wiki.ros.org/rosserial_mbed/Tutorials/rosserial_mbed%20Setup) tutorial from official ros documentation.

Condensed, step by step recipe:
1. `$ mkdir -p ~/ros_workspace/src && cd ros_workspace/src && catkin_init_workspace`
Expand All @@ -9,6 +9,20 @@ Condensed, step by step recipe:
4. `$ source devel/setup.bash`
5. `$ rosrun rosserial_mbed make_libraries.py ~/workspace/ros/lib`

This library is compatible with Mbed CLI tools. You can change default Serial pins and baudrate used by rosserial in `mbed_app.json`.

Example:

```json
{
"target_overrides":{
"*": {
"mbed-rosserial-lib.tx_pin": "MY_TX_PIN",
"mbed-rosserial-lib.rx_pin": "MY_RX_PIN",
"mbed-rosserial-lib.baudrate": "230400"
}
}
}
```


2 changes: 1 addition & 1 deletion actionlib_msgs/GoalID.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <string.h>
#include <stdlib.h>
#include "ros/msg.h"
#include "ros/time.h"
#include "ros/ros_time.h"

namespace actionlib_msgs
{
Expand Down
2 changes: 1 addition & 1 deletion control_msgs/QueryTrajectoryState.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <string.h>
#include <stdlib.h>
#include "ros/msg.h"
#include "ros/time.h"
#include "ros/ros_time.h"

namespace control_msgs
{
Expand Down
2 changes: 1 addition & 1 deletion gazebo_msgs/ApplyBodyWrench.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "ros/msg.h"
#include "ros/duration.h"
#include "geometry_msgs/Wrench.h"
#include "ros/time.h"
#include "ros/ros_time.h"
#include "geometry_msgs/Point.h"

namespace gazebo_msgs
Expand Down
2 changes: 1 addition & 1 deletion gazebo_msgs/ApplyJointEffort.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <stdlib.h>
#include "ros/msg.h"
#include "ros/duration.h"
#include "ros/time.h"
#include "ros/ros_time.h"

namespace gazebo_msgs
{
Expand Down
2 changes: 1 addition & 1 deletion laser_assembler/AssembleScans.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <string.h>
#include <stdlib.h>
#include "ros/msg.h"
#include "ros/time.h"
#include "ros/ros_time.h"
#include "sensor_msgs/PointCloud.h"

namespace laser_assembler
Expand Down
2 changes: 1 addition & 1 deletion laser_assembler/AssembleScans2.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <stdlib.h>
#include "ros/msg.h"
#include "sensor_msgs/PointCloud2.h"
#include "ros/time.h"
#include "ros/ros_time.h"

namespace laser_assembler
{
Expand Down
17 changes: 11 additions & 6 deletions mbed_lib.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
{
"name": "mbed-rosserial-lib",
"config": {
"default_tx_pin": {
"help": "Default library's Serial TX pin.",
"tx_pin": {
"help": "Default library Serial TX pin.",
"macro_name": "ROSSERIAL_TX",
"value": "RPI_SERIAL_TX"
"value": "USBTX"
},
"default_rx_pin": {
"help": "Default library's Serial RX pin.",
"rx_pin": {
"help": "Default library Serial RX pin.",
"macro_name": "ROSSERIAL_RX",
"value": "RPI_SERIAL_RX"
"value": "USBRX"
},
"rx_baudrate": {
"help": "Default library Serial baudrate.",
"macro_name": "ROSSERIAL_BAUDRATE",
"value": "115200"
}
}
}
2 changes: 1 addition & 1 deletion nav_msgs/MapMetaData.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <string.h>
#include <stdlib.h>
#include "ros/msg.h"
#include "ros/time.h"
#include "ros/ros_time.h"
#include "geometry_msgs/Pose.h"

namespace nav_msgs
Expand Down
2 changes: 1 addition & 1 deletion polled_camera/GetPolledImage.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "ros/msg.h"
#include "sensor_msgs/RegionOfInterest.h"
#include "ros/duration.h"
#include "ros/time.h"
#include "ros/ros_time.h"

namespace polled_camera
{
Expand Down
6 changes: 3 additions & 3 deletions ros/time.h → ros/ros_time.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef ROS_TIME_H_
#define ROS_TIME_H_
#ifndef __ROS_TIME_H__
#define __ROS_TIME_H__

#include "ros/duration.h"
#include "duration.h"
#include <math.h>
#include <stdint.h>

Expand Down
2 changes: 1 addition & 1 deletion rosgraph_msgs/Clock.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <string.h>
#include <stdlib.h>
#include "ros/msg.h"
#include "ros/time.h"
#include "ros/ros_time.h"

namespace rosgraph_msgs
{
Expand Down
2 changes: 1 addition & 1 deletion rosgraph_msgs/TopicStatistics.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <string.h>
#include <stdlib.h>
#include "ros/msg.h"
#include "ros/time.h"
#include "ros/ros_time.h"
#include "ros/duration.h"

namespace rosgraph_msgs
Expand Down
2 changes: 1 addition & 1 deletion sensor_msgs/TimeReference.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <stdlib.h>
#include "ros/msg.h"
#include "std_msgs/Header.h"
#include "ros/time.h"
#include "ros/ros_time.h"

namespace sensor_msgs
{
Expand Down
32 changes: 32 additions & 0 deletions std_msgs/.mbedignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Bool.h
Byte.h
ByteMultiArray.h
Char.h
ColorRGBA.h
Duration.h
Empty.h
Float32.h
Float32MultiArray.h
Float64.h
Float64MultiArray.h
Header.h
Int16.h
Int16MultiArray.h
Int32.h
Int32MultiArray.h
Int64.h
Int64MultiArray.h
Int8.h
Int8MultiArray.h
MultiArrayDimension.h
MultiArrayLayout.h
String.h
Time.h
UInt16.h
UInt16MultiArray.h
UInt32.h
UInt32MultiArray.h
UInt64.h
UInt64MultiArray.h
UInt8.h
UInt8MultiArray.h
2 changes: 1 addition & 1 deletion std_msgs/Header.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <string.h>
#include <stdlib.h>
#include "ros/msg.h"
#include "ros/time.h"
#include "ros/ros_time.h"

namespace std_msgs
{
Expand Down
2 changes: 1 addition & 1 deletion std_msgs/Time.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <string.h>
#include <stdlib.h>
#include "ros/msg.h"
#include "ros/time.h"
#include "ros/ros_time.h"

namespace std_msgs
{
Expand Down
2 changes: 1 addition & 1 deletion tf2_msgs/LookupTransformGoal.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <string.h>
#include <stdlib.h>
#include "ros/msg.h"
#include "ros/time.h"
#include "ros/ros_time.h"
#include "ros/duration.h"

namespace tf2_msgs
Expand Down
2 changes: 1 addition & 1 deletion time.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/

#include "ros/time.h"
#include "ros/ros_time.h"

namespace ros
{
Expand Down

0 comments on commit 1e00285

Please sign in to comment.