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

Migrate to python3 #41

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
6 changes: 5 additions & 1 deletion src/ros_lib/STM32Hardware.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@
#ifndef ROS_STM32_HARDWARE_H_
#define ROS_STM32_HARDWARE_H_

#define STM32F3xx // Change for your device
#define STM32L4xx // Change for your device
#ifdef STM32L4xx
#include "stm32l4xx_hal.h"
#include "stm32l4xx_hal_uart.h"
#endif /* STM32L4xx */
#ifdef STM32F3xx
#include "stm32f3xx_hal.h"
#include "stm32f3xx_hal_uart.h"
Expand Down
28 changes: 18 additions & 10 deletions src/rosserial_stm32/make_libraries.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,12 @@
rosrun rosserial_stm32 make_libraries.py <output_path>
"""

import os
import sys
import rospkg
import rosserial_client

from rosserial_client.make_library import *
from pathlib import Path

# for copying files
import shutil
Expand All @@ -70,26 +73,31 @@
}

# need correct inputs
if (len(sys.argv) < 2):
print __usage__
exit()
if len(sys.argv) < 2:
print(__usage__)
exit()

# get output path
path = sys.argv[1]
if path[-1] == "/":
path = path[0:-1]
print "\nExporting to %s" % path

path += "/ros_lib/"
print(f"Exporting to {path}")

Path(path).mkdir(parents=True, exist_ok=True)
rospack = rospkg.RosPack()

# copy ros_lib stuff in
rosserial_stm32_dir = rospack.get_path(THIS_PACKAGE)
files = os.listdir(rosserial_stm32_dir+"/src/ros_lib")
files = os.listdir(rosserial_stm32_dir + "/src/ros_lib")

for f in files:
if os.path.isfile(rosserial_stm32_dir+"/src/ros_lib/"+f):
shutil.copy(rosserial_stm32_dir+"/src/ros_lib/"+f, path+"/Inc/")
rosserial_client_copy_files(rospack, path+"/Inc/")
if os.path.isfile(rosserial_stm32_dir + "/src/ros_lib/" + f):
shutil.copy(rosserial_stm32_dir + "/src/ros_lib/" + f, path)

rosserial_client_copy_files(rospack, path)

# generate messages
rosserial_generate(rospack, path+"/Inc/", ROS_TO_EMBEDDED_TYPES)
rosserial_generate(rospack, path, ROS_TO_EMBEDDED_TYPES)