diff --git a/README.md b/README.md index d6ee3f7..36acc2f 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ The program should print some info messages and "Connected = False" at the end. An example script that mocks an external simulator is provided and can be used to test the plugin with the following steps: -1. Setup and run Flexiv Elements Studio simulation. See the relevant instructions at the end of this README. +1. Setup and run Flexiv Elements Studio simulation. See [docs/elements_studio_setup.md](docs/elements_studio_setup.md). 2. Start the mock program: @@ -139,7 +139,7 @@ NOTE: ``-D`` followed by ``CMAKE_PREFIX_PATH`` tells the user project's CMake wh An example program that mocks an external simulator is provided and can be used to test the plugin with the following steps: -1. Setup and run Flexiv Elements Studio simulation. See the relevant instructions at the end of this README. +1. Setup and run Flexiv Elements Studio simulation. See [docs/elements_studio_setup.md](docs/elements_studio_setup.md). 2. Start the mock program: @@ -160,29 +160,3 @@ The API documentation can be generated using Doxygen. For example, on Linux: Open any html file under ``flexiv_sim_plugin/doc/html/`` with your browser to view the doc. - -## Flexiv Elements Studio Setup - -### Install Elements Studio on Ubuntu - -1. [Contact Flexiv](https://www.flexiv.com/contact) to obtain the installation package of Elements Studio. -2. Extract the package to a non-root directory. -3. Install Elements Studio: - - bash setup_FlexivElements.sh - -4. Switch physics engine from the default built-in to external: - - bash switch_physics_engine.sh - - Select *External* when prompted. - -### Create a simulated robot in Elements Studio - -1. Start Flexiv Elements Studio from the application menu. -2. In the Robot Connection window, select *Simulator*, and click *CREATE*. -3. Choose "Create according to the selected robot type" and select one from the list, then click *CONFIRM*. A new simulated robot will be added to the simulator list. -4. Toggle on the *Connect* button for the newly added one, then wait for loading. -5. When loading is finished, you'll see a robot at its upright pose, with an "Exception" error at the bottom right corner. This is expected because the external simulator is not started yet. But if you see a normally operating robot, that again means you are running the wrong version of Elements Studio that only supports the built-in physics engine. -6. At the bottom of the window, click on the small robot icon with a "SIM" tag on it, then a small window will pop up, note down the displayed robot serial number. -7. Toggle the virtual motion bar slider button to the "auto" position. In resulting popup window, select "AUTO (REMOTE)" \ No newline at end of file diff --git a/docs/elements_studio_setup.md b/docs/elements_studio_setup.md new file mode 100644 index 0000000..a4933d4 --- /dev/null +++ b/docs/elements_studio_setup.md @@ -0,0 +1,30 @@ +# Flexiv Elements Studio Setup + +Flexiv Elements Studio runs the simulated robot controller. +Set it up once before running any external-simulator workspace. + +## Install Elements Studio on Ubuntu + +1. [Contact Flexiv](https://www.flexiv.com/contact) to obtain the installation package of Elements Studio. +2. Extract the package to a non-root directory. +3. Install Elements Studio: + + bash setup_FlexivElements.sh + +4. Switch physics engine from the default built-in to external: + + bash switch_physics_engine.sh + + Select *External* when prompted. + +## Create a simulated robot in Elements Studio + +1. Start Flexiv Elements Studio from the application menu. +2. In the Robot Connection window, select *Simulator*, and click *CREATE*. +3. Choose "Create according to the selected robot type" and select one from the list, then click *CONFIRM*. A new simulated robot will be added to the simulator list. +4. Toggle on the *Connect* button for the newly added one, then wait for loading. +5. When loading is finished, you'll see a robot at its upright pose, with an "Exception" error at the bottom right corner. This is expected because the external simulator is not started yet. But if you see a normally operating robot, that again means you are running the wrong version of Elements Studio that only supports the built-in physics engine. +6. To enable RDK, Click Settings → Remote Mode → Select a Mode → Ethernet. In the resulting popup window, restart the simulated robot. +7. Toggle the virtual motion bar slider button to the "auto" position. In the resulting popup window, select "AUTO (REMOTE)". +8. At the bottom of the window, click on the small robot icon with a "SIM" tag on it, then a small window will pop up, note down the displayed robot serial number. + diff --git a/include/flexiv/sim_plugin/data.hpp b/include/flexiv/sim_plugin/data.hpp index 2384de3..a9e5711 100644 --- a/include/flexiv/sim_plugin/data.hpp +++ b/include/flexiv/sim_plugin/data.hpp @@ -21,11 +21,14 @@ constexpr size_t kIOPorts = 16; struct SimRobotStates { /** @brief Customized constructor */ - SimRobotStates( - uint64_t _servo_cycle, const std::vector& _q, const std::vector& _dq) + SimRobotStates(uint64_t _servo_cycle, const std::vector& _q, + const std::vector& _dq, const std::vector& _wrist_force = {}, + const std::vector& _wrist_torque = {}) : servo_cycle(_servo_cycle) , q(_q) , dq(_dq) + , wrist_force(_wrist_force) + , wrist_torque(_wrist_torque) { } @@ -44,6 +47,14 @@ struct SimRobotStates * \f$. Unit: \f$ [rad/s] or [m/s] \f$. * @note This contains values for both the external axes (if any) and the robot manipulator. */ std::vector dq = {}; + + /** Current wrist force sensor reading of the simulated robot: \f$ [f_x, f_y, f_z] \f$. Unit: + * \f$ [N] \f$. */ + std::vector wrist_force = {}; + + /** Current wrist torque sensor reading of the simulated robot: \f$ [m_x, m_y, m_z] \f$. Unit: + * \f$ [Nm] \f$. */ + std::vector wrist_torque = {}; }; /** Commands data for a simulated robot in the external simulator */ @@ -72,4 +83,4 @@ struct SimRobotCommands } /* namespace sim_plugin */ } /* namespace flexiv */ -#endif /* FLEXIV_SIM_PLUGIN_DATA_HPP_ */ +#endif /* FLEXIV_SIM_PLUGIN_DATA_HPP_ */ \ No newline at end of file