Attempt at adapting 3d coils backend into a ROS node in my spare time.
Follow these points on the host machine connected with the coils. This machine must clear the dependencies section.
-
Clone the main branch in your ros workspace.
-
Build messages and nodes.
catkin_make
- Make sure the following are in your ~/.bashrc
source /opt/ros/noetic/setup.bash
source ~/ros_ws/devel/setup.bash
export ROS_IP=192.168.0.10
export ROS_MASTER_URI=http://192.168.0.10:11311
- Run the nodes
roslaunch ros_coils middleware.launch
This spins up all the psus as a separate node each.
Follow these points on the local machine you want to push fields with. This machine does not need to clear the dependencies section.
-
Clone the RemoteMachine branch in your ros workspace.
-
Build messages.
catkin_make
- Make sure the following are in your ~/.bashrc
source /opt/ros/noetic/setup.bash
source ~/ros_ws/devel/setup.bash
export ROS_IP=192.168.0.15
export ROS_MASTER_URI=http://192.168.0.10:11311
- You should now be able to publish to the \field topic with no issues.
-
PSU nodes have a Voltage/Current interface, with embedded calls to polarity setting.
-
Each PSU node has a ROS Param "debug", to be used to omit all Serial calls to PSU.
-
V/I limits are set at 70% of each supply's rated values. Those can be set as ROS Params. See 6PSU + Field example for usage.
-
The middleware node is spun, with a Magnetic Field Interface, which is automatically translated to input msgs for each PSU node.
-
The Field Node, takes ROS Params x/y/z/Num and x/y/z/Root.
- x/y/z/Num is an integer (1 or 2) that specifies how many supplies handle the given axis.
- x/y/z/Root is a string that specifies the address of the first supply.
Example
xNum = 2; xRoot = "/PSU0". The X component of the "/Field" topic will be bound to "/PSU0", "/PSU1".
See 6PSU + Field example for usage.
-
The Z2 PSU is unique in that it lacks a Polarity interface, that is normal and handled internally.
-
New values are published only if they differ from the currently outputted values. This is to prevent the supplies from being overwhelmed.
-
Current Max frequency is unknown, but bound by X2 not getting overwhelmed by just existing. Needs investigation.
All supplies (except PSU3) have a separate Polarity and VI interface.
The VI values given from the message get converted to unsigned int values.
The polarity command is complete nonsense, it works differently on different PSUs.
Technically the polarity command has 4 valid arguments: 0x00, 0x01, 0x02, 0x03.
On the original power supplies (now PSU2, PSU4), 0x00 -> Positive output, 0x01 -> Negative output, arguments 0x02 and 0x03 actuall trigger an error.
On PSU3, there is no polarity interface altogether, the sign of the output current is determined by the sign of the current value in the VI interface.
On PSU0, PSU1, the behaviour is more complicated. In short, not only you need to find the correct state for the desired output, but you also need to ensure that transitioning to it is allowed.
I could not find a logic to which state does what and what transition works, so I simply tested them all. See file ~ros_ws/src/ros_coils/transition_data.txt
From there, I used the states that allow free transition between them.
If the PSUs are ever requested to push more voltage/current than they can handle (70% of the rated values), the field interface will shutdown. In this case, it is best you close ros nodes, check how the shutdown was triggered and then start again.
If the change in field magnitude is ever bigger than 15mT, the field interface will also shutdown. Similarly, there is a limit of 22/22/22mT on each axis.
Launch File. This program starts up the Field interface and takes in field inputs(e.g. bx ENTER -> by ENTER -> bz ENTER), one at a time. To exit, type "q" or "shutdown", then close the field interface with Ctrl+C as usual.
To launch this, use:
roslaunch ros_coils field_manual_op.launch
Launch File. This program starts up the Field interface and sweeps between the negative and positive sides of the argument "MaxAbs". This argument can be edited in the launch file. While technically multiple axis can be swept at once, they will not be synchronous unless their respective magnitude is equal.
Absolute magnitude, frequency and increment size are editable from here.
To launch this, use:
roslaunch ros_coils sweep_man.launch
Launch File. This program starts up the Field interface and runs through a csv at a given frequency. The template for csv files is given here. Please be mindful this checks that all inputs in the csv are valid numbers, but all safety checks are still handled top-level by the field and PSU interfaces.
Csv file path (relative to the package) and frequency can be edited here.
To launch, use:
roslaunch ros_coils sweep_csv.launch
Vittorio Francescon