Hi,
When you install a program, you only get the header files (if necessary) and the binaries. Never the sources, because they're not necessary. This is true for any piece of software, including ARGoS. So, it's normal that installing ARGoS through HomeBrew does not include the sources.
If you want to make your own robot, you don't need to modify the ARGoS sources. You can download them for reference (it's a good idea!) or you could read the relevant files on GitHub. Anyway, no modification is necessary.
To make your own robot, you need to make three classes for it: an entity class (which says how a robot is structured), a physics model (which says how a robot interacts with the environment), and a qt-open model (which says how to draw the robot). If you have special needs, you might need to add new classes to model new devices that ARGoS does not support.
You could use as a starting point the classes of the e-puck. Copy the e-puck files that you find in the ARGoS sources (argos3/src/plugins/robots/e-puck/) somewhere. It could be in a new, dedicated project that you create from scratch, or as a subdirectory of the examples (easier). Then, make the necessary changes: for instance, change the name of the classes (e.g., "CMyEPuck"), change the parameters you want to change, and fix the REGISTER_* statements at the end of the .cpp files to match your new class name.
For instance, if your EXAMPLEDIR is the folder in which you have your ARGoS examples and ARGOSDIR the folder in which you downloaded the ARGoS sources from GitHub, you could execute the following commands in a Bash shell:
- Set the environment variables EXAMPLEDIR and ARGOSDIR. They must be full paths for the subsequent commands to work. Fix these paths to match your configuration.
Code: Select all
export EXAMPLEDIR=/Users/myuser/argos3-examples
Code: Select all
export ARGOSDIR=/Users/myuser/argos3
- Copy the files of the e-puck into the folder
Code: Select all
cp -a $ARGOSDIR/src/plugins/robots/e-puck $EXAMPLEDIR/myepuck
Code: Select all
rm -f $EXAMPLEDIR/myepuck/simulator/*physx*
- Fix the file $EXAMPLEDIR/CMakeLists.txt:
Code: Select all
echo 'add_subdirectory(myepuck)' >> $EXAMPLEDIR/CMakeLists.txt
- Then, change the filenames and the class names to reflect your new robot:
Code: Select all
find $EXAMPLEDIR/myepuck \( -name '*.h' -o -name '*.cpp' \) -print0 | xargs -0 -I{} sed -i.old -e 's/EPuck/MyEPuck/g' -e 's/e-puck/my_e-puck/g' -e 's/epuck/myepuck/g' -e 's/EPUCK/MYEPUCK/g' -e 's|argos3/plugins/robots/my_e-puck|myepuck|g' {}
Code: Select all
find $EXAMPLEDIR/myepuck -name '*.old' -exec rm {} \;
Code: Select all
for F in `find $EXAMPLEDIR/myepuck \( -name '*.h' -o -name '*.cpp' \)`; do G=`basename $F | sed 's/epuck/myepuck/g'`; mv $F `dirname $F`/$G; done
Code: Select all
cat <<EOF > $EXAMPLEDIR/myepuck/CMakeLists.txt
add_library(argos3plugin_simulator_myepuck SHARED
simulator/dynamics2d_myepuck_model.cpp
simulator/dynamics2d_myepuck_model.h
simulator/myepuck_entity.cpp
simulator/myepuck_entity.h
simulator/qtopengl_myepuck.cpp
simulator/qtopengl_myepuck.h)
target_link_libraries(argos3plugin_simulator_myepuck
argos3core_simulator
argos3plugin_simulator_dynamics2d
argos3plugin_simulator_entities
argos3plugin_simulator_genericrobot
argos3plugin_simulator_media)
if(ARGOS_COMPILE_QTOPENGL)
target_link_libraries(argos3plugin_simulator_myepuck
argos3plugin_simulator_qtopengl
\${QT_LIBRARIES} \${GLUT_LIBRARY} \${OPENGL_LIBRARY})
endif(ARGOS_COMPILE_QTOPENGL)
EOF
- Compile the code
- Tell ARGoS to go look for your robot as a new plugin
Code: Select all
export ARGOS_PLUGIN_PATH=$EXAMPLEDIR/build/myepuck
- Make sure ARGoS has correctly seen your robot:
This should show the name of your robot. If so, ARGoS is ready to use it!
- You're good to go. You can put my_e-puck in your .argos file and make all the modifications you want to the code in the directory my_e-puck.
To have ARGoS always remember to look into your example build dir to find your robot (after you close the terminal), execute the following command:
Code: Select all
echo "export ARGOS_PLUGIN_PATH=$EXAMPLEDIR/build/myepuck" >> $HOME/.bashrc
Finally, an important thing: make sure that you either have installed ARGoS through HomeBrew (recommended) or that you have installed ARGoS through the source code. Do not install ARGoS twice, nor execute ARGoS from the sources while having another version of ARGoS installed through HomeBrew. That's important because otherwise ARGoS' plugin systems will get confused and load plugins multiple times, which will create memory corruptions.
Cheers,
Carlo