User Tools

Site Tools


getting_started:write_app:use_on_host

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
getting_started:write_app:use_on_host [2021/03/24 18:16] ursgrafgetting_started:write_app:use_on_host [2023/04/13 09:03] (current) – [Use Existing Project] ursgraf
Line 2: Line 2:
 Back to [[getting_started:compile_eeros_host|]]. Back to [[getting_started:compile_eeros_host|]].
  
-Edit the ''config.sh.in'' file as follows +You will use C++ to develop your EEROS applications. For this you need at least some knowledge of the basic language featuresA good starting point might be [[https://www.cplusplus.com/doc/tutorial/]]. Minimal help can also be found under [[tools:cplusplus|]].
-<code> +
-use_simulator=true +
-use_comedi=false +
-use_ros=false +
-use_ros_setup_script=false +
-</code>+
  
-This will build EEROS without the ROS examples. If you have ROS installed and want to build the ROS examples, change the ''config.sh.in'' to +What do you want to do next?
-<code> +
-use_simulator=true +
-use_comedi=false +
-use_ros=true +
-use_ros_setup_script=true+
  
-ros_setup_script=/opt/ros/kinetic/setup.bash +  * [[getting_started:write_app:use_on_host#Say Hello with EEROS|]] 
-</code> +  * [[getting_started:write_app:use_on_host#Use Existing Project|]]
-The last line must point to your ROS installation path. In general this will be ''/opt/ros/$ros_version_name/setup.bash''.+
  
-Now you can run the ''clone'' script  +===== Say Hello with EEROS ===== 
-<code> + 
-./clone.sh+  - Create a project directory within your EEROS project directory and change into it with <code> 
 +mkdir hello 
 +$ cd hello 
 </code> </code>
 +  - Create a text file "main.cpp" and copy the following code into it <code cpp>
 +#include <iostream>
 +#include <eeros/logger/Logger.hpp>
 +#include <eeros/logger/StreamLogWriter.hpp>
 + 
 +int main() {
 +  using namespace eeros::logger;
 + 
 +  Logger::setDefaultStreamLogger(std::cout);
 +  Logger log = Logger::getLogger();
 + 
 +  log.info() << "Hello, EEROS";
  
-Edit the ''config.sh.in'' file as follows +  return 0; 
-<code> +}
-use_simulator=true +
-use_comedi=false +
-use_ros=false +
-use_ros_setup_script=false+
 </code> </code>
 +  - Create a text file "CMakeLists.txt" and copy the following text into it: <code cpp>
 +cmake_minimum_required(VERSION 3.10)
 +project(helloworld)
  
-This will build EEROS without the ROS examples. If you have ROS installed and want to build the ROS examples, change the ''config.sh.in'' to +find_package(EEROS REQUIRED)
-<code> +
-use_simulator=true +
-use_comedi=false +
-use_ros=true +
-use_ros_setup_script=true+
  
-ros_setup_script=/opt/ros/kinetic/setup.bash+add_executable(helloworld main.cpp) 
 +target_link_libraries(helloworld PRIVATE eeros) 
 +</code>  
 +  - Create a build directory for your new project and change into it with <code> 
 +$ mkdir build-x86 
 +$ cd build-x86
 </code> </code>
-The last line must point to your ROS installation pathIn general this will be ''/opt/ros/$ros_version_name/setup.bash''.+  - Build the project with <code> 
 +$ cmake -DCMAKE_INSTALL_PREFIX=../../install-x86 ../../hello 
 +make 
 +</code> 
 +  - Make changes to "main.cpp", save them and rebuild with <code> 
 +$ make 
 +</code> In order to be able to write your own EEROS programs, you could use any text editor. However, we recommend to use an integrated development environment, see [[getting_started:kdevelop|]].
  
-Now you can run the ''clone'' script  + 
-<code> +Continue with [[getting_started:deploy:deploy_host|]]. 
-$ ./clone.sh+ 
 +===== Use Existing Project ===== 
 +As an example we use the [[getting_started:tutorials:oneaxis|]] demo program. 
 + 
 +  - Fetch the code of the application from within your EEROS project directory with <code> 
 +git clone https://github.com/eeros-project/simple-motor-control.git 
 +$ cd simple-motor-control
 </code> </code>
-After this you can continue with [[getting_started:compile_eeros_host|]].+  - Create a build directory for your new project and change into it with <code> 
 +$ mkdir build-x86 
 +$ cd build-x86 
 +</code> 
 +  - Build the project with <code> 
 +$ cmake -DCMAKE_INSTALL_PREFIX=../../install-x86 -DREQUIRED_EEROS_VERSION=1.3 ../../simple-motor-control 
 +$ make 
 +</code> 
 + 
 +Continue with [[getting_started:deploy:deploy_host|]].
  
getting_started/write_app/use_on_host.txt · Last modified: 2023/04/13 09:03 by ursgraf